diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2017-01-10 21:25:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-10 21:25:27 +0100 |
commit | b4d81c91de537370265c7a09b963cab49af629a8 (patch) | |
tree | 44d517cfb60cd24c72c7af8ba2130a3eabfa8cc5 /tests/Wallabag | |
parent | e4ccd3effe8a5561d71d6c5f7c4bd1b23aa5a45b (diff) | |
parent | 1ff2e71c1c488f912b92e47ee261634e8bede4dc (diff) | |
download | wallabag-b4d81c91de537370265c7a09b963cab49af629a8.tar.gz wallabag-b4d81c91de537370265c7a09b963cab49af629a8.tar.zst wallabag-b4d81c91de537370265c7a09b963cab49af629a8.zip |
Merge pull request #2742 from wallabag/fix-og-image-false
Avoid false preview image
Diffstat (limited to 'tests/Wallabag')
-rw-r--r-- | tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php | 2 | ||||
-rw-r--r-- | tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php | 41 |
2 files changed, 42 insertions, 1 deletions
diff --git a/tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php b/tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php index 08f4676e..2cf596d4 100644 --- a/tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php | |||
@@ -82,6 +82,6 @@ class SecurityControllerTest extends WallabagCoreTestCase | |||
82 | 82 | ||
83 | $client->followRedirects(); | 83 | $client->followRedirects(); |
84 | $crawler = $client->request('GET', '/register'); | 84 | $crawler = $client->request('GET', '/register'); |
85 | $this->assertContains('registration.submit', $crawler->filter('body')->extract(['_text'])[0]); | 85 | $this->assertContains('registration.submit', $client->getResponse()->getContent()); |
86 | } | 86 | } |
87 | } | 87 | } |
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(); |