diff options
Diffstat (limited to 'tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php')
-rw-r--r-- | tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php | 420 |
1 files changed, 268 insertions, 152 deletions
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index 7db4cf1f..cc7b3672 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php | |||
@@ -8,8 +8,24 @@ use Wallabag\CoreBundle\Entity\Entry; | |||
8 | 8 | ||
9 | class EntryControllerTest extends WallabagCoreTestCase | 9 | class EntryControllerTest extends WallabagCoreTestCase |
10 | { | 10 | { |
11 | public $downloadImagesEnabled = false; | ||
11 | public $url = 'http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html'; | 12 | public $url = 'http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html'; |
12 | 13 | ||
14 | /** | ||
15 | * @after | ||
16 | * | ||
17 | * Ensure download_images_enabled is disabled after each script | ||
18 | */ | ||
19 | public function tearDownImagesEnabled() | ||
20 | { | ||
21 | if ($this->downloadImagesEnabled) { | ||
22 | $client = static::createClient(); | ||
23 | $client->getContainer()->get('craue_config')->set('download_images_enabled', 0); | ||
24 | |||
25 | $this->downloadImagesEnabled = false; | ||
26 | } | ||
27 | } | ||
28 | |||
13 | public function testLogin() | 29 | public function testLogin() |
14 | { | 30 | { |
15 | $client = $this->getClient(); | 31 | $client = $this->getClient(); |
@@ -55,6 +71,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
55 | public function testGetNew() | 71 | public function testGetNew() |
56 | { | 72 | { |
57 | $this->logInAs('admin'); | 73 | $this->logInAs('admin'); |
74 | $this->useTheme('baggy'); | ||
58 | $client = $this->getClient(); | 75 | $client = $this->getClient(); |
59 | 76 | ||
60 | $crawler = $client->request('GET', '/new'); | 77 | $crawler = $client->request('GET', '/new'); |
@@ -68,6 +85,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
68 | public function testPostNewViaBookmarklet() | 85 | public function testPostNewViaBookmarklet() |
69 | { | 86 | { |
70 | $this->logInAs('admin'); | 87 | $this->logInAs('admin'); |
88 | $this->useTheme('baggy'); | ||
71 | $client = $this->getClient(); | 89 | $client = $this->getClient(); |
72 | 90 | ||
73 | $crawler = $client->request('GET', '/'); | 91 | $crawler = $client->request('GET', '/'); |
@@ -135,14 +153,56 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
135 | ->getRepository('WallabagCoreBundle:Entry') | 153 | ->getRepository('WallabagCoreBundle:Entry') |
136 | ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); | 154 | ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); |
137 | 155 | ||
156 | $author = $content->getPublishedBy(); | ||
157 | |||
138 | $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content); | 158 | $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content); |
139 | $this->assertEquals($this->url, $content->getUrl()); | 159 | $this->assertEquals($this->url, $content->getUrl()); |
140 | $this->assertContains('Google', $content->getTitle()); | 160 | $this->assertContains('Google', $content->getTitle()); |
161 | $this->assertEquals('2015-03-28 15:37:39', $content->getPublishedAt()->format('Y-m-d H:i:s')); | ||
162 | $this->assertEquals('Morgane Tual', $author[0]); | ||
163 | $this->assertArrayHasKey('x-varnish1', $content->getHeaders()); | ||
164 | } | ||
165 | |||
166 | public function testPostWithMultipleAuthors() | ||
167 | { | ||
168 | $url = 'http://www.liberation.fr/planete/2017/04/05/donald-trump-et-xi-jinping-tentative-de-flirt-en-floride_1560768'; | ||
169 | $this->logInAs('admin'); | ||
170 | $client = $this->getClient(); | ||
171 | |||
172 | $crawler = $client->request('GET', '/new'); | ||
173 | |||
174 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | ||
175 | |||
176 | $form = $crawler->filter('form[name=entry]')->form(); | ||
177 | |||
178 | $data = [ | ||
179 | 'entry[url]' => $url, | ||
180 | ]; | ||
181 | |||
182 | $client->submit($form, $data); | ||
183 | |||
184 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | ||
185 | |||
186 | $content = $client->getContainer() | ||
187 | ->get('doctrine.orm.entity_manager') | ||
188 | ->getRepository('WallabagCoreBundle:Entry') | ||
189 | ->findByUrlAndUserId($url, $this->getLoggedInUserId()); | ||
190 | |||
191 | $authors = $content->getPublishedBy(); | ||
192 | $this->assertEquals('2017-04-05 19:26:13', $content->getPublishedAt()->format('Y-m-d H:i:s')); | ||
193 | $this->assertEquals('Raphaël Balenieri, correspondant à Pékin', $authors[0]); | ||
194 | $this->assertEquals('Frédéric Autran, correspondant à New York', $authors[1]); | ||
141 | } | 195 | } |
142 | 196 | ||
143 | public function testPostNewOkUrlExist() | 197 | public function testPostNewOkUrlExist() |
144 | { | 198 | { |
145 | $this->logInAs('admin'); | 199 | $this->logInAs('admin'); |
200 | |||
201 | $entry = new Entry($this->getLoggedInUser()); | ||
202 | $entry->setUrl($this->url); | ||
203 | $this->getEntityManager()->persist($entry); | ||
204 | $this->getEntityManager()->flush(); | ||
205 | |||
146 | $client = $this->getClient(); | 206 | $client = $this->getClient(); |
147 | 207 | ||
148 | $crawler = $client->request('GET', '/new'); | 208 | $crawler = $client->request('GET', '/new'); |
@@ -235,8 +295,8 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
235 | ->findOneByUrl($url); | 295 | ->findOneByUrl($url); |
236 | $tags = $entry->getTags(); | 296 | $tags = $entry->getTags(); |
237 | 297 | ||
238 | $this->assertCount(1, $tags); | 298 | $this->assertCount(2, $tags); |
239 | $this->assertEquals('wallabag', $tags[0]->getLabel()); | 299 | $this->assertContains('wallabag', $tags); |
240 | 300 | ||
241 | $em->remove($entry); | 301 | $em->remove($entry); |
242 | $em->flush(); | 302 | $em->flush(); |
@@ -264,8 +324,8 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
264 | 324 | ||
265 | $tags = $entry->getTags(); | 325 | $tags = $entry->getTags(); |
266 | 326 | ||
267 | $this->assertCount(1, $tags); | 327 | $this->assertCount(2, $tags); |
268 | $this->assertEquals('wallabag', $tags[0]->getLabel()); | 328 | $this->assertContains('wallabag', $tags); |
269 | 329 | ||
270 | $em->remove($entry); | 330 | $em->remove($entry); |
271 | $em->flush(); | 331 | $em->flush(); |
@@ -312,24 +372,23 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
312 | $this->assertEquals('/all/list', $client->getResponse()->getTargetUrl()); | 372 | $this->assertEquals('/all/list', $client->getResponse()->getTargetUrl()); |
313 | } | 373 | } |
314 | 374 | ||
315 | /** | ||
316 | * @depends testPostNewOk | ||
317 | */ | ||
318 | public function testView() | 375 | public function testView() |
319 | { | 376 | { |
320 | $this->logInAs('admin'); | 377 | $this->logInAs('admin'); |
321 | $client = $this->getClient(); | 378 | $client = $this->getClient(); |
322 | 379 | ||
323 | $content = $client->getContainer() | 380 | $entry = new Entry($this->getLoggedInUser()); |
324 | ->get('doctrine.orm.entity_manager') | 381 | $entry->setUrl('http://example.com/foo'); |
325 | ->getRepository('WallabagCoreBundle:Entry') | 382 | $entry->setTitle('title foo'); |
326 | ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); | 383 | $entry->setContent('foo bar baz'); |
384 | $this->getEntityManager()->persist($entry); | ||
385 | $this->getEntityManager()->flush(); | ||
327 | 386 | ||
328 | $crawler = $client->request('GET', '/view/'.$content->getId()); | 387 | $crawler = $client->request('GET', '/view/'.$entry->getId()); |
329 | 388 | ||
330 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 389 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
331 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); | 390 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); |
332 | $this->assertContains($content->getTitle(), $body[0]); | 391 | $this->assertContains($entry->getTitle(), $body[0]); |
333 | } | 392 | } |
334 | 393 | ||
335 | /** | 394 | /** |
@@ -342,27 +401,23 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
342 | $this->logInAs('admin'); | 401 | $this->logInAs('admin'); |
343 | $client = $this->getClient(); | 402 | $client = $this->getClient(); |
344 | 403 | ||
345 | $em = $client->getContainer() | 404 | $entry = new Entry($this->getLoggedInUser()); |
346 | ->get('doctrine.orm.entity_manager'); | 405 | $entry->setUrl($this->url); |
347 | 406 | $entry->setTitle('title foo'); | |
348 | $content = $em | 407 | $entry->setContent(''); |
349 | ->getRepository('WallabagCoreBundle:Entry') | 408 | $this->getEntityManager()->persist($entry); |
350 | ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); | 409 | $this->getEntityManager()->flush(); |
351 | 410 | $this->getEntityManager()->clear(); | |
352 | // empty content | ||
353 | $content->setContent(''); | ||
354 | $em->persist($content); | ||
355 | $em->flush(); | ||
356 | 411 | ||
357 | $client->request('GET', '/reload/'.$content->getId()); | 412 | $client->request('GET', '/reload/'.$entry->getId()); |
358 | 413 | ||
359 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 414 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
360 | 415 | ||
361 | $content = $em | 416 | $entry = $this->getEntityManager() |
362 | ->getRepository('WallabagCoreBundle:Entry') | 417 | ->getRepository('WallabagCoreBundle:Entry') |
363 | ->find($content->getId()); | 418 | ->find($entry->getId()); |
364 | 419 | ||
365 | $this->assertNotEmpty($content->getContent()); | 420 | $this->assertNotEmpty($entry->getContent()); |
366 | } | 421 | } |
367 | 422 | ||
368 | /** | 423 | /** |
@@ -373,32 +428,21 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
373 | $this->logInAs('admin'); | 428 | $this->logInAs('admin'); |
374 | $client = $this->getClient(); | 429 | $client = $this->getClient(); |
375 | 430 | ||
376 | $em = $client->getContainer() | 431 | $entry = new Entry($this->getLoggedInUser()); |
377 | ->get('doctrine.orm.entity_manager'); | 432 | $entry->setUrl('http://0.0.0.0/failed.html'); |
433 | $this->getEntityManager()->persist($entry); | ||
434 | $this->getEntityManager()->flush(); | ||
378 | 435 | ||
379 | $content = $em | 436 | $client->request('GET', '/reload/'.$entry->getId()); |
380 | ->getRepository('WallabagCoreBundle:Entry') | ||
381 | ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); | ||
382 | |||
383 | // put a known failed url | ||
384 | $content->setUrl('http://0.0.0.0/failed.html'); | ||
385 | $em->persist($content); | ||
386 | $em->flush(); | ||
387 | |||
388 | $client->request('GET', '/reload/'.$content->getId()); | ||
389 | 437 | ||
390 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 438 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
391 | 439 | ||
392 | // force EntityManager to clear previous entity | 440 | // force EntityManager to clear previous entity |
393 | // otherwise, retrieve the same entity will retrieve change from the previous request :0 | 441 | // otherwise, retrieve the same entity will retrieve change from the previous request :0 |
394 | $em->clear(); | 442 | $this->getEntityManager()->clear(); |
395 | $newContent = $em | 443 | $newContent = $this->getEntityManager() |
396 | ->getRepository('WallabagCoreBundle:Entry') | 444 | ->getRepository('WallabagCoreBundle:Entry') |
397 | ->find($content->getId()); | 445 | ->find($entry->getId()); |
398 | |||
399 | $newContent->setUrl($this->url); | ||
400 | $em->persist($newContent); | ||
401 | $em->flush(); | ||
402 | 446 | ||
403 | $this->assertNotEquals($client->getContainer()->getParameter('wallabag_core.fetching_error_message'), $newContent->getContent()); | 447 | $this->assertNotEquals($client->getContainer()->getParameter('wallabag_core.fetching_error_message'), $newContent->getContent()); |
404 | } | 448 | } |
@@ -408,12 +452,12 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
408 | $this->logInAs('admin'); | 452 | $this->logInAs('admin'); |
409 | $client = $this->getClient(); | 453 | $client = $this->getClient(); |
410 | 454 | ||
411 | $content = $client->getContainer() | 455 | $entry = new Entry($this->getLoggedInUser()); |
412 | ->get('doctrine.orm.entity_manager') | 456 | $entry->setUrl($this->url); |
413 | ->getRepository('WallabagCoreBundle:Entry') | 457 | $this->getEntityManager()->persist($entry); |
414 | ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); | 458 | $this->getEntityManager()->flush(); |
415 | 459 | ||
416 | $crawler = $client->request('GET', '/edit/'.$content->getId()); | 460 | $crawler = $client->request('GET', '/edit/'.$entry->getId()); |
417 | 461 | ||
418 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 462 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
419 | 463 | ||
@@ -426,12 +470,12 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
426 | $this->logInAs('admin'); | 470 | $this->logInAs('admin'); |
427 | $client = $this->getClient(); | 471 | $client = $this->getClient(); |
428 | 472 | ||
429 | $content = $client->getContainer() | 473 | $entry = new Entry($this->getLoggedInUser()); |
430 | ->get('doctrine.orm.entity_manager') | 474 | $entry->setUrl($this->url); |
431 | ->getRepository('WallabagCoreBundle:Entry') | 475 | $this->getEntityManager()->persist($entry); |
432 | ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); | 476 | $this->getEntityManager()->flush(); |
433 | 477 | ||
434 | $crawler = $client->request('GET', '/edit/'.$content->getId()); | 478 | $crawler = $client->request('GET', '/edit/'.$entry->getId()); |
435 | 479 | ||
436 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 480 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
437 | 481 | ||
@@ -456,19 +500,20 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
456 | $this->logInAs('admin'); | 500 | $this->logInAs('admin'); |
457 | $client = $this->getClient(); | 501 | $client = $this->getClient(); |
458 | 502 | ||
459 | $content = $client->getContainer() | 503 | $entry = new Entry($this->getLoggedInUser()); |
460 | ->get('doctrine.orm.entity_manager') | 504 | $entry->setUrl($this->url); |
461 | ->getRepository('WallabagCoreBundle:Entry') | 505 | $this->getEntityManager()->persist($entry); |
462 | ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); | 506 | $this->getEntityManager()->flush(); |
507 | $this->getEntityManager()->clear(); | ||
463 | 508 | ||
464 | $client->request('GET', '/archive/'.$content->getId()); | 509 | $client->request('GET', '/archive/'.$entry->getId()); |
465 | 510 | ||
466 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 511 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
467 | 512 | ||
468 | $res = $client->getContainer() | 513 | $res = $client->getContainer() |
469 | ->get('doctrine.orm.entity_manager') | 514 | ->get('doctrine.orm.entity_manager') |
470 | ->getRepository('WallabagCoreBundle:Entry') | 515 | ->getRepository('WallabagCoreBundle:Entry') |
471 | ->find($content->getId()); | 516 | ->find($entry->getId()); |
472 | 517 | ||
473 | $this->assertEquals($res->isArchived(), true); | 518 | $this->assertEquals($res->isArchived(), true); |
474 | } | 519 | } |
@@ -478,19 +523,20 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
478 | $this->logInAs('admin'); | 523 | $this->logInAs('admin'); |
479 | $client = $this->getClient(); | 524 | $client = $this->getClient(); |
480 | 525 | ||
481 | $content = $client->getContainer() | 526 | $entry = new Entry($this->getLoggedInUser()); |
482 | ->get('doctrine.orm.entity_manager') | 527 | $entry->setUrl($this->url); |
483 | ->getRepository('WallabagCoreBundle:Entry') | 528 | $this->getEntityManager()->persist($entry); |
484 | ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); | 529 | $this->getEntityManager()->flush(); |
530 | $this->getEntityManager()->clear(); | ||
485 | 531 | ||
486 | $client->request('GET', '/star/'.$content->getId()); | 532 | $client->request('GET', '/star/'.$entry->getId()); |
487 | 533 | ||
488 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 534 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
489 | 535 | ||
490 | $res = $client->getContainer() | 536 | $res = $client->getContainer() |
491 | ->get('doctrine.orm.entity_manager') | 537 | ->get('doctrine.orm.entity_manager') |
492 | ->getRepository('WallabagCoreBundle:Entry') | 538 | ->getRepository('WallabagCoreBundle:Entry') |
493 | ->findOneById($content->getId()); | 539 | ->findOneById($entry->getId()); |
494 | 540 | ||
495 | $this->assertEquals($res->isStarred(), true); | 541 | $this->assertEquals($res->isStarred(), true); |
496 | } | 542 | } |
@@ -500,16 +546,16 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
500 | $this->logInAs('admin'); | 546 | $this->logInAs('admin'); |
501 | $client = $this->getClient(); | 547 | $client = $this->getClient(); |
502 | 548 | ||
503 | $content = $client->getContainer() | 549 | $entry = new Entry($this->getLoggedInUser()); |
504 | ->get('doctrine.orm.entity_manager') | 550 | $entry->setUrl($this->url); |
505 | ->getRepository('WallabagCoreBundle:Entry') | 551 | $this->getEntityManager()->persist($entry); |
506 | ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); | 552 | $this->getEntityManager()->flush(); |
507 | 553 | ||
508 | $client->request('GET', '/delete/'.$content->getId()); | 554 | $client->request('GET', '/delete/'.$entry->getId()); |
509 | 555 | ||
510 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 556 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
511 | 557 | ||
512 | $client->request('GET', '/delete/'.$content->getId()); | 558 | $client->request('GET', '/delete/'.$entry->getId()); |
513 | 559 | ||
514 | $this->assertEquals(404, $client->getResponse()->getStatusCode()); | 560 | $this->assertEquals(404, $client->getResponse()->getStatusCode()); |
515 | } | 561 | } |
@@ -575,7 +621,13 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
575 | public function testFilterOnReadingTime() | 621 | public function testFilterOnReadingTime() |
576 | { | 622 | { |
577 | $this->logInAs('admin'); | 623 | $this->logInAs('admin'); |
624 | $this->useTheme('baggy'); | ||
578 | $client = $this->getClient(); | 625 | $client = $this->getClient(); |
626 | $entry = new Entry($this->getLoggedInUser()); | ||
627 | $entry->setUrl($this->url); | ||
628 | $entry->setReadingTime(22); | ||
629 | $this->getEntityManager()->persist($entry); | ||
630 | $this->getEntityManager()->flush(); | ||
579 | 631 | ||
580 | $crawler = $client->request('GET', '/unread/list'); | 632 | $crawler = $client->request('GET', '/unread/list'); |
581 | 633 | ||
@@ -614,9 +666,20 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
614 | public function testFilterOnReadingTimeOnlyUpper() | 666 | public function testFilterOnReadingTimeOnlyUpper() |
615 | { | 667 | { |
616 | $this->logInAs('admin'); | 668 | $this->logInAs('admin'); |
669 | $this->useTheme('baggy'); | ||
617 | $client = $this->getClient(); | 670 | $client = $this->getClient(); |
618 | 671 | ||
619 | $crawler = $client->request('GET', '/unread/list'); | 672 | $crawler = $client->request('GET', '/all/list'); |
673 | $this->assertCount(5, $crawler->filter('div[class=entry]')); | ||
674 | |||
675 | $entry = new Entry($this->getLoggedInUser()); | ||
676 | $entry->setUrl($this->url); | ||
677 | $entry->setReadingTime(23); | ||
678 | $this->getEntityManager()->persist($entry); | ||
679 | $this->getEntityManager()->flush(); | ||
680 | |||
681 | $crawler = $client->request('GET', '/all/list'); | ||
682 | $this->assertCount(6, $crawler->filter('div[class=entry]')); | ||
620 | 683 | ||
621 | $form = $crawler->filter('button[id=submit-filter]')->form(); | 684 | $form = $crawler->filter('button[id=submit-filter]')->form(); |
622 | 685 | ||
@@ -626,12 +689,13 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
626 | 689 | ||
627 | $crawler = $client->submit($form, $data); | 690 | $crawler = $client->submit($form, $data); |
628 | 691 | ||
629 | $this->assertCount(2, $crawler->filter('div[class=entry]')); | 692 | $this->assertCount(5, $crawler->filter('div[class=entry]')); |
630 | } | 693 | } |
631 | 694 | ||
632 | public function testFilterOnReadingTimeOnlyLower() | 695 | public function testFilterOnReadingTimeOnlyLower() |
633 | { | 696 | { |
634 | $this->logInAs('admin'); | 697 | $this->logInAs('admin'); |
698 | $this->useTheme('baggy'); | ||
635 | $client = $this->getClient(); | 699 | $client = $this->getClient(); |
636 | 700 | ||
637 | $crawler = $client->request('GET', '/unread/list'); | 701 | $crawler = $client->request('GET', '/unread/list'); |
@@ -644,12 +708,22 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
644 | 708 | ||
645 | $crawler = $client->submit($form, $data); | 709 | $crawler = $client->submit($form, $data); |
646 | 710 | ||
647 | $this->assertCount(4, $crawler->filter('div[class=entry]')); | 711 | $this->assertCount(0, $crawler->filter('div[class=entry]')); |
712 | |||
713 | $entry = new Entry($this->getLoggedInUser()); | ||
714 | $entry->setUrl($this->url); | ||
715 | $entry->setReadingTime(23); | ||
716 | $this->getEntityManager()->persist($entry); | ||
717 | $this->getEntityManager()->flush(); | ||
718 | |||
719 | $crawler = $client->submit($form, $data); | ||
720 | $this->assertCount(1, $crawler->filter('div[class=entry]')); | ||
648 | } | 721 | } |
649 | 722 | ||
650 | public function testFilterOnUnreadStatus() | 723 | public function testFilterOnUnreadStatus() |
651 | { | 724 | { |
652 | $this->logInAs('admin'); | 725 | $this->logInAs('admin'); |
726 | $this->useTheme('baggy'); | ||
653 | $client = $this->getClient(); | 727 | $client = $this->getClient(); |
654 | 728 | ||
655 | $crawler = $client->request('GET', '/all/list'); | 729 | $crawler = $client->request('GET', '/all/list'); |
@@ -663,11 +737,22 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
663 | $crawler = $client->submit($form, $data); | 737 | $crawler = $client->submit($form, $data); |
664 | 738 | ||
665 | $this->assertCount(4, $crawler->filter('div[class=entry]')); | 739 | $this->assertCount(4, $crawler->filter('div[class=entry]')); |
740 | |||
741 | $entry = new Entry($this->getLoggedInUser()); | ||
742 | $entry->setUrl($this->url); | ||
743 | $entry->setArchived(false); | ||
744 | $this->getEntityManager()->persist($entry); | ||
745 | $this->getEntityManager()->flush(); | ||
746 | |||
747 | $crawler = $client->submit($form, $data); | ||
748 | |||
749 | $this->assertCount(5, $crawler->filter('div[class=entry]')); | ||
666 | } | 750 | } |
667 | 751 | ||
668 | public function testFilterOnCreationDate() | 752 | public function testFilterOnCreationDate() |
669 | { | 753 | { |
670 | $this->logInAs('admin'); | 754 | $this->logInAs('admin'); |
755 | $this->useTheme('baggy'); | ||
671 | $client = $this->getClient(); | 756 | $client = $this->getClient(); |
672 | 757 | ||
673 | $crawler = $client->request('GET', '/unread/list'); | 758 | $crawler = $client->request('GET', '/unread/list'); |
@@ -734,6 +819,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
734 | public function testFilterOnDomainName() | 819 | public function testFilterOnDomainName() |
735 | { | 820 | { |
736 | $this->logInAs('admin'); | 821 | $this->logInAs('admin'); |
822 | $this->useTheme('baggy'); | ||
737 | $client = $this->getClient(); | 823 | $client = $this->getClient(); |
738 | 824 | ||
739 | $crawler = $client->request('GET', '/unread/list'); | 825 | $crawler = $client->request('GET', '/unread/list'); |
@@ -766,6 +852,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
766 | public function testFilterOnStatus() | 852 | public function testFilterOnStatus() |
767 | { | 853 | { |
768 | $this->logInAs('admin'); | 854 | $this->logInAs('admin'); |
855 | $this->useTheme('baggy'); | ||
769 | $client = $this->getClient(); | 856 | $client = $this->getClient(); |
770 | 857 | ||
771 | $crawler = $client->request('GET', '/unread/list'); | 858 | $crawler = $client->request('GET', '/unread/list'); |
@@ -787,6 +874,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
787 | public function testPreviewPictureFilter() | 874 | public function testPreviewPictureFilter() |
788 | { | 875 | { |
789 | $this->logInAs('admin'); | 876 | $this->logInAs('admin'); |
877 | $this->useTheme('baggy'); | ||
790 | $client = $this->getClient(); | 878 | $client = $this->getClient(); |
791 | 879 | ||
792 | $crawler = $client->request('GET', '/unread/list'); | 880 | $crawler = $client->request('GET', '/unread/list'); |
@@ -800,8 +888,15 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
800 | public function testFilterOnLanguage() | 888 | public function testFilterOnLanguage() |
801 | { | 889 | { |
802 | $this->logInAs('admin'); | 890 | $this->logInAs('admin'); |
891 | $this->useTheme('baggy'); | ||
803 | $client = $this->getClient(); | 892 | $client = $this->getClient(); |
804 | 893 | ||
894 | $entry = new Entry($this->getLoggedInUser()); | ||
895 | $entry->setUrl($this->url); | ||
896 | $entry->setLanguage('fr'); | ||
897 | $this->getEntityManager()->persist($entry); | ||
898 | $this->getEntityManager()->flush(); | ||
899 | |||
805 | $crawler = $client->request('GET', '/unread/list'); | 900 | $crawler = $client->request('GET', '/unread/list'); |
806 | $form = $crawler->filter('button[id=submit-filter]')->form(); | 901 | $form = $crawler->filter('button[id=submit-filter]')->form(); |
807 | $data = [ | 902 | $data = [ |
@@ -809,7 +904,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
809 | ]; | 904 | ]; |
810 | 905 | ||
811 | $crawler = $client->submit($form, $data); | 906 | $crawler = $client->submit($form, $data); |
812 | $this->assertCount(2, $crawler->filter('div[class=entry]')); | 907 | $this->assertCount(3, $crawler->filter('div[class=entry]')); |
813 | 908 | ||
814 | $form = $crawler->filter('button[id=submit-filter]')->form(); | 909 | $form = $crawler->filter('button[id=submit-filter]')->form(); |
815 | $data = [ | 910 | $data = [ |
@@ -825,10 +920,14 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
825 | $this->logInAs('admin'); | 920 | $this->logInAs('admin'); |
826 | $client = $this->getClient(); | 921 | $client = $this->getClient(); |
827 | 922 | ||
828 | $content = $client->getContainer() | 923 | // sharing is enabled |
829 | ->get('doctrine.orm.entity_manager') | 924 | $client->getContainer()->get('craue_config')->set('share_public', 1); |
830 | ->getRepository('WallabagCoreBundle:Entry') | 925 | |
831 | ->findOneByUser($this->getLoggedInUserId()); | 926 | $content = new Entry($this->getLoggedInUser()); |
927 | $content->setUrl($this->url); | ||
928 | $this->getEntityManager()->persist($content); | ||
929 | $this->getEntityManager()->flush(); | ||
930 | $this->getEntityManager()->clear(); | ||
832 | 931 | ||
833 | // no uid | 932 | // no uid |
834 | $client->request('GET', '/share/'.$content->getUid()); | 933 | $client->request('GET', '/share/'.$content->getUid()); |
@@ -869,6 +968,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
869 | 968 | ||
870 | public function testNewEntryWithDownloadImagesEnabled() | 969 | public function testNewEntryWithDownloadImagesEnabled() |
871 | { | 970 | { |
971 | $this->downloadImagesEnabled = true; | ||
872 | $this->logInAs('admin'); | 972 | $this->logInAs('admin'); |
873 | $client = $this->getClient(); | 973 | $client = $this->getClient(); |
874 | 974 | ||
@@ -899,7 +999,8 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
899 | $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $entry); | 999 | $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $entry); |
900 | $this->assertEquals($url, $entry->getUrl()); | 1000 | $this->assertEquals($url, $entry->getUrl()); |
901 | $this->assertContains('Perpignan', $entry->getTitle()); | 1001 | $this->assertContains('Perpignan', $entry->getTitle()); |
902 | $this->assertContains('/d9bc0fcd.jpeg', $entry->getContent()); | 1002 | // instead of checking for the filename (which might change) check that the image is now local |
1003 | $this->assertContains('http://v2.wallabag.org/assets/images/', $entry->getContent()); | ||
903 | 1004 | ||
904 | $client->getContainer()->get('craue_config')->set('download_images_enabled', 0); | 1005 | $client->getContainer()->get('craue_config')->set('download_images_enabled', 0); |
905 | } | 1006 | } |
@@ -909,12 +1010,27 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
909 | */ | 1010 | */ |
910 | public function testRemoveEntryWithDownloadImagesEnabled() | 1011 | public function testRemoveEntryWithDownloadImagesEnabled() |
911 | { | 1012 | { |
1013 | $this->downloadImagesEnabled = true; | ||
912 | $this->logInAs('admin'); | 1014 | $this->logInAs('admin'); |
913 | $client = $this->getClient(); | 1015 | $client = $this->getClient(); |
914 | 1016 | ||
915 | $url = 'http://www.20minutes.fr/montpellier/1952003-20161030-video-car-tombe-panne-rugbymen-perpignan-improvisent-melee-route'; | 1017 | $url = 'http://www.20minutes.fr/montpellier/1952003-20161030-video-car-tombe-panne-rugbymen-perpignan-improvisent-melee-route'; |
916 | $client->getContainer()->get('craue_config')->set('download_images_enabled', 1); | 1018 | $client->getContainer()->get('craue_config')->set('download_images_enabled', 1); |
917 | 1019 | ||
1020 | $crawler = $client->request('GET', '/new'); | ||
1021 | |||
1022 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | ||
1023 | |||
1024 | $form = $crawler->filter('form[name=entry]')->form(); | ||
1025 | |||
1026 | $data = [ | ||
1027 | 'entry[url]' => $url, | ||
1028 | ]; | ||
1029 | |||
1030 | $client->submit($form, $data); | ||
1031 | |||
1032 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | ||
1033 | |||
918 | $content = $client->getContainer() | 1034 | $content = $client->getContainer() |
919 | ->get('doctrine.orm.entity_manager') | 1035 | ->get('doctrine.orm.entity_manager') |
920 | ->getRepository('WallabagCoreBundle:Entry') | 1036 | ->getRepository('WallabagCoreBundle:Entry') |
@@ -932,28 +1048,19 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
932 | $this->logInAs('empty'); | 1048 | $this->logInAs('empty'); |
933 | $client = $this->getClient(); | 1049 | $client = $this->getClient(); |
934 | 1050 | ||
935 | $em = $client->getContainer()->get('doctrine.orm.entity_manager'); | ||
936 | $user = $em | ||
937 | ->getRepository('WallabagUserBundle:User') | ||
938 | ->find($this->getLoggedInUserId()); | ||
939 | |||
940 | if (!$user) { | ||
941 | $this->markTestSkipped('No user found in db.'); | ||
942 | } | ||
943 | |||
944 | // Redirect to homepage | 1051 | // Redirect to homepage |
945 | $config = $user->getConfig(); | 1052 | $config = $this->getLoggedInUser()->getConfig(); |
946 | $config->setActionMarkAsRead(Config::REDIRECT_TO_HOMEPAGE); | 1053 | $config->setActionMarkAsRead(Config::REDIRECT_TO_HOMEPAGE); |
947 | $em->persist($config); | 1054 | $this->getEntityManager()->persist($config); |
948 | $em->flush(); | ||
949 | 1055 | ||
950 | $content = $client->getContainer() | 1056 | $entry = new Entry($this->getLoggedInUser()); |
951 | ->get('doctrine.orm.entity_manager') | 1057 | $entry->setUrl($this->url); |
952 | ->getRepository('WallabagCoreBundle:Entry') | 1058 | $this->getEntityManager()->persist($entry); |
953 | ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); | ||
954 | 1059 | ||
955 | $client->request('GET', '/view/'.$content->getId()); | 1060 | $this->getEntityManager()->flush(); |
956 | $client->request('GET', '/archive/'.$content->getId()); | 1061 | |
1062 | $client->request('GET', '/view/'.$entry->getId()); | ||
1063 | $client->request('GET', '/archive/'.$entry->getId()); | ||
957 | 1064 | ||
958 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 1065 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
959 | $this->assertEquals('/', $client->getResponse()->headers->get('location')); | 1066 | $this->assertEquals('/', $client->getResponse()->headers->get('location')); |
@@ -964,46 +1071,36 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
964 | $this->logInAs('empty'); | 1071 | $this->logInAs('empty'); |
965 | $client = $this->getClient(); | 1072 | $client = $this->getClient(); |
966 | 1073 | ||
967 | $em = $client->getContainer()->get('doctrine.orm.entity_manager'); | ||
968 | $user = $em | ||
969 | ->getRepository('WallabagUserBundle:User') | ||
970 | ->find($this->getLoggedInUserId()); | ||
971 | |||
972 | if (!$user) { | ||
973 | $this->markTestSkipped('No user found in db.'); | ||
974 | } | ||
975 | |||
976 | // Redirect to current page | 1074 | // Redirect to current page |
977 | $config = $user->getConfig(); | 1075 | $config = $this->getLoggedInUser()->getConfig(); |
978 | $config->setActionMarkAsRead(Config::REDIRECT_TO_CURRENT_PAGE); | 1076 | $config->setActionMarkAsRead(Config::REDIRECT_TO_CURRENT_PAGE); |
979 | $em->persist($config); | 1077 | $this->getEntityManager()->persist($config); |
980 | $em->flush(); | ||
981 | 1078 | ||
982 | $content = $client->getContainer() | 1079 | $entry = new Entry($this->getLoggedInUser()); |
983 | ->get('doctrine.orm.entity_manager') | 1080 | $entry->setUrl($this->url); |
984 | ->getRepository('WallabagCoreBundle:Entry') | 1081 | $this->getEntityManager()->persist($entry); |
985 | ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); | ||
986 | 1082 | ||
987 | $client->request('GET', '/view/'.$content->getId()); | 1083 | $this->getEntityManager()->flush(); |
988 | $client->request('GET', '/archive/'.$content->getId()); | 1084 | |
1085 | $client->request('GET', '/view/'.$entry->getId()); | ||
1086 | $client->request('GET', '/archive/'.$entry->getId()); | ||
989 | 1087 | ||
990 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 1088 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
991 | $this->assertContains('/view/'.$content->getId(), $client->getResponse()->headers->get('location')); | 1089 | $this->assertContains('/view/'.$entry->getId(), $client->getResponse()->headers->get('location')); |
992 | } | 1090 | } |
993 | 1091 | ||
994 | public function testFilterOnHttpStatus() | 1092 | public function testFilterOnHttpStatus() |
995 | { | 1093 | { |
996 | $this->logInAs('admin'); | 1094 | $this->logInAs('admin'); |
1095 | $this->useTheme('baggy'); | ||
997 | $client = $this->getClient(); | 1096 | $client = $this->getClient(); |
998 | 1097 | ||
999 | $crawler = $client->request('GET', '/new'); | 1098 | $entry = new Entry($this->getLoggedInUser()); |
1000 | $form = $crawler->filter('form[name=entry]')->form(); | 1099 | $entry->setUrl('http://www.lemonde.fr/incorrect-url/'); |
1001 | 1100 | $entry->setHttpStatus(404); | |
1002 | $data = [ | 1101 | $this->getEntityManager()->persist($entry); |
1003 | 'entry[url]' => 'http://www.lemonde.fr/incorrect-url/', | ||
1004 | ]; | ||
1005 | 1102 | ||
1006 | $client->submit($form, $data); | 1103 | $this->getEntityManager()->flush(); |
1007 | 1104 | ||
1008 | $crawler = $client->request('GET', '/all/list'); | 1105 | $crawler = $client->request('GET', '/all/list'); |
1009 | $form = $crawler->filter('button[id=submit-filter]')->form(); | 1106 | $form = $crawler->filter('button[id=submit-filter]')->form(); |
@@ -1016,14 +1113,17 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
1016 | 1113 | ||
1017 | $this->assertCount(1, $crawler->filter('div[class=entry]')); | 1114 | $this->assertCount(1, $crawler->filter('div[class=entry]')); |
1018 | 1115 | ||
1019 | $crawler = $client->request('GET', '/new'); | 1116 | $entry = new Entry($this->getLoggedInUser()); |
1020 | $form = $crawler->filter('form[name=entry]')->form(); | 1117 | $entry->setUrl($this->url); |
1118 | $entry->setHttpStatus(200); | ||
1119 | $this->getEntityManager()->persist($entry); | ||
1021 | 1120 | ||
1022 | $data = [ | 1121 | $entry = new Entry($this->getLoggedInUser()); |
1023 | 'entry[url]' => 'http://www.nextinpact.com/news/101235-wallabag-alternative-libre-a-pocket-creuse-petit-a-petit-son-nid.htm', | 1122 | $entry->setUrl('http://www.nextinpact.com/news/101235-wallabag-alternative-libre-a-pocket-creuse-petit-a-petit-son-nid.htm'); |
1024 | ]; | 1123 | $entry->setHttpStatus(200); |
1124 | $this->getEntityManager()->persist($entry); | ||
1025 | 1125 | ||
1026 | $client->submit($form, $data); | 1126 | $this->getEntityManager()->flush(); |
1027 | 1127 | ||
1028 | $crawler = $client->request('GET', '/all/list'); | 1128 | $crawler = $client->request('GET', '/all/list'); |
1029 | $form = $crawler->filter('button[id=submit-filter]')->form(); | 1129 | $form = $crawler->filter('button[id=submit-filter]')->form(); |
@@ -1034,7 +1134,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
1034 | 1134 | ||
1035 | $crawler = $client->submit($form, $data); | 1135 | $crawler = $client->submit($form, $data); |
1036 | 1136 | ||
1037 | $this->assertCount(1, $crawler->filter('div[class=entry]')); | 1137 | $this->assertCount(2, $crawler->filter('div[class=entry]')); |
1038 | 1138 | ||
1039 | $crawler = $client->request('GET', '/all/list'); | 1139 | $crawler = $client->request('GET', '/all/list'); |
1040 | $form = $crawler->filter('button[id=submit-filter]')->form(); | 1140 | $form = $crawler->filter('button[id=submit-filter]')->form(); |
@@ -1045,14 +1145,21 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
1045 | 1145 | ||
1046 | $crawler = $client->submit($form, $data); | 1146 | $crawler = $client->submit($form, $data); |
1047 | 1147 | ||
1048 | $this->assertCount(7, $crawler->filter('div[class=entry]')); | 1148 | $this->assertCount(8, $crawler->filter('div[class=entry]')); |
1049 | } | 1149 | } |
1050 | 1150 | ||
1051 | public function testSearch() | 1151 | public function testSearch() |
1052 | { | 1152 | { |
1053 | $this->logInAs('admin'); | 1153 | $this->logInAs('admin'); |
1154 | $this->useTheme('baggy'); | ||
1054 | $client = $this->getClient(); | 1155 | $client = $this->getClient(); |
1055 | 1156 | ||
1157 | $entry = new Entry($this->getLoggedInUser()); | ||
1158 | $entry->setUrl($this->url); | ||
1159 | $entry->setTitle('test'); | ||
1160 | $this->getEntityManager()->persist($entry); | ||
1161 | $this->getEntityManager()->flush(); | ||
1162 | |||
1056 | // Search on unread list | 1163 | // Search on unread list |
1057 | $crawler = $client->request('GET', '/unread/list'); | 1164 | $crawler = $client->request('GET', '/unread/list'); |
1058 | 1165 | ||
@@ -1063,35 +1170,37 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
1063 | 1170 | ||
1064 | $crawler = $client->submit($form, $data); | 1171 | $crawler = $client->submit($form, $data); |
1065 | 1172 | ||
1066 | $this->assertCount(5, $crawler->filter('div[class=entry]')); | 1173 | $this->assertCount(4, $crawler->filter('div[class=entry]')); |
1067 | 1174 | ||
1068 | // Search on starred list | 1175 | // Search on starred list |
1069 | $crawler = $client->request('GET', '/starred/list'); | 1176 | $crawler = $client->request('GET', '/starred/list'); |
1070 | 1177 | ||
1178 | $entry = new Entry($this->getLoggedInUser()); | ||
1179 | $entry->setUrl('http://localhost/foo/bar'); | ||
1180 | $entry->setTitle('testeur'); | ||
1181 | $entry->setStarred(true); | ||
1182 | $this->getEntityManager()->persist($entry); | ||
1183 | $this->getEntityManager()->flush(); | ||
1184 | |||
1071 | $form = $crawler->filter('form[name=search]')->form(); | 1185 | $form = $crawler->filter('form[name=search]')->form(); |
1072 | $data = [ | 1186 | $data = [ |
1073 | 'search_entry[term]' => 'title', | 1187 | 'search_entry[term]' => 'testeur', |
1074 | ]; | 1188 | ]; |
1075 | 1189 | ||
1076 | $crawler = $client->submit($form, $data); | 1190 | $crawler = $client->submit($form, $data); |
1077 | 1191 | ||
1078 | $this->assertCount(1, $crawler->filter('div[class=entry]')); | 1192 | $this->assertCount(1, $crawler->filter('div[class=entry]')); |
1079 | 1193 | ||
1080 | // Added new article to test on archive list | ||
1081 | $crawler = $client->request('GET', '/new'); | ||
1082 | $form = $crawler->filter('form[name=entry]')->form(); | ||
1083 | $data = [ | ||
1084 | 'entry[url]' => $this->url, | ||
1085 | ]; | ||
1086 | $client->submit($form, $data); | ||
1087 | $content = $client->getContainer() | ||
1088 | ->get('doctrine.orm.entity_manager') | ||
1089 | ->getRepository('WallabagCoreBundle:Entry') | ||
1090 | ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); | ||
1091 | $client->request('GET', '/archive/'.$content->getId()); | ||
1092 | |||
1093 | $crawler = $client->request('GET', '/archive/list'); | 1194 | $crawler = $client->request('GET', '/archive/list'); |
1094 | 1195 | ||
1196 | // Added new article to test on archive list | ||
1197 | $entry = new Entry($this->getLoggedInUser()); | ||
1198 | $entry->setUrl('http://0.0.0.0/foo/baz/qux'); | ||
1199 | $entry->setTitle('Le manège'); | ||
1200 | $entry->setArchived(true); | ||
1201 | $this->getEntityManager()->persist($entry); | ||
1202 | $this->getEntityManager()->flush(); | ||
1203 | |||
1095 | $form = $crawler->filter('form[name=search]')->form(); | 1204 | $form = $crawler->filter('form[name=search]')->form(); |
1096 | $data = [ | 1205 | $data = [ |
1097 | 'search_entry[term]' => 'manège', | 1206 | 'search_entry[term]' => 'manège', |
@@ -1100,7 +1209,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
1100 | $crawler = $client->submit($form, $data); | 1209 | $crawler = $client->submit($form, $data); |
1101 | 1210 | ||
1102 | $this->assertCount(1, $crawler->filter('div[class=entry]')); | 1211 | $this->assertCount(1, $crawler->filter('div[class=entry]')); |
1103 | $client->request('GET', '/delete/'.$content->getId()); | 1212 | $client->request('GET', '/delete/'.$entry->getId()); |
1104 | 1213 | ||
1105 | // test on list of all articles | 1214 | // test on list of all articles |
1106 | $crawler = $client->request('GET', '/all/list'); | 1215 | $crawler = $client->request('GET', '/all/list'); |
@@ -1115,6 +1224,13 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
1115 | $this->assertCount(0, $crawler->filter('div[class=entry]')); | 1224 | $this->assertCount(0, $crawler->filter('div[class=entry]')); |
1116 | 1225 | ||
1117 | // test url search on list of all articles | 1226 | // test url search on list of all articles |
1227 | $entry = new Entry($this->getLoggedInUser()); | ||
1228 | $entry->setUrl('http://domain/qux'); | ||
1229 | $entry->setTitle('Le manège'); | ||
1230 | $entry->setArchived(true); | ||
1231 | $this->getEntityManager()->persist($entry); | ||
1232 | $this->getEntityManager()->flush(); | ||
1233 | |||
1118 | $crawler = $client->request('GET', '/all/list'); | 1234 | $crawler = $client->request('GET', '/all/list'); |
1119 | 1235 | ||
1120 | $form = $crawler->filter('form[name=search]')->form(); | 1236 | $form = $crawler->filter('form[name=search]')->form(); |