diff options
Diffstat (limited to 'tests/Wallabag/CoreBundle')
7 files changed, 207 insertions, 90 deletions
diff --git a/tests/Wallabag/CoreBundle/Command/ExportCommandTest.php b/tests/Wallabag/CoreBundle/Command/ExportCommandTest.php index b21f3318..284efac4 100644 --- a/tests/Wallabag/CoreBundle/Command/ExportCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/ExportCommandTest.php | |||
@@ -10,7 +10,7 @@ use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; | |||
10 | class ExportCommandTest extends WallabagCoreTestCase | 10 | class ExportCommandTest extends WallabagCoreTestCase |
11 | { | 11 | { |
12 | /** | 12 | /** |
13 | * @expectedException Symfony\Component\Console\Exception\RuntimeException | 13 | * @expectedException \Symfony\Component\Console\Exception\RuntimeException |
14 | * @expectedExceptionMessage Not enough arguments (missing: "username") | 14 | * @expectedExceptionMessage Not enough arguments (missing: "username") |
15 | */ | 15 | */ |
16 | public function testExportCommandWithoutUsername() | 16 | public function testExportCommandWithoutUsername() |
diff --git a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php index 122a87d4..71c2ffc6 100644 --- a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php | |||
@@ -67,18 +67,14 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
67 | 67 | ||
68 | $command = $application->find('wallabag:install'); | 68 | $command = $application->find('wallabag:install'); |
69 | 69 | ||
70 | // We mock the QuestionHelper | ||
71 | $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper') | ||
72 | ->disableOriginalConstructor() | ||
73 | ->getMock(); | ||
74 | $question->expects($this->any()) | ||
75 | ->method('ask') | ||
76 | ->will($this->returnValue('yes_'.uniqid('', true))); | ||
77 | |||
78 | // We override the standard helper with our mock | ||
79 | $command->getHelperSet()->set($question, 'question'); | ||
80 | |||
81 | $tester = new CommandTester($command); | 70 | $tester = new CommandTester($command); |
71 | $tester->setInputs([ | ||
72 | 'y', // dropping database | ||
73 | 'y', // create super admin | ||
74 | 'username_'.uniqid('', true), // username | ||
75 | 'password_'.uniqid('', true), // password | ||
76 | 'email_'.uniqid('', true).'@wallabag.it', // email | ||
77 | ]); | ||
82 | $tester->execute([ | 78 | $tester->execute([ |
83 | 'command' => $command->getName(), | 79 | 'command' => $command->getName(), |
84 | ]); | 80 | ]); |
@@ -97,18 +93,13 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
97 | 93 | ||
98 | $command = $application->find('wallabag:install'); | 94 | $command = $application->find('wallabag:install'); |
99 | 95 | ||
100 | // We mock the QuestionHelper | ||
101 | $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper') | ||
102 | ->disableOriginalConstructor() | ||
103 | ->getMock(); | ||
104 | $question->expects($this->any()) | ||
105 | ->method('ask') | ||
106 | ->will($this->returnValue('yes_'.uniqid('', true))); | ||
107 | |||
108 | // We override the standard helper with our mock | ||
109 | $command->getHelperSet()->set($question, 'question'); | ||
110 | |||
111 | $tester = new CommandTester($command); | 96 | $tester = new CommandTester($command); |
97 | $tester->setInputs([ | ||
98 | 'y', // create super admin | ||
99 | 'username_'.uniqid('', true), // username | ||
100 | 'password_'.uniqid('', true), // password | ||
101 | 'email_'.uniqid('', true).'@wallabag.it', // email | ||
102 | ]); | ||
112 | $tester->execute([ | 103 | $tester->execute([ |
113 | 'command' => $command->getName(), | 104 | 'command' => $command->getName(), |
114 | '--reset' => true, | 105 | '--reset' => true, |
@@ -150,18 +141,13 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
150 | 141 | ||
151 | $command = $application->find('wallabag:install'); | 142 | $command = $application->find('wallabag:install'); |
152 | 143 | ||
153 | // We mock the QuestionHelper | ||
154 | $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper') | ||
155 | ->disableOriginalConstructor() | ||
156 | ->getMock(); | ||
157 | $question->expects($this->any()) | ||
158 | ->method('ask') | ||
159 | ->will($this->returnValue('yes_'.uniqid('', true))); | ||
160 | |||
161 | // We override the standard helper with our mock | ||
162 | $command->getHelperSet()->set($question, 'question'); | ||
163 | |||
164 | $tester = new CommandTester($command); | 144 | $tester = new CommandTester($command); |
145 | $tester->setInputs([ | ||
146 | 'y', // create super admin | ||
147 | 'username_'.uniqid('', true), // username | ||
148 | 'password_'.uniqid('', true), // password | ||
149 | 'email_'.uniqid('', true).'@wallabag.it', // email | ||
150 | ]); | ||
165 | $tester->execute([ | 151 | $tester->execute([ |
166 | 'command' => $command->getName(), | 152 | 'command' => $command->getName(), |
167 | ]); | 153 | ]); |
@@ -183,23 +169,12 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
183 | 169 | ||
184 | $command = $application->find('wallabag:install'); | 170 | $command = $application->find('wallabag:install'); |
185 | 171 | ||
186 | // We mock the QuestionHelper | ||
187 | $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper') | ||
188 | ->disableOriginalConstructor() | ||
189 | ->getMock(); | ||
190 | |||
191 | $question->expects($this->exactly(3)) | ||
192 | ->method('ask') | ||
193 | ->will($this->onConsecutiveCalls( | ||
194 | false, // don't want to reset the entire database | ||
195 | true, // do want to reset the schema | ||
196 | false // don't want to create a new user | ||
197 | )); | ||
198 | |||
199 | // We override the standard helper with our mock | ||
200 | $command->getHelperSet()->set($question, 'question'); | ||
201 | |||
202 | $tester = new CommandTester($command); | 172 | $tester = new CommandTester($command); |
173 | $tester->setInputs([ | ||
174 | 'n', // don't want to reset the entire database | ||
175 | 'y', // do want to reset the schema | ||
176 | 'n', // don't want to create a new user | ||
177 | ]); | ||
203 | $tester->execute([ | 178 | $tester->execute([ |
204 | 'command' => $command->getName(), | 179 | 'command' => $command->getName(), |
205 | ]); | 180 | ]); |
@@ -239,22 +214,11 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
239 | 214 | ||
240 | $command = $application->find('wallabag:install'); | 215 | $command = $application->find('wallabag:install'); |
241 | 216 | ||
242 | // We mock the QuestionHelper | ||
243 | $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper') | ||
244 | ->disableOriginalConstructor() | ||
245 | ->getMock(); | ||
246 | |||
247 | $question->expects($this->exactly(2)) | ||
248 | ->method('ask') | ||
249 | ->will($this->onConsecutiveCalls( | ||
250 | false, // don't want to reset the entire database | ||
251 | false // don't want to create a new user | ||
252 | )); | ||
253 | |||
254 | // We override the standard helper with our mock | ||
255 | $command->getHelperSet()->set($question, 'question'); | ||
256 | |||
257 | $tester = new CommandTester($command); | 217 | $tester = new CommandTester($command); |
218 | $tester->setInputs([ | ||
219 | 'n', // don't want to reset the entire database | ||
220 | 'n', // don't want to create a new user | ||
221 | ]); | ||
258 | $tester->execute([ | 222 | $tester->execute([ |
259 | 'command' => $command->getName(), | 223 | 'command' => $command->getName(), |
260 | ]); | 224 | ]); |
@@ -275,21 +239,11 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
275 | 239 | ||
276 | $command = $application->find('wallabag:install'); | 240 | $command = $application->find('wallabag:install'); |
277 | 241 | ||
278 | // We mock the QuestionHelper | ||
279 | $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper') | ||
280 | ->disableOriginalConstructor() | ||
281 | ->getMock(); | ||
282 | $question->expects($this->any()) | ||
283 | ->method('ask') | ||
284 | ->will($this->returnValue('yes_'.uniqid('', true))); | ||
285 | |||
286 | // We override the standard helper with our mock | ||
287 | $command->getHelperSet()->set($question, 'question'); | ||
288 | |||
289 | $tester = new CommandTester($command); | 242 | $tester = new CommandTester($command); |
290 | $tester->execute([ | 243 | $tester->execute([ |
291 | 'command' => $command->getName(), | 244 | 'command' => $command->getName(), |
292 | '--no-interaction' => true, | 245 | ], [ |
246 | 'interactive' => false, | ||
293 | ]); | 247 | ]); |
294 | 248 | ||
295 | $this->assertContains('Checking system requirements.', $tester->getDisplay()); | 249 | $this->assertContains('Checking system requirements.', $tester->getDisplay()); |
diff --git a/tests/Wallabag/CoreBundle/Command/TagAllCommandTest.php b/tests/Wallabag/CoreBundle/Command/TagAllCommandTest.php index ec31708f..4cde3679 100644 --- a/tests/Wallabag/CoreBundle/Command/TagAllCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/TagAllCommandTest.php | |||
@@ -10,7 +10,7 @@ use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; | |||
10 | class TagAllCommandTest extends WallabagCoreTestCase | 10 | class TagAllCommandTest extends WallabagCoreTestCase |
11 | { | 11 | { |
12 | /** | 12 | /** |
13 | * @expectedException Symfony\Component\Console\Exception\RuntimeException | 13 | * @expectedException \Symfony\Component\Console\Exception\RuntimeException |
14 | * @expectedExceptionMessage Not enough arguments (missing: "username") | 14 | * @expectedExceptionMessage Not enough arguments (missing: "username") |
15 | */ | 15 | */ |
16 | public function testRunTagAllCommandWithoutUsername() | 16 | public function testRunTagAllCommandWithoutUsername() |
diff --git a/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php b/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php index c3b22dcd..80611a87 100644 --- a/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php | |||
@@ -126,9 +126,19 @@ class TagControllerTest extends WallabagCoreTestCase | |||
126 | ->getRepository('WallabagCoreBundle:Tag') | 126 | ->getRepository('WallabagCoreBundle:Tag') |
127 | ->findOneByEntryAndTagLabel($entry, $this->tagName); | 127 | ->findOneByEntryAndTagLabel($entry, $this->tagName); |
128 | 128 | ||
129 | // We make a first request to set an history and test redirection after tag deletion | ||
130 | $client->request('GET', '/view/'.$entry->getId()); | ||
131 | $entryUri = $client->getRequest()->getUri(); | ||
129 | $client->request('GET', '/remove-tag/'.$entry->getId().'/'.$tag->getId()); | 132 | $client->request('GET', '/remove-tag/'.$entry->getId().'/'.$tag->getId()); |
130 | 133 | ||
131 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 134 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
135 | $this->assertEquals($entryUri, $client->getResponse()->getTargetUrl()); | ||
136 | |||
137 | // re-retrieve the entry to be sure to get fresh data from database (mostly for tags) | ||
138 | $entry = $client->getContainer() | ||
139 | ->get('doctrine.orm.entity_manager') | ||
140 | ->getRepository('WallabagCoreBundle:Entry') | ||
141 | ->findByUrlAndUserId('http://0.0.0.0/entry1', $this->getLoggedInUserId()); | ||
132 | 142 | ||
133 | $this->assertNotContains($this->tagName, $entry->getTags()); | 143 | $this->assertNotContains($this->tagName, $entry->getTags()); |
134 | 144 | ||
diff --git a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php index 6494f348..0c715d90 100644 --- a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php +++ b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php | |||
@@ -7,12 +7,14 @@ use Wallabag\CoreBundle\Helper\ContentProxy; | |||
7 | use Wallabag\CoreBundle\Entity\Entry; | 7 | use Wallabag\CoreBundle\Entity\Entry; |
8 | use Wallabag\CoreBundle\Entity\Tag; | 8 | use Wallabag\CoreBundle\Entity\Tag; |
9 | use Wallabag\UserBundle\Entity\User; | 9 | use Wallabag\UserBundle\Entity\User; |
10 | use Wallabag\CoreBundle\Repository\TagRepository; | ||
11 | use Wallabag\CoreBundle\Helper\RuleBasedTagger; | 10 | use Wallabag\CoreBundle\Helper\RuleBasedTagger; |
11 | use Graby\Graby; | ||
12 | use Monolog\Handler\TestHandler; | ||
13 | use Monolog\Logger; | ||
12 | 14 | ||
13 | class ContentProxyTest extends \PHPUnit_Framework_TestCase | 15 | class ContentProxyTest extends \PHPUnit_Framework_TestCase |
14 | { | 16 | { |
15 | private $fetchingErrorMessage = 'wallabag can\'t retrieve contents for this article. Please <a href="http://doc.wallabag.org/en/master/user/errors_during_fetching.html#how-can-i-help-to-fix-that">troubleshoot this issue</a>.'; | 17 | private $fetchingErrorMessage = 'wallabag can\'t retrieve contents for this article. Please <a href="http://doc.wallabag.org/en/user/errors_during_fetching.html#how-can-i-help-to-fix-that">troubleshoot this issue</a>.'; |
16 | 18 | ||
17 | public function testWithBadUrl() | 19 | public function testWithBadUrl() |
18 | { | 20 | { |
@@ -210,16 +212,91 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
210 | $tagger->expects($this->once()) | 212 | $tagger->expects($this->once()) |
211 | ->method('tag'); | 213 | ->method('tag'); |
212 | 214 | ||
213 | $graby = $this->getMockBuilder('Graby\Graby')->getMock(); | 215 | $proxy = new ContentProxy((new Graby()), $tagger, $this->getLogger(), $this->fetchingErrorMessage); |
216 | $entry = $proxy->updateEntry( | ||
217 | new Entry(new User()), | ||
218 | 'http://0.0.0.0', | ||
219 | [ | ||
220 | 'html' => str_repeat('this is my content', 325), | ||
221 | 'title' => 'this is my title', | ||
222 | 'url' => 'http://1.1.1.1', | ||
223 | 'content_type' => 'text/html', | ||
224 | 'language' => 'fr', | ||
225 | 'date' => '1395635872', | ||
226 | 'authors' => ['Jeremy', 'Nico', 'Thomas'], | ||
227 | 'all_headers' => [ | ||
228 | 'Cache-Control' => 'no-cache', | ||
229 | ], | ||
230 | ] | ||
231 | ); | ||
214 | 232 | ||
215 | $proxy = new ContentProxy($graby, $tagger, $this->getLogger(), $this->fetchingErrorMessage); | 233 | $this->assertEquals('http://1.1.1.1', $entry->getUrl()); |
216 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0', [ | 234 | $this->assertEquals('this is my title', $entry->getTitle()); |
217 | 'html' => str_repeat('this is my content', 325), | 235 | $this->assertContains('this is my content', $entry->getContent()); |
218 | 'title' => 'this is my title', | 236 | $this->assertEquals('text/html', $entry->getMimetype()); |
219 | 'url' => 'http://1.1.1.1', | 237 | $this->assertEquals('fr', $entry->getLanguage()); |
220 | 'content_type' => 'text/html', | 238 | $this->assertEquals(4.0, $entry->getReadingTime()); |
221 | 'language' => 'fr', | 239 | $this->assertEquals('1.1.1.1', $entry->getDomainName()); |
222 | ]); | 240 | $this->assertEquals('24/03/2014', $entry->getPublishedAt()->format('d/m/Y')); |
241 | $this->assertContains('Jeremy', $entry->getPublishedBy()); | ||
242 | $this->assertContains('Nico', $entry->getPublishedBy()); | ||
243 | $this->assertContains('Thomas', $entry->getPublishedBy()); | ||
244 | $this->assertContains('no-cache', $entry->getHeaders()); | ||
245 | } | ||
246 | |||
247 | public function testWithForcedContentAndDatetime() | ||
248 | { | ||
249 | $tagger = $this->getTaggerMock(); | ||
250 | $tagger->expects($this->once()) | ||
251 | ->method('tag'); | ||
252 | |||
253 | $proxy = new ContentProxy((new Graby()), $tagger, $this->getLogger(), $this->fetchingErrorMessage); | ||
254 | $entry = $proxy->updateEntry( | ||
255 | new Entry(new User()), | ||
256 | 'http://0.0.0.0', | ||
257 | [ | ||
258 | 'html' => str_repeat('this is my content', 325), | ||
259 | 'title' => 'this is my title', | ||
260 | 'url' => 'http://1.1.1.1', | ||
261 | 'content_type' => 'text/html', | ||
262 | 'language' => 'fr', | ||
263 | 'date' => '2016-09-08T11:55:58+0200', | ||
264 | ] | ||
265 | ); | ||
266 | |||
267 | $this->assertEquals('http://1.1.1.1', $entry->getUrl()); | ||
268 | $this->assertEquals('this is my title', $entry->getTitle()); | ||
269 | $this->assertContains('this is my content', $entry->getContent()); | ||
270 | $this->assertEquals('text/html', $entry->getMimetype()); | ||
271 | $this->assertEquals('fr', $entry->getLanguage()); | ||
272 | $this->assertEquals(4.0, $entry->getReadingTime()); | ||
273 | $this->assertEquals('1.1.1.1', $entry->getDomainName()); | ||
274 | $this->assertEquals('08/09/2016', $entry->getPublishedAt()->format('d/m/Y')); | ||
275 | } | ||
276 | |||
277 | public function testWithForcedContentAndBadDate() | ||
278 | { | ||
279 | $tagger = $this->getTaggerMock(); | ||
280 | $tagger->expects($this->once()) | ||
281 | ->method('tag'); | ||
282 | |||
283 | $logger = new Logger('foo'); | ||
284 | $handler = new TestHandler(); | ||
285 | $logger->pushHandler($handler); | ||
286 | |||
287 | $proxy = new ContentProxy((new Graby()), $tagger, $logger, $this->fetchingErrorMessage); | ||
288 | $entry = $proxy->updateEntry( | ||
289 | new Entry(new User()), | ||
290 | 'http://0.0.0.0', | ||
291 | [ | ||
292 | 'html' => str_repeat('this is my content', 325), | ||
293 | 'title' => 'this is my title', | ||
294 | 'url' => 'http://1.1.1.1', | ||
295 | 'content_type' => 'text/html', | ||
296 | 'language' => 'fr', | ||
297 | 'date' => '01 02 2012', | ||
298 | ] | ||
299 | ); | ||
223 | 300 | ||
224 | $this->assertEquals('http://1.1.1.1', $entry->getUrl()); | 301 | $this->assertEquals('http://1.1.1.1', $entry->getUrl()); |
225 | $this->assertEquals('this is my title', $entry->getTitle()); | 302 | $this->assertEquals('this is my title', $entry->getTitle()); |
@@ -228,6 +305,12 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
228 | $this->assertEquals('fr', $entry->getLanguage()); | 305 | $this->assertEquals('fr', $entry->getLanguage()); |
229 | $this->assertEquals(4.0, $entry->getReadingTime()); | 306 | $this->assertEquals(4.0, $entry->getReadingTime()); |
230 | $this->assertEquals('1.1.1.1', $entry->getDomainName()); | 307 | $this->assertEquals('1.1.1.1', $entry->getDomainName()); |
308 | $this->assertNull($entry->getPublishedAt()); | ||
309 | |||
310 | $records = $handler->getRecords(); | ||
311 | |||
312 | $this->assertCount(1, $records); | ||
313 | $this->assertContains('Error while defining date', $records[0]['message']); | ||
231 | } | 314 | } |
232 | 315 | ||
233 | public function testTaggerThrowException() | 316 | public function testTaggerThrowException() |
@@ -254,6 +337,58 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
254 | $this->assertCount(0, $entry->getTags()); | 337 | $this->assertCount(0, $entry->getTags()); |
255 | } | 338 | } |
256 | 339 | ||
340 | public function dataForCrazyHtml() | ||
341 | { | ||
342 | return [ | ||
343 | 'script and comment' => [ | ||
344 | '<strong>Script inside:</strong> <!--[if gte IE 4]><script>alert(\'lol\');</script><![endif]--><br />', | ||
345 | 'lol', | ||
346 | ], | ||
347 | 'script' => [ | ||
348 | '<strong>Script inside:</strong><script>alert(\'lol\');</script>', | ||
349 | 'script', | ||
350 | ], | ||
351 | ]; | ||
352 | } | ||
353 | |||
354 | /** | ||
355 | * @dataProvider dataForCrazyHtml | ||
356 | */ | ||
357 | public function testWithCrazyHtmlContent($html, $escapedString) | ||
358 | { | ||
359 | $tagger = $this->getTaggerMock(); | ||
360 | $tagger->expects($this->once()) | ||
361 | ->method('tag'); | ||
362 | |||
363 | $proxy = new ContentProxy((new Graby()), $tagger, $this->getLogger(), $this->fetchingErrorMessage); | ||
364 | $entry = $proxy->updateEntry( | ||
365 | new Entry(new User()), | ||
366 | 'http://1.1.1.1', | ||
367 | [ | ||
368 | 'html' => $html, | ||
369 | 'title' => 'this is my title', | ||
370 | 'url' => 'http://1.1.1.1', | ||
371 | 'content_type' => 'text/html', | ||
372 | 'language' => 'fr', | ||
373 | 'status' => '200', | ||
374 | 'open_graph' => [ | ||
375 | 'og_title' => 'my OG title', | ||
376 | 'og_description' => 'OG desc', | ||
377 | 'og_image' => 'http://3.3.3.3/cover.jpg', | ||
378 | ], | ||
379 | ] | ||
380 | ); | ||
381 | |||
382 | $this->assertEquals('http://1.1.1.1', $entry->getUrl()); | ||
383 | $this->assertEquals('this is my title', $entry->getTitle()); | ||
384 | $this->assertNotContains($escapedString, $entry->getContent()); | ||
385 | $this->assertEquals('http://3.3.3.3/cover.jpg', $entry->getPreviewPicture()); | ||
386 | $this->assertEquals('text/html', $entry->getMimetype()); | ||
387 | $this->assertEquals('fr', $entry->getLanguage()); | ||
388 | $this->assertEquals('200', $entry->getHttpStatus()); | ||
389 | $this->assertEquals('1.1.1.1', $entry->getDomainName()); | ||
390 | } | ||
391 | |||
257 | private function getTaggerMock() | 392 | private function getTaggerMock() |
258 | { | 393 | { |
259 | return $this->getMockBuilder(RuleBasedTagger::class) | 394 | return $this->getMockBuilder(RuleBasedTagger::class) |
diff --git a/tests/Wallabag/CoreBundle/Helper/RedirectTest.php b/tests/Wallabag/CoreBundle/Helper/RedirectTest.php index 0539f20a..f420d06a 100644 --- a/tests/Wallabag/CoreBundle/Helper/RedirectTest.php +++ b/tests/Wallabag/CoreBundle/Helper/RedirectTest.php | |||
@@ -89,4 +89,22 @@ class RedirectTest extends \PHPUnit_Framework_TestCase | |||
89 | 89 | ||
90 | $this->assertEquals($this->routerMock->generate('homepage'), $redirectUrl); | 90 | $this->assertEquals($this->routerMock->generate('homepage'), $redirectUrl); |
91 | } | 91 | } |
92 | |||
93 | public function testUserForRedirectWithIgnoreActionMarkAsRead() | ||
94 | { | ||
95 | $this->token->getUser()->getConfig()->setActionMarkAsRead(Config::REDIRECT_TO_HOMEPAGE); | ||
96 | |||
97 | $redirectUrl = $this->redirect->to('/unread/list', '', true); | ||
98 | |||
99 | $this->assertEquals('/unread/list', $redirectUrl); | ||
100 | } | ||
101 | |||
102 | public function testUserForRedirectNullWithFallbackWithIgnoreActionMarkAsRead() | ||
103 | { | ||
104 | $this->token->getUser()->getConfig()->setActionMarkAsRead(Config::REDIRECT_TO_HOMEPAGE); | ||
105 | |||
106 | $redirectUrl = $this->redirect->to(null, 'fallback', true); | ||
107 | |||
108 | $this->assertEquals('fallback', $redirectUrl); | ||
109 | } | ||
92 | } | 110 | } |
diff --git a/tests/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverterTest.php b/tests/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverterTest.php index 2e6fccfb..ca8e0d50 100644 --- a/tests/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverterTest.php +++ b/tests/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverterTest.php | |||
@@ -136,7 +136,7 @@ class UsernameRssTokenConverterTest extends \PHPUnit_Framework_TestCase | |||
136 | } | 136 | } |
137 | 137 | ||
138 | /** | 138 | /** |
139 | * @expectedException Symfony\Component\HttpKernel\Exception\NotFoundHttpException | 139 | * @expectedException \Symfony\Component\HttpKernel\Exception\NotFoundHttpException |
140 | * @expectedExceptionMessage User not found | 140 | * @expectedExceptionMessage User not found |
141 | */ | 141 | */ |
142 | public function testApplyUserNotFound() | 142 | public function testApplyUserNotFound() |