X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FTests%2FHelper%2FContentProxyTest.php;h=1688a48a7c974e31ecf2943f30285656e3ee5329;hb=f530f7f5e19eb611ba79856d3ca3b7aebd2af367;hp=4bce4708f2ae1e42adeb50119dc63057eb4e8de4;hpb=1d7b350b259ccc0110318a377ae3b3752ec6b9fb;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php b/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php index 4bce4708..1688a48a 100644 --- a/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php +++ b/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php @@ -10,6 +10,10 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase { public function testWithEmptyContent() { + $tagger = $this->getTaggerMock(); + $tagger->expects($this->once()) + ->method('tag'); + $graby = $this->getMockBuilder('Graby\Graby') ->setMethods(array('fetchContent')) ->disableOriginalConstructor() @@ -25,7 +29,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase 'language' => '', )); - $proxy = new ContentProxy($graby); + $proxy = new ContentProxy($graby, $tagger); $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); $this->assertEquals('http://0.0.0.0', $entry->getUrl()); @@ -40,6 +44,10 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase public function testWithEmptyContentButOG() { + $tagger = $this->getTaggerMock(); + $tagger->expects($this->once()) + ->method('tag'); + $graby = $this->getMockBuilder('Graby\Graby') ->setMethods(array('fetchContent')) ->disableOriginalConstructor() @@ -59,7 +67,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase ), )); - $proxy = new ContentProxy($graby); + $proxy = new ContentProxy($graby, $tagger); $entry = $proxy->updateEntry(new Entry(new User()), 'http://domain.io'); $this->assertEquals('http://domain.io', $entry->getUrl()); @@ -74,6 +82,10 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase public function testWithContent() { + $tagger = $this->getTaggerMock(); + $tagger->expects($this->once()) + ->method('tag'); + $graby = $this->getMockBuilder('Graby\Graby') ->setMethods(array('fetchContent')) ->disableOriginalConstructor() @@ -94,7 +106,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase ), )); - $proxy = new ContentProxy($graby); + $proxy = new ContentProxy($graby, $tagger); $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); $this->assertEquals('http://1.1.1.1', $entry->getUrl()); @@ -106,4 +118,12 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase $this->assertEquals(4.0, $entry->getReadingTime()); $this->assertEquals('1.1.1.1', $entry->getDomainName()); } + + private function getTaggerMock() + { + return $this->getMockBuilder('Wallabag\CoreBundle\Helper\RuleBasedTagger') + ->setMethods(array('tag')) + ->disableOriginalConstructor() + ->getMock(); + } }