aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
index 2ca13b91..5956b502 100644
--- a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
+++ b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
@@ -161,6 +161,47 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
161 $this->assertEquals('1.1.1.1', $entry->getDomainName()); 161 $this->assertEquals('1.1.1.1', $entry->getDomainName());
162 } 162 }
163 163
164 public function testWithContentAndNoOgImage()
165 {
166 $tagger = $this->getTaggerMock();
167 $tagger->expects($this->once())
168 ->method('tag');
169
170 $graby = $this->getMockBuilder('Graby\Graby')
171 ->setMethods(['fetchContent'])
172 ->disableOriginalConstructor()
173 ->getMock();
174
175 $graby->expects($this->any())
176 ->method('fetchContent')
177 ->willReturn([
178 'html' => str_repeat('this is my content', 325),
179 'title' => 'this is my title',
180 'url' => 'http://1.1.1.1',
181 'content_type' => 'text/html',
182 'language' => 'fr',
183 'status' => '200',
184 'open_graph' => [
185 'og_title' => 'my OG title',
186 'og_description' => 'OG desc',
187 'og_image' => false,
188 ],
189 ]);
190
191 $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger(), $this->fetchingErrorMessage);
192 $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0');
193
194 $this->assertEquals('http://1.1.1.1', $entry->getUrl());
195 $this->assertEquals('this is my title', $entry->getTitle());
196 $this->assertContains('this is my content', $entry->getContent());
197 $this->assertNull($entry->getPreviewPicture());
198 $this->assertEquals('text/html', $entry->getMimetype());
199 $this->assertEquals('fr', $entry->getLanguage());
200 $this->assertEquals('200', $entry->getHttpStatus());
201 $this->assertEquals(4.0, $entry->getReadingTime());
202 $this->assertEquals('1.1.1.1', $entry->getDomainName());
203 }
204
164 public function testWithForcedContent() 205 public function testWithForcedContent()
165 { 206 {
166 $tagger = $this->getTaggerMock(); 207 $tagger = $this->getTaggerMock();