X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2FWallabag%2FCoreBundle%2FTwig%2FWallabagExtensionTest.php;h=3fd90fda10ab6884b5081c02a082d052d10ff029;hb=531c8d0a5c55fa93438e227a7d349235fbd31d28;hp=82336060fb79356447b868a342e2de40d5791631;hpb=773ac5b0f7a56ff2527601498b0822d6ef8bfa40;p=github%2Fwallabag%2Fwallabag.git diff --git a/tests/Wallabag/CoreBundle/Twig/WallabagExtensionTest.php b/tests/Wallabag/CoreBundle/Twig/WallabagExtensionTest.php index 82336060..3fd90fda 100644 --- a/tests/Wallabag/CoreBundle/Twig/WallabagExtensionTest.php +++ b/tests/Wallabag/CoreBundle/Twig/WallabagExtensionTest.php @@ -2,9 +2,10 @@ namespace Tests\Wallabag\CoreBundle\Twig; +use PHPUnit\Framework\TestCase; use Wallabag\CoreBundle\Twig\WallabagExtension; -class WallabagExtensionTest extends \PHPUnit_Framework_TestCase +class WallabagExtensionTest extends TestCase { public function testRemoveWww() { @@ -31,6 +32,31 @@ class WallabagExtensionTest extends \PHPUnit_Framework_TestCase $this->assertSame('gist.github.com', $extension->removeWww('gist.github.com')); } + public function testRemoveScheme() + { + $entryRepository = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') + ->disableOriginalConstructor() + ->getMock(); + + $tagRepository = $this->getMockBuilder('Wallabag\CoreBundle\Repository\TagRepository') + ->disableOriginalConstructor() + ->getMock(); + + $tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface') + ->disableOriginalConstructor() + ->getMock(); + + $translator = $this->getMockBuilder('Symfony\Component\Translation\TranslatorInterface') + ->disableOriginalConstructor() + ->getMock(); + + $extension = new WallabagExtension($entryRepository, $tagRepository, $tokenStorage, 0, $translator); + + $this->assertEquals('lemonde.fr', $extension->removeScheme('lemonde.fr')); + $this->assertEquals('gist.github.com', $extension->removeScheme('gist.github.com')); + $this->assertEquals('gist.github.com', $extension->removeScheme('https://gist.github.com')); + } + public function testRemoveSchemeAndWww() { $entryRepository = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')