]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - tests/Wallabag/CoreBundle/Twig/WallabagExtensionTest.php
Load custom.css only if exists
[github/wallabag/wallabag.git] / tests / Wallabag / CoreBundle / Twig / WallabagExtensionTest.php
index 82336060fb79356447b868a342e2de40d5791631..db02cb9cf18992f1f63c66216e98899ace8a7e52 100644 (file)
@@ -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()
     {
@@ -24,13 +25,38 @@ class WallabagExtensionTest extends \PHPUnit_Framework_TestCase
             ->disableOriginalConstructor()
             ->getMock();
 
-        $extension = new WallabagExtension($entryRepository, $tagRepository, $tokenStorage, 0, $translator);
+        $extension = new WallabagExtension($entryRepository, $tagRepository, $tokenStorage, 0, $translator, '');
 
         $this->assertSame('lemonde.fr', $extension->removeWww('www.lemonde.fr'));
         $this->assertSame('lemonde.fr', $extension->removeWww('lemonde.fr'));
         $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->assertSame('lemonde.fr', $extension->removeScheme('lemonde.fr'));
+        $this->assertSame('gist.github.com', $extension->removeScheme('gist.github.com'));
+        $this->assertSame('gist.github.com', $extension->removeScheme('https://gist.github.com'));
+    }
+
     public function testRemoveSchemeAndWww()
     {
         $entryRepository = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
@@ -49,7 +75,7 @@ class WallabagExtensionTest extends \PHPUnit_Framework_TestCase
             ->disableOriginalConstructor()
             ->getMock();
 
-        $extension = new WallabagExtension($entryRepository, $tagRepository, $tokenStorage, 0, $translator);
+        $extension = new WallabagExtension($entryRepository, $tagRepository, $tokenStorage, 0, $translator, '');
 
         $this->assertSame('lemonde.fr', $extension->removeSchemeAndWww('www.lemonde.fr'));
         $this->assertSame('lemonde.fr', $extension->removeSchemeAndWww('http://lemonde.fr'));