mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-29 06:38:51 +03:00
0a8fe57003
* refactor: bridgefactory, add tests * refactor: move defaultly enabled bridges to config * refactor * refactor * feat: add support for enabling bridges with env var
30 lines
999 B
PHP
30 lines
999 B
PHP
<?php
|
|
|
|
namespace RssBridge\Tests;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class BridgeFactoryTest extends TestCase
|
|
{
|
|
public function setUp(): void
|
|
{
|
|
\Configuration::loadConfiguration();
|
|
}
|
|
|
|
public function testNormalizeBridgeName()
|
|
{
|
|
$this->assertSame('TwitterBridge', \BridgeFactory::normalizeBridgeName('TwitterBridge'));
|
|
$this->assertSame('TwitterBridge', \BridgeFactory::normalizeBridgeName('TwitterBridge.php'));
|
|
$this->assertSame('TwitterBridge', \BridgeFactory::normalizeBridgeName('Twitter'));
|
|
}
|
|
|
|
public function testSanitizeBridgeName()
|
|
{
|
|
$sut = new \BridgeFactory();
|
|
|
|
$this->assertSame('TwitterBridge', $sut->createBridgeClassName('twitterbridge'));
|
|
$this->assertSame('TwitterBridge', $sut->createBridgeClassName('twitter'));
|
|
$this->assertSame('TwitterBridge', $sut->createBridgeClassName('tWitTer'));
|
|
$this->assertSame('TwitterBridge', $sut->createBridgeClassName('TWITTERBRIDGE'));
|
|
}
|
|
}
|