aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/CoreBundle/Twig/WallabagExtensionTest.php
blob: b1c8c946315f4995918fdfbeca37798b39a572a3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php

namespace Tests\Wallabag\CoreBundle\Twig;

use Wallabag\CoreBundle\Twig\WallabagExtension;

class WallabagExtensionTest extends \PHPUnit_Framework_TestCase
{
    public function testRemoveWww()
    {
        $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->removeWww('www.lemonde.fr'));
        $this->assertEquals('lemonde.fr', $extension->removeWww('lemonde.fr'));
        $this->assertEquals('gist.github.com', $extension->removeWww('gist.github.com'));
    }
}