2015-10-06 04:34:11 +00:00
|
|
|
<?php
|
|
|
|
|
2016-06-01 19:27:35 +00:00
|
|
|
namespace Tests\Wallabag\CoreBundle\Twig;
|
2015-10-06 04:34:11 +00:00
|
|
|
|
|
|
|
use Wallabag\CoreBundle\Twig\WallabagExtension;
|
|
|
|
|
|
|
|
class WallabagExtensionTest extends \PHPUnit_Framework_TestCase
|
|
|
|
{
|
|
|
|
public function testRemoveWww()
|
|
|
|
{
|
2016-10-01 13:58:26 +00:00
|
|
|
$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);
|
2015-10-06 04:34:11 +00:00
|
|
|
|
2015-10-06 18:51:40 +00:00
|
|
|
$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'));
|
2015-10-06 04:34:11 +00:00
|
|
|
}
|
|
|
|
}
|