]> git.immae.eu Git - github/wallabag/wallabag.git/blame - tests/Wallabag/CoreBundle/Twig/WallabagExtensionTest.php
Changed RSS to Atom feed and improve paging
[github/wallabag/wallabag.git] / tests / Wallabag / CoreBundle / Twig / WallabagExtensionTest.php
CommitLineData
784bb4c3
NL
1<?php
2
23634d5d 3namespace Tests\Wallabag\CoreBundle\Twig;
784bb4c3
NL
4
5use Wallabag\CoreBundle\Twig\WallabagExtension;
6
7class WallabagExtensionTest extends \PHPUnit_Framework_TestCase
8{
9 public function testRemoveWww()
10 {
1264029c
JB
11 $entryRepository = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
12 ->disableOriginalConstructor()
13 ->getMock();
14
15 $tagRepository = $this->getMockBuilder('Wallabag\CoreBundle\Repository\TagRepository')
16 ->disableOriginalConstructor()
17 ->getMock();
18
19 $tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')
20 ->disableOriginalConstructor()
21 ->getMock();
22
23 $translator = $this->getMockBuilder('Symfony\Component\Translation\TranslatorInterface')
24 ->disableOriginalConstructor()
25 ->getMock();
26
27 $extension = new WallabagExtension($entryRepository, $tagRepository, $tokenStorage, 0, $translator);
784bb4c3 28
f808b016
JB
29 $this->assertSame('lemonde.fr', $extension->removeWww('www.lemonde.fr'));
30 $this->assertSame('lemonde.fr', $extension->removeWww('lemonde.fr'));
31 $this->assertSame('gist.github.com', $extension->removeWww('gist.github.com'));
784bb4c3 32 }
47e2d609
TC
33
34 public function testRemoveScheme()
35 {
36 $entryRepository = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
37 ->disableOriginalConstructor()
38 ->getMock();
39
40 $tagRepository = $this->getMockBuilder('Wallabag\CoreBundle\Repository\TagRepository')
41 ->disableOriginalConstructor()
42 ->getMock();
43
44 $tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')
45 ->disableOriginalConstructor()
46 ->getMock();
47
48 $translator = $this->getMockBuilder('Symfony\Component\Translation\TranslatorInterface')
49 ->disableOriginalConstructor()
50 ->getMock();
51
52 $extension = new WallabagExtension($entryRepository, $tagRepository, $tokenStorage, 0, $translator);
53
54 $this->assertEquals('lemonde.fr', $extension->removeScheme('lemonde.fr'));
55 $this->assertEquals('gist.github.com', $extension->removeScheme('gist.github.com'));
56 $this->assertEquals('gist.github.com', $extension->removeScheme('https://gist.github.com'));
57 }
784bb4c3 58}