+ public function testWithForcedContent()
+ {
+ $tagger = $this->getTaggerMock();
+ $tagger->expects($this->once())
+ ->method('tag');
+
+ $graby = $this->getMockBuilder('Graby\Graby')->getMock();
+
+ $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger());
+ $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0', [
+ 'html' => str_repeat('this is my content', 325),
+ 'title' => 'this is my title',
+ 'url' => 'http://1.1.1.1',
+ 'content_type' => 'text/html',
+ 'language' => 'fr',
+ ]);
+
+ $this->assertEquals('http://1.1.1.1', $entry->getUrl());
+ $this->assertEquals('this is my title', $entry->getTitle());
+ $this->assertContains('this is my content', $entry->getContent());
+ $this->assertEquals('text/html', $entry->getMimetype());
+ $this->assertEquals('fr', $entry->getLanguage());
+ $this->assertEquals(4.0, $entry->getReadingTime());
+ $this->assertEquals('1.1.1.1', $entry->getDomainName());
+ }
+
+ public function testTaggerThrowException()
+ {
+ $graby = $this->getMockBuilder('Graby\Graby')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $tagger = $this->getTaggerMock();
+ $tagger->expects($this->once())
+ ->method('tag')
+ ->will($this->throwException(new \Exception()));
+
+ $tagRepo = $this->getTagRepositoryMock();
+ $proxy = new ContentProxy($graby, $tagger, $tagRepo, $this->getLogger());
+
+ $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0', [
+ 'html' => str_repeat('this is my content', 325),
+ 'title' => 'this is my title',
+ 'url' => 'http://1.1.1.1',
+ 'content_type' => 'text/html',
+ 'language' => 'fr',
+ ]);
+
+ $this->assertCount(0, $entry->getTags());
+ }
+