]> git.immae.eu Git - github/wallabag/wallabag.git/blob - tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
Fix phpcs
[github/wallabag/wallabag.git] / tests / Wallabag / CoreBundle / Controller / EntryControllerTest.php
1 <?php
2
3 namespace Tests\Wallabag\CoreBundle\Controller;
4
5 use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
6 use Wallabag\CoreBundle\Entity\Config;
7 use Wallabag\CoreBundle\Entity\Entry;
8 use Wallabag\CoreBundle\Entity\SiteCredential;
9
10 class EntryControllerTest extends WallabagCoreTestCase
11 {
12 const An_URL_CONTAINING_AN_ARTICLE_WITH_IMAGE = 'http://www.lemonde.fr/judo/article/2017/11/11/judo-la-decima-de-teddy-riner_5213605_1556020.html';
13 public $downloadImagesEnabled = false;
14 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';
15
16 /**
17 * @after
18 *
19 * Ensure download_images_enabled is disabled after each script
20 */
21 public function tearDownImagesEnabled()
22 {
23 if ($this->downloadImagesEnabled) {
24 $client = static::createClient();
25 $client->getContainer()->get('craue_config')->set('download_images_enabled', 0);
26
27 $this->downloadImagesEnabled = false;
28 }
29 }
30
31 public function testLogin()
32 {
33 $client = $this->getClient();
34
35 $client->request('GET', '/new');
36
37 $this->assertSame(302, $client->getResponse()->getStatusCode());
38 $this->assertContains('login', $client->getResponse()->headers->get('location'));
39 }
40
41 public function testQuickstart()
42 {
43 $this->logInAs('empty');
44 $client = $this->getClient();
45
46 $client->request('GET', '/unread/list');
47 $this->assertSame(302, $client->getResponse()->getStatusCode());
48 $crawler = $client->followRedirect();
49
50 $this->assertSame(200, $client->getResponse()->getStatusCode());
51 $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
52 $this->assertContains('quickstart.intro.title', $body[0]);
53
54 // Test if quickstart is disabled when user has 1 entry
55 $crawler = $client->request('GET', '/new');
56
57 $this->assertSame(200, $client->getResponse()->getStatusCode());
58
59 $form = $crawler->filter('form[name=entry]')->form();
60
61 $data = [
62 'entry[url]' => $this->url,
63 ];
64
65 $client->submit($form, $data);
66 $this->assertSame(302, $client->getResponse()->getStatusCode());
67 $client->followRedirect();
68
69 $crawler = $client->request('GET', '/unread/list');
70 $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
71 $this->assertContains('entry.list.number_on_the_page', $body[0]);
72 }
73
74 public function testGetNew()
75 {
76 $this->logInAs('admin');
77 $this->useTheme('baggy');
78 $client = $this->getClient();
79
80 $crawler = $client->request('GET', '/new');
81
82 $this->assertSame(200, $client->getResponse()->getStatusCode());
83
84 $this->assertCount(1, $crawler->filter('input[type=url]'));
85 $this->assertCount(1, $crawler->filter('form[name=entry]'));
86 }
87
88 public function testPostNewViaBookmarklet()
89 {
90 $this->logInAs('admin');
91 $this->useTheme('baggy');
92 $client = $this->getClient();
93
94 $crawler = $client->request('GET', '/');
95
96 $this->assertCount(4, $crawler->filter('div[class=entry]'));
97
98 // Good URL
99 $client->request('GET', '/bookmarklet', ['url' => $this->url]);
100 $this->assertSame(302, $client->getResponse()->getStatusCode());
101 $client->followRedirect();
102 $crawler = $client->request('GET', '/');
103 $this->assertCount(5, $crawler->filter('div[class=entry]'));
104
105 $em = $client->getContainer()
106 ->get('doctrine.orm.entity_manager');
107 $entry = $em
108 ->getRepository('WallabagCoreBundle:Entry')
109 ->findByUrlAndUserId($this->url, $this->getLoggedInUserId());
110 $em->remove($entry);
111 $em->flush();
112 }
113
114 public function testPostNewEmpty()
115 {
116 $this->logInAs('admin');
117 $client = $this->getClient();
118
119 $crawler = $client->request('GET', '/new');
120
121 $this->assertSame(200, $client->getResponse()->getStatusCode());
122
123 $form = $crawler->filter('form[name=entry]')->form();
124
125 $crawler = $client->submit($form);
126
127 $this->assertSame(200, $client->getResponse()->getStatusCode());
128 $this->assertCount(1, $alert = $crawler->filter('form ul li')->extract(['_text']));
129 $this->assertSame('This value should not be blank.', $alert[0]);
130 }
131
132 /**
133 * This test will require an internet connection.
134 */
135 public function testPostNewOk()
136 {
137 $this->logInAs('admin');
138 $client = $this->getClient();
139
140 $crawler = $client->request('GET', '/new');
141
142 $this->assertSame(200, $client->getResponse()->getStatusCode());
143
144 $form = $crawler->filter('form[name=entry]')->form();
145
146 $data = [
147 'entry[url]' => $this->url,
148 ];
149
150 $client->submit($form, $data);
151
152 $this->assertSame(302, $client->getResponse()->getStatusCode());
153
154 $content = $client->getContainer()
155 ->get('doctrine.orm.entity_manager')
156 ->getRepository('WallabagCoreBundle:Entry')
157 ->findByUrlAndUserId($this->url, $this->getLoggedInUserId());
158
159 $author = $content->getPublishedBy();
160
161 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
162 $this->assertSame($this->url, $content->getUrl());
163 $this->assertContains('Google', $content->getTitle());
164 $this->assertSame('fr', $content->getLanguage());
165 $this->assertSame('2015-03-28 11:43:19', $content->getPublishedAt()->format('Y-m-d H:i:s'));
166 $this->assertSame('Morgane Tual', $author[0]);
167 $this->assertArrayHasKey('x-varnish1', $content->getHeaders());
168 }
169
170 public function testPostWithMultipleAuthors()
171 {
172 $url = 'http://www.liberation.fr/planete/2017/04/05/donald-trump-et-xi-jinping-tentative-de-flirt-en-floride_1560768';
173 $this->logInAs('admin');
174 $client = $this->getClient();
175
176 $crawler = $client->request('GET', '/new');
177
178 $this->assertSame(200, $client->getResponse()->getStatusCode());
179
180 $form = $crawler->filter('form[name=entry]')->form();
181
182 $data = [
183 'entry[url]' => $url,
184 ];
185
186 $client->submit($form, $data);
187
188 $this->assertSame(302, $client->getResponse()->getStatusCode());
189
190 $content = $client->getContainer()
191 ->get('doctrine.orm.entity_manager')
192 ->getRepository('WallabagCoreBundle:Entry')
193 ->findByUrlAndUserId($url, $this->getLoggedInUserId());
194
195 $authors = $content->getPublishedBy();
196 $this->assertSame('2017-04-05 19:26:13', $content->getPublishedAt()->format('Y-m-d H:i:s'));
197 $this->assertSame('fr', $content->getLanguage());
198 $this->assertSame('Raphaël Balenieri, correspondant à Pékin', $authors[0]);
199 $this->assertSame('Frédéric Autran, correspondant à New York', $authors[1]);
200 }
201
202 public function testPostNewOkUrlExist()
203 {
204 $this->logInAs('admin');
205
206 $entry = new Entry($this->getLoggedInUser());
207 $entry->setUrl($this->url);
208 $this->getEntityManager()->persist($entry);
209 $this->getEntityManager()->flush();
210
211 $client = $this->getClient();
212
213 $crawler = $client->request('GET', '/new');
214
215 $this->assertSame(200, $client->getResponse()->getStatusCode());
216
217 $form = $crawler->filter('form[name=entry]')->form();
218
219 $data = [
220 'entry[url]' => $this->url,
221 ];
222
223 $client->submit($form, $data);
224
225 $this->assertSame(302, $client->getResponse()->getStatusCode());
226 $this->assertContains('/view/', $client->getResponse()->getTargetUrl());
227 }
228
229 public function testPostNewOkUrlExistWithAccent()
230 {
231 $this->logInAs('admin');
232 $client = $this->getClient();
233
234 $url = 'http://www.aritylabs.com/post/106091708292/des-contr%C3%B4leurs-optionnels-gr%C3%A2ce-%C3%A0-constmissing';
235
236 $crawler = $client->request('GET', '/new');
237
238 $this->assertSame(200, $client->getResponse()->getStatusCode());
239
240 $form = $crawler->filter('form[name=entry]')->form();
241
242 $data = [
243 'entry[url]' => $url,
244 ];
245
246 $client->submit($form, $data);
247
248 $crawler = $client->request('GET', '/new');
249
250 $this->assertSame(200, $client->getResponse()->getStatusCode());
251
252 $form = $crawler->filter('form[name=entry]')->form();
253
254 $data = [
255 'entry[url]' => $url,
256 ];
257
258 $client->submit($form, $data);
259
260 $this->assertSame(302, $client->getResponse()->getStatusCode());
261 $this->assertContains('/view/', $client->getResponse()->getTargetUrl());
262 }
263
264 /**
265 * This test will require an internet connection.
266 */
267 public function testPostNewThatWillBeTagged()
268 {
269 $this->logInAs('admin');
270 $client = $this->getClient();
271
272 $crawler = $client->request('GET', '/new');
273
274 $this->assertSame(200, $client->getResponse()->getStatusCode());
275
276 $form = $crawler->filter('form[name=entry]')->form();
277
278 $data = [
279 'entry[url]' => $url = 'https://github.com/wallabag/wallabag',
280 ];
281
282 $client->submit($form, $data);
283
284 $this->assertSame(302, $client->getResponse()->getStatusCode());
285 $this->assertContains('/', $client->getResponse()->getTargetUrl());
286
287 $em = $client->getContainer()
288 ->get('doctrine.orm.entity_manager');
289 $entry = $em
290 ->getRepository('WallabagCoreBundle:Entry')
291 ->findOneByUrl($url);
292 $tags = $entry->getTags();
293
294 $this->assertCount(2, $tags);
295 $this->assertContains('wallabag', $tags);
296 $this->assertSame('en', $entry->getLanguage());
297
298 $em->remove($entry);
299 $em->flush();
300
301 // and now re-submit it to test the cascade persistence for tags after entry removal
302 // related https://github.com/wallabag/wallabag/issues/2121
303 $crawler = $client->request('GET', '/new');
304
305 $this->assertSame(200, $client->getResponse()->getStatusCode());
306
307 $form = $crawler->filter('form[name=entry]')->form();
308
309 $data = [
310 'entry[url]' => $url = 'https://github.com/wallabag/wallabag/tree/master',
311 ];
312
313 $client->submit($form, $data);
314
315 $this->assertSame(302, $client->getResponse()->getStatusCode());
316 $this->assertContains('/', $client->getResponse()->getTargetUrl());
317
318 $entry = $em
319 ->getRepository('WallabagCoreBundle:Entry')
320 ->findOneByUrl($url);
321
322 $tags = $entry->getTags();
323
324 $this->assertCount(2, $tags);
325 $this->assertContains('wallabag', $tags);
326
327 $em->remove($entry);
328 $em->flush();
329 }
330
331 public function testArchive()
332 {
333 $this->logInAs('admin');
334 $client = $this->getClient();
335
336 $client->request('GET', '/archive/list');
337
338 $this->assertSame(200, $client->getResponse()->getStatusCode());
339 }
340
341 public function testUntagged()
342 {
343 $this->logInAs('admin');
344 $client = $this->getClient();
345
346 $client->request('GET', '/untagged/list');
347
348 $this->assertSame(200, $client->getResponse()->getStatusCode());
349 }
350
351 public function testStarred()
352 {
353 $this->logInAs('admin');
354 $client = $this->getClient();
355
356 $client->request('GET', '/starred/list');
357
358 $this->assertSame(200, $client->getResponse()->getStatusCode());
359 }
360
361 public function testRangeException()
362 {
363 $this->logInAs('admin');
364 $client = $this->getClient();
365
366 $client->request('GET', '/all/list/900');
367
368 $this->assertSame(302, $client->getResponse()->getStatusCode());
369 $this->assertSame('/all/list', $client->getResponse()->getTargetUrl());
370 }
371
372 public function testView()
373 {
374 $this->logInAs('admin');
375 $client = $this->getClient();
376
377 $entry = new Entry($this->getLoggedInUser());
378 $entry->setUrl('http://example.com/foo');
379 $entry->setTitle('title foo');
380 $entry->setContent('foo bar baz');
381 $this->getEntityManager()->persist($entry);
382 $this->getEntityManager()->flush();
383
384 $crawler = $client->request('GET', '/view/' . $entry->getId());
385
386 $this->assertSame(200, $client->getResponse()->getStatusCode());
387 $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
388 $this->assertContains($entry->getTitle(), $body[0]);
389 }
390
391 /**
392 * This test will require an internet connection.
393 */
394 public function testReload()
395 {
396 $this->logInAs('admin');
397 $client = $this->getClient();
398
399 $entry = new Entry($this->getLoggedInUser());
400 $entry->setUrl($this->url);
401 $entry->setTitle('title foo');
402 $entry->setContent('');
403 $this->getEntityManager()->persist($entry);
404 $this->getEntityManager()->flush();
405 $this->getEntityManager()->clear();
406
407 $client->request('GET', '/reload/' . $entry->getId());
408
409 $this->assertSame(302, $client->getResponse()->getStatusCode());
410
411 $entry = $this->getEntityManager()
412 ->getRepository('WallabagCoreBundle:Entry')
413 ->find($entry->getId());
414
415 $this->assertNotEmpty($entry->getContent());
416 }
417
418 public function testReloadWithFetchingFailed()
419 {
420 $this->logInAs('admin');
421 $client = $this->getClient();
422
423 $entry = new Entry($this->getLoggedInUser());
424 $entry->setUrl('http://0.0.0.0/failed.html');
425 $this->getEntityManager()->persist($entry);
426 $this->getEntityManager()->flush();
427
428 $client->request('GET', '/reload/' . $entry->getId());
429
430 $this->assertSame(302, $client->getResponse()->getStatusCode());
431
432 // force EntityManager to clear previous entity
433 // otherwise, retrieve the same entity will retrieve change from the previous request :0
434 $this->getEntityManager()->clear();
435 $newContent = $this->getEntityManager()
436 ->getRepository('WallabagCoreBundle:Entry')
437 ->find($entry->getId());
438
439 $this->assertNotSame($client->getContainer()->getParameter('wallabag_core.fetching_error_message'), $newContent->getContent());
440 }
441
442 public function testEdit()
443 {
444 $this->logInAs('admin');
445 $client = $this->getClient();
446
447 $entry = new Entry($this->getLoggedInUser());
448 $entry->setUrl($this->url);
449 $this->getEntityManager()->persist($entry);
450 $this->getEntityManager()->flush();
451
452 $crawler = $client->request('GET', '/edit/' . $entry->getId());
453
454 $this->assertSame(200, $client->getResponse()->getStatusCode());
455
456 $this->assertCount(1, $crawler->filter('input[id=entry_title]'));
457 $this->assertCount(1, $crawler->filter('button[id=entry_save]'));
458 }
459
460 public function testEditUpdate()
461 {
462 $this->logInAs('admin');
463 $client = $this->getClient();
464
465 $entry = new Entry($this->getLoggedInUser());
466 $entry->setUrl($this->url);
467 $this->getEntityManager()->persist($entry);
468 $this->getEntityManager()->flush();
469
470 $crawler = $client->request('GET', '/edit/' . $entry->getId());
471
472 $this->assertSame(200, $client->getResponse()->getStatusCode());
473
474 $form = $crawler->filter('button[type=submit]')->form();
475
476 $data = [
477 'entry[title]' => 'My updated title hehe :)',
478 'entry[origin_url]' => 'https://example.io',
479 ];
480
481 $client->submit($form, $data);
482
483 $this->assertSame(302, $client->getResponse()->getStatusCode());
484
485 $crawler = $client->followRedirect();
486
487 $this->assertGreaterThan(1, $title = $crawler->filter('div[id=article] h1')->extract(['_text']));
488 $this->assertContains('My updated title hehe :)', $title[0]);
489 $this->assertGreaterThan(1, $stats = $crawler->filter('div[class=tools] ul[class=stats] li a[class=tool]')->extract(['_text']));
490 $this->assertContains('example.io', trim($stats[1]));
491 }
492
493 public function testEditRemoveOriginUrl()
494 {
495 $this->logInAs('admin');
496 $client = $this->getClient();
497
498 $entry = new Entry($this->getLoggedInUser());
499 $entry->setUrl($this->url);
500 $this->getEntityManager()->persist($entry);
501 $this->getEntityManager()->flush();
502
503 $crawler = $client->request('GET', '/edit/' . $entry->getId());
504
505 $this->assertSame(200, $client->getResponse()->getStatusCode());
506
507 $form = $crawler->filter('button[type=submit]')->form();
508
509 $data = [
510 'entry[title]' => 'My updated title hehe :)',
511 'entry[origin_url]' => '',
512 ];
513
514 $client->submit($form, $data);
515
516 $this->assertSame(302, $client->getResponse()->getStatusCode());
517
518 $crawler = $client->followRedirect();
519
520 $this->assertGreaterThan(1, $title = $crawler->filter('div[id=article] h1')->extract(['_text']));
521 $this->assertContains('My updated title hehe :)', $title[0]);
522 $this->assertSame(1, count($stats = $crawler->filter('div[class=tools] ul[class=stats] li a[class=tool]')->extract(['_text'])));
523 $this->assertNotContains('example.io', trim($stats[0]));
524 }
525
526 public function testToggleArchive()
527 {
528 $this->logInAs('admin');
529 $client = $this->getClient();
530
531 $entry = new Entry($this->getLoggedInUser());
532 $entry->setUrl($this->url);
533 $this->getEntityManager()->persist($entry);
534 $this->getEntityManager()->flush();
535 $this->getEntityManager()->clear();
536
537 $client->request('GET', '/archive/' . $entry->getId());
538
539 $this->assertSame(302, $client->getResponse()->getStatusCode());
540
541 $res = $client->getContainer()
542 ->get('doctrine.orm.entity_manager')
543 ->getRepository('WallabagCoreBundle:Entry')
544 ->find($entry->getId());
545
546 $this->assertSame(1, $res->isArchived());
547 }
548
549 public function testToggleStar()
550 {
551 $this->logInAs('admin');
552 $client = $this->getClient();
553
554 $entry = new Entry($this->getLoggedInUser());
555 $entry->setUrl($this->url);
556 $this->getEntityManager()->persist($entry);
557 $this->getEntityManager()->flush();
558 $this->getEntityManager()->clear();
559
560 $client->request('GET', '/star/' . $entry->getId());
561
562 $this->assertSame(302, $client->getResponse()->getStatusCode());
563
564 $res = $client->getContainer()
565 ->get('doctrine.orm.entity_manager')
566 ->getRepository('WallabagCoreBundle:Entry')
567 ->findOneById($entry->getId());
568
569 $this->assertSame(1, $res->isStarred());
570 }
571
572 public function testDelete()
573 {
574 $this->logInAs('admin');
575 $client = $this->getClient();
576
577 $entry = new Entry($this->getLoggedInUser());
578 $entry->setUrl($this->url);
579 $this->getEntityManager()->persist($entry);
580 $this->getEntityManager()->flush();
581
582 $client->request('GET', '/delete/' . $entry->getId());
583
584 $this->assertSame(302, $client->getResponse()->getStatusCode());
585
586 $client->request('GET', '/delete/' . $entry->getId());
587
588 $this->assertSame(404, $client->getResponse()->getStatusCode());
589 }
590
591 /**
592 * It will create a new entry.
593 * Browse to it.
594 * Then remove it.
595 *
596 * And it'll check that user won't be redirected to the view page of the content when it had been removed
597 */
598 public function testViewAndDelete()
599 {
600 $this->logInAs('admin');
601 $client = $this->getClient();
602
603 $em = $client->getContainer()
604 ->get('doctrine.orm.entity_manager');
605
606 // add a new content to be removed later
607 $user = $em
608 ->getRepository('WallabagUserBundle:User')
609 ->findOneByUserName('admin');
610
611 $content = new Entry($user);
612 $content->setUrl('http://1.1.1.1/entry');
613 $content->setReadingTime(12);
614 $content->setDomainName('domain.io');
615 $content->setMimetype('text/html');
616 $content->setTitle('test title entry');
617 $content->setContent('This is my content /o/');
618 $content->setArchived(true);
619 $content->setLanguage('fr');
620
621 $em->persist($content);
622 $em->flush();
623
624 $client->request('GET', '/view/' . $content->getId());
625 $this->assertSame(200, $client->getResponse()->getStatusCode());
626
627 $client->request('GET', '/delete/' . $content->getId());
628 $this->assertSame(302, $client->getResponse()->getStatusCode());
629
630 $client->followRedirect();
631 $this->assertSame(200, $client->getResponse()->getStatusCode());
632 }
633
634 public function testViewOtherUserEntry()
635 {
636 $this->logInAs('admin');
637 $client = $this->getClient();
638
639 $content = $client->getContainer()
640 ->get('doctrine.orm.entity_manager')
641 ->getRepository('WallabagCoreBundle:Entry')
642 ->findOneByUsernameAndNotArchived('bob');
643
644 $client->request('GET', '/view/' . $content->getId());
645
646 $this->assertSame(403, $client->getResponse()->getStatusCode());
647 }
648
649 public function testFilterOnReadingTime()
650 {
651 $this->logInAs('admin');
652 $this->useTheme('baggy');
653 $client = $this->getClient();
654 $entry = new Entry($this->getLoggedInUser());
655 $entry->setUrl($this->url);
656 $entry->setReadingTime(22);
657 $this->getEntityManager()->persist($entry);
658 $this->getEntityManager()->flush();
659
660 $crawler = $client->request('GET', '/unread/list');
661
662 $form = $crawler->filter('button[id=submit-filter]')->form();
663
664 $data = [
665 'entry_filter[readingTime][right_number]' => 22,
666 'entry_filter[readingTime][left_number]' => 22,
667 ];
668
669 $crawler = $client->submit($form, $data);
670
671 $this->assertCount(1, $crawler->filter('div[class=entry]'));
672 }
673
674 public function testFilterOnReadingTimeWithNegativeValue()
675 {
676 $this->logInAs('admin');
677 $client = $this->getClient();
678
679 $crawler = $client->request('GET', '/unread/list');
680
681 $form = $crawler->filter('button[id=submit-filter]')->form();
682
683 $data = [
684 'entry_filter[readingTime][right_number]' => -22,
685 'entry_filter[readingTime][left_number]' => -22,
686 ];
687
688 $crawler = $client->submit($form, $data);
689
690 // forcing negative value results in no entry displayed
691 $this->assertCount(0, $crawler->filter('div[class=entry]'));
692 }
693
694 public function testFilterOnReadingTimeOnlyUpper()
695 {
696 $this->logInAs('admin');
697 $this->useTheme('baggy');
698 $client = $this->getClient();
699
700 $crawler = $client->request('GET', '/all/list');
701 $this->assertCount(5, $crawler->filter('div[class=entry]'));
702
703 $entry = new Entry($this->getLoggedInUser());
704 $entry->setUrl($this->url);
705 $entry->setReadingTime(23);
706 $this->getEntityManager()->persist($entry);
707 $this->getEntityManager()->flush();
708
709 $crawler = $client->request('GET', '/all/list');
710 $this->assertCount(6, $crawler->filter('div[class=entry]'));
711
712 $form = $crawler->filter('button[id=submit-filter]')->form();
713
714 $data = [
715 'entry_filter[readingTime][right_number]' => 22,
716 ];
717
718 $crawler = $client->submit($form, $data);
719
720 $this->assertCount(5, $crawler->filter('div[class=entry]'));
721 }
722
723 public function testFilterOnReadingTimeOnlyLower()
724 {
725 $this->logInAs('admin');
726 $this->useTheme('baggy');
727 $client = $this->getClient();
728
729 $crawler = $client->request('GET', '/unread/list');
730
731 $form = $crawler->filter('button[id=submit-filter]')->form();
732
733 $data = [
734 'entry_filter[readingTime][left_number]' => 22,
735 ];
736
737 $crawler = $client->submit($form, $data);
738
739 $this->assertCount(0, $crawler->filter('div[class=entry]'));
740
741 $entry = new Entry($this->getLoggedInUser());
742 $entry->setUrl($this->url);
743 $entry->setReadingTime(23);
744 $this->getEntityManager()->persist($entry);
745 $this->getEntityManager()->flush();
746
747 $crawler = $client->submit($form, $data);
748 $this->assertCount(1, $crawler->filter('div[class=entry]'));
749 }
750
751 public function testFilterOnUnreadStatus()
752 {
753 $this->logInAs('admin');
754 $this->useTheme('baggy');
755 $client = $this->getClient();
756
757 $crawler = $client->request('GET', '/all/list');
758
759 $form = $crawler->filter('button[id=submit-filter]')->form();
760
761 $data = [
762 'entry_filter[isUnread]' => true,
763 ];
764
765 $crawler = $client->submit($form, $data);
766
767 $this->assertCount(4, $crawler->filter('div[class=entry]'));
768
769 $entry = new Entry($this->getLoggedInUser());
770 $entry->setUrl($this->url);
771 $entry->setArchived(false);
772 $this->getEntityManager()->persist($entry);
773 $this->getEntityManager()->flush();
774
775 $crawler = $client->submit($form, $data);
776
777 $this->assertCount(5, $crawler->filter('div[class=entry]'));
778 }
779
780 public function testFilterOnCreationDate()
781 {
782 $this->logInAs('admin');
783 $this->useTheme('baggy');
784 $client = $this->getClient();
785
786 $crawler = $client->request('GET', '/unread/list');
787
788 $form = $crawler->filter('button[id=submit-filter]')->form();
789
790 $data = [
791 'entry_filter[createdAt][left_date]' => date('d/m/Y'),
792 'entry_filter[createdAt][right_date]' => date('d/m/Y', strtotime('+1 day')),
793 ];
794
795 $crawler = $client->submit($form, $data);
796
797 $this->assertCount(5, $crawler->filter('div[class=entry]'));
798
799 $data = [
800 'entry_filter[createdAt][left_date]' => date('d/m/Y'),
801 'entry_filter[createdAt][right_date]' => date('d/m/Y'),
802 ];
803
804 $crawler = $client->submit($form, $data);
805
806 $this->assertCount(5, $crawler->filter('div[class=entry]'));
807
808 $data = [
809 'entry_filter[createdAt][left_date]' => '01/01/1970',
810 'entry_filter[createdAt][right_date]' => '01/01/1970',
811 ];
812
813 $crawler = $client->submit($form, $data);
814
815 $this->assertCount(0, $crawler->filter('div[class=entry]'));
816 }
817
818 public function testPaginationWithFilter()
819 {
820 $this->logInAs('admin');
821 $client = $this->getClient();
822 $crawler = $client->request('GET', '/config');
823
824 $form = $crawler->filter('button[id=config_save]')->form();
825
826 $data = [
827 'config[items_per_page]' => '1',
828 ];
829
830 $client->submit($form, $data);
831
832 $parameters = '?entry_filter%5BreadingTime%5D%5Bleft_number%5D=&entry_filter%5BreadingTime%5D%5Bright_number%5D=';
833
834 $client->request('GET', 'unread/list' . $parameters);
835
836 $this->assertContains($parameters, $client->getResponse()->getContent());
837
838 // reset pagination
839 $crawler = $client->request('GET', '/config');
840 $form = $crawler->filter('button[id=config_save]')->form();
841 $data = [
842 'config[items_per_page]' => '12',
843 ];
844 $client->submit($form, $data);
845 }
846
847 public function testFilterOnDomainName()
848 {
849 $this->logInAs('admin');
850 $this->useTheme('baggy');
851 $client = $this->getClient();
852
853 $crawler = $client->request('GET', '/unread/list');
854 $form = $crawler->filter('button[id=submit-filter]')->form();
855 $data = [
856 'entry_filter[domainName]' => 'domain',
857 ];
858
859 $crawler = $client->submit($form, $data);
860 $this->assertCount(5, $crawler->filter('div[class=entry]'));
861
862 $crawler = $client->request('GET', '/unread/list');
863 $form = $crawler->filter('button[id=submit-filter]')->form();
864 $data = [
865 'entry_filter[domainName]' => 'dOmain',
866 ];
867
868 $crawler = $client->submit($form, $data);
869 $this->assertCount(5, $crawler->filter('div[class=entry]'));
870
871 $form = $crawler->filter('button[id=submit-filter]')->form();
872 $data = [
873 'entry_filter[domainName]' => 'wallabag',
874 ];
875
876 $crawler = $client->submit($form, $data);
877 $this->assertCount(0, $crawler->filter('div[class=entry]'));
878 }
879
880 public function testFilterOnStatus()
881 {
882 $this->logInAs('admin');
883 $this->useTheme('baggy');
884 $client = $this->getClient();
885
886 $crawler = $client->request('GET', '/unread/list');
887 $form = $crawler->filter('button[id=submit-filter]')->form();
888 $form['entry_filter[isArchived]']->tick();
889 $form['entry_filter[isStarred]']->untick();
890
891 $crawler = $client->submit($form);
892 $this->assertCount(1, $crawler->filter('div[class=entry]'));
893
894 $form = $crawler->filter('button[id=submit-filter]')->form();
895 $form['entry_filter[isArchived]']->untick();
896 $form['entry_filter[isStarred]']->tick();
897
898 $crawler = $client->submit($form);
899 $this->assertCount(1, $crawler->filter('div[class=entry]'));
900 }
901
902 public function testFilterOnIsPublic()
903 {
904 $this->logInAs('admin');
905 $this->useTheme('baggy');
906 $client = $this->getClient();
907
908 $crawler = $client->request('GET', '/unread/list');
909 $form = $crawler->filter('button[id=submit-filter]')->form();
910 $form['entry_filter[isPublic]']->tick();
911
912 $crawler = $client->submit($form);
913 $this->assertCount(0, $crawler->filter('div[class=entry]'));
914 }
915
916 public function testPreviewPictureFilter()
917 {
918 $this->logInAs('admin');
919 $this->useTheme('baggy');
920 $client = $this->getClient();
921
922 $crawler = $client->request('GET', '/unread/list');
923 $form = $crawler->filter('button[id=submit-filter]')->form();
924 $form['entry_filter[previewPicture]']->tick();
925
926 $crawler = $client->submit($form);
927 $this->assertCount(1, $crawler->filter('div[class=entry]'));
928 }
929
930 public function testFilterOnLanguage()
931 {
932 $this->logInAs('admin');
933 $this->useTheme('baggy');
934 $client = $this->getClient();
935
936 $entry = new Entry($this->getLoggedInUser());
937 $entry->setUrl($this->url);
938 $entry->setLanguage('fr');
939 $this->getEntityManager()->persist($entry);
940 $this->getEntityManager()->flush();
941
942 $crawler = $client->request('GET', '/unread/list');
943 $form = $crawler->filter('button[id=submit-filter]')->form();
944 $data = [
945 'entry_filter[language]' => 'fr',
946 ];
947
948 $crawler = $client->submit($form, $data);
949 $this->assertCount(3, $crawler->filter('div[class=entry]'));
950
951 $form = $crawler->filter('button[id=submit-filter]')->form();
952 $data = [
953 'entry_filter[language]' => 'en',
954 ];
955
956 $crawler = $client->submit($form, $data);
957 $this->assertCount(2, $crawler->filter('div[class=entry]'));
958 }
959
960 public function testShareEntryPublicly()
961 {
962 $this->logInAs('admin');
963 $client = $this->getClient();
964
965 // sharing is enabled
966 $client->getContainer()->get('craue_config')->set('share_public', 1);
967
968 $content = new Entry($this->getLoggedInUser());
969 $content->setUrl($this->url);
970 $this->getEntityManager()->persist($content);
971 $this->getEntityManager()->flush();
972 $this->getEntityManager()->clear();
973
974 // no uid
975 $client->request('GET', '/share/' . $content->getUid());
976 $this->assertSame(404, $client->getResponse()->getStatusCode());
977
978 // generating the uid
979 $client->request('GET', '/share/' . $content->getId());
980 $this->assertSame(302, $client->getResponse()->getStatusCode());
981
982 // follow link with uid
983 $crawler = $client->followRedirect();
984 $this->assertSame(200, $client->getResponse()->getStatusCode());
985 $this->assertContains('max-age=25200', $client->getResponse()->headers->get('cache-control'));
986 $this->assertContains('public', $client->getResponse()->headers->get('cache-control'));
987 $this->assertContains('s-maxage=25200', $client->getResponse()->headers->get('cache-control'));
988 $this->assertNotContains('no-cache', $client->getResponse()->headers->get('cache-control'));
989 $this->assertContains('og:title', $client->getResponse()->getContent());
990 $this->assertContains('og:type', $client->getResponse()->getContent());
991 $this->assertContains('og:url', $client->getResponse()->getContent());
992 $this->assertContains('og:image', $client->getResponse()->getContent());
993
994 // sharing is now disabled
995 $client->getContainer()->get('craue_config')->set('share_public', 0);
996 $client->request('GET', '/share/' . $content->getUid());
997 $this->assertSame(404, $client->getResponse()->getStatusCode());
998
999 $client->request('GET', '/view/' . $content->getId());
1000 $this->assertContains('no-cache', $client->getResponse()->headers->get('cache-control'));
1001
1002 // removing the share
1003 $client->request('GET', '/share/delete/' . $content->getId());
1004 $this->assertSame(302, $client->getResponse()->getStatusCode());
1005
1006 // share is now disable
1007 $client->request('GET', '/share/' . $content->getUid());
1008 $this->assertSame(404, $client->getResponse()->getStatusCode());
1009 }
1010
1011 public function testNewEntryWithDownloadImagesEnabled()
1012 {
1013 $this->downloadImagesEnabled = true;
1014 $this->logInAs('admin');
1015 $client = $this->getClient();
1016
1017 $url = self::An_URL_CONTAINING_AN_ARTICLE_WITH_IMAGE;
1018 $client->getContainer()->get('craue_config')->set('download_images_enabled', 1);
1019
1020 $crawler = $client->request('GET', '/new');
1021
1022 $this->assertSame(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->assertSame(302, $client->getResponse()->getStatusCode());
1033
1034 $em = $client->getContainer()
1035 ->get('doctrine.orm.entity_manager');
1036
1037 $entry = $em
1038 ->getRepository('WallabagCoreBundle:Entry')
1039 ->findByUrlAndUserId($url, $this->getLoggedInUserId());
1040
1041 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $entry);
1042 $this->assertSame($url, $entry->getUrl());
1043 $this->assertContains('Judo', $entry->getTitle());
1044 // instead of checking for the filename (which might change) check that the image is now local
1045 $this->assertContains(rtrim($client->getContainer()->getParameter('domain_name'), '/') . '/assets/images/', $entry->getContent());
1046
1047 $client->getContainer()->get('craue_config')->set('download_images_enabled', 0);
1048 }
1049
1050 /**
1051 * @depends testNewEntryWithDownloadImagesEnabled
1052 */
1053 public function testRemoveEntryWithDownloadImagesEnabled()
1054 {
1055 $this->downloadImagesEnabled = true;
1056 $this->logInAs('admin');
1057 $client = $this->getClient();
1058
1059 $url = self::An_URL_CONTAINING_AN_ARTICLE_WITH_IMAGE;
1060 $client->getContainer()->get('craue_config')->set('download_images_enabled', 1);
1061
1062 $crawler = $client->request('GET', '/new');
1063
1064 $this->assertSame(200, $client->getResponse()->getStatusCode());
1065
1066 $form = $crawler->filter('form[name=entry]')->form();
1067
1068 $data = [
1069 'entry[url]' => $url,
1070 ];
1071
1072 $client->submit($form, $data);
1073
1074 $this->assertSame(302, $client->getResponse()->getStatusCode());
1075
1076 $content = $client->getContainer()
1077 ->get('doctrine.orm.entity_manager')
1078 ->getRepository('WallabagCoreBundle:Entry')
1079 ->findByUrlAndUserId($url, $this->getLoggedInUserId());
1080
1081 $client->request('GET', '/delete/' . $content->getId());
1082
1083 $this->assertSame(302, $client->getResponse()->getStatusCode());
1084
1085 $client->getContainer()->get('craue_config')->set('download_images_enabled', 0);
1086 }
1087
1088 public function testRedirectToHomepage()
1089 {
1090 $this->logInAs('empty');
1091 $client = $this->getClient();
1092
1093 // Redirect to homepage
1094 $config = $this->getLoggedInUser()->getConfig();
1095 $config->setActionMarkAsRead(Config::REDIRECT_TO_HOMEPAGE);
1096 $this->getEntityManager()->persist($config);
1097
1098 $entry = new Entry($this->getLoggedInUser());
1099 $entry->setUrl($this->url);
1100 $this->getEntityManager()->persist($entry);
1101
1102 $this->getEntityManager()->flush();
1103
1104 $client->request('GET', '/view/' . $entry->getId());
1105 $client->request('GET', '/archive/' . $entry->getId());
1106
1107 $this->assertSame(302, $client->getResponse()->getStatusCode());
1108 $this->assertSame('/', $client->getResponse()->headers->get('location'));
1109 }
1110
1111 public function testRedirectToCurrentPage()
1112 {
1113 $this->logInAs('empty');
1114 $client = $this->getClient();
1115
1116 // Redirect to current page
1117 $config = $this->getLoggedInUser()->getConfig();
1118 $config->setActionMarkAsRead(Config::REDIRECT_TO_CURRENT_PAGE);
1119 $this->getEntityManager()->persist($config);
1120
1121 $entry = new Entry($this->getLoggedInUser());
1122 $entry->setUrl($this->url);
1123 $this->getEntityManager()->persist($entry);
1124
1125 $this->getEntityManager()->flush();
1126
1127 $client->request('GET', '/view/' . $entry->getId());
1128 $client->request('GET', '/archive/' . $entry->getId());
1129
1130 $this->assertSame(302, $client->getResponse()->getStatusCode());
1131 $this->assertContains('/view/' . $entry->getId(), $client->getResponse()->headers->get('location'));
1132 }
1133
1134 public function testFilterOnHttpStatus()
1135 {
1136 $this->logInAs('admin');
1137 $this->useTheme('baggy');
1138 $client = $this->getClient();
1139
1140 $entry = new Entry($this->getLoggedInUser());
1141 $entry->setUrl('http://www.lemonde.fr/incorrect-url/');
1142 $entry->setHttpStatus(404);
1143 $this->getEntityManager()->persist($entry);
1144
1145 $this->getEntityManager()->flush();
1146
1147 $crawler = $client->request('GET', '/all/list');
1148 $form = $crawler->filter('button[id=submit-filter]')->form();
1149
1150 $data = [
1151 'entry_filter[httpStatus]' => 404,
1152 ];
1153
1154 $crawler = $client->submit($form, $data);
1155
1156 $this->assertCount(1, $crawler->filter('div[class=entry]'));
1157
1158 $entry = new Entry($this->getLoggedInUser());
1159 $entry->setUrl($this->url);
1160 $entry->setHttpStatus(200);
1161 $this->getEntityManager()->persist($entry);
1162
1163 $entry = new Entry($this->getLoggedInUser());
1164 $entry->setUrl('http://www.nextinpact.com/news/101235-wallabag-alternative-libre-a-pocket-creuse-petit-a-petit-son-nid.htm');
1165 $entry->setHttpStatus(200);
1166 $this->getEntityManager()->persist($entry);
1167
1168 $this->getEntityManager()->flush();
1169
1170 $crawler = $client->request('GET', '/all/list');
1171 $form = $crawler->filter('button[id=submit-filter]')->form();
1172
1173 $data = [
1174 'entry_filter[httpStatus]' => 200,
1175 ];
1176
1177 $crawler = $client->submit($form, $data);
1178
1179 $this->assertCount(2, $crawler->filter('div[class=entry]'));
1180
1181 $crawler = $client->request('GET', '/all/list');
1182 $form = $crawler->filter('button[id=submit-filter]')->form();
1183
1184 $data = [
1185 'entry_filter[httpStatus]' => 1024,
1186 ];
1187
1188 $crawler = $client->submit($form, $data);
1189
1190 $this->assertCount(8, $crawler->filter('div[class=entry]'));
1191 }
1192
1193 public function testSearch()
1194 {
1195 $this->logInAs('admin');
1196 $this->useTheme('baggy');
1197 $client = $this->getClient();
1198
1199 $entry = new Entry($this->getLoggedInUser());
1200 $entry->setUrl($this->url);
1201 $entry->setTitle('test');
1202 $this->getEntityManager()->persist($entry);
1203 $this->getEntityManager()->flush();
1204
1205 // Search on unread list
1206 $crawler = $client->request('GET', '/unread/list');
1207
1208 $form = $crawler->filter('form[name=search]')->form();
1209 $data = [
1210 'search_entry[term]' => 'title',
1211 ];
1212
1213 $crawler = $client->submit($form, $data);
1214
1215 $this->assertCount(4, $crawler->filter('div[class=entry]'));
1216
1217 // Search on starred list
1218 $crawler = $client->request('GET', '/starred/list');
1219
1220 $entry = new Entry($this->getLoggedInUser());
1221 $entry->setUrl('http://localhost/foo/bar');
1222 $entry->setTitle('testeur');
1223 $entry->setStarred(true);
1224 $this->getEntityManager()->persist($entry);
1225 $this->getEntityManager()->flush();
1226
1227 $form = $crawler->filter('form[name=search]')->form();
1228 $data = [
1229 'search_entry[term]' => 'testeur',
1230 ];
1231
1232 $crawler = $client->submit($form, $data);
1233
1234 $this->assertCount(1, $crawler->filter('div[class=entry]'));
1235
1236 $crawler = $client->request('GET', '/archive/list');
1237
1238 // Added new article to test on archive list
1239 $entry = new Entry($this->getLoggedInUser());
1240 $entry->setUrl('http://0.0.0.0/foo/baz/qux');
1241 $entry->setTitle('Le manège');
1242 $entry->setArchived(true);
1243 $this->getEntityManager()->persist($entry);
1244 $this->getEntityManager()->flush();
1245
1246 $form = $crawler->filter('form[name=search]')->form();
1247 $data = [
1248 'search_entry[term]' => 'manège',
1249 ];
1250
1251 $crawler = $client->submit($form, $data);
1252
1253 $this->assertCount(1, $crawler->filter('div[class=entry]'));
1254 $client->request('GET', '/delete/' . $entry->getId());
1255
1256 // test on list of all articles
1257 $crawler = $client->request('GET', '/all/list');
1258
1259 $form = $crawler->filter('form[name=search]')->form();
1260 $data = [
1261 'search_entry[term]' => 'wxcvbnqsdf', // a string not available in the database
1262 ];
1263
1264 $crawler = $client->submit($form, $data);
1265
1266 $this->assertCount(0, $crawler->filter('div[class=entry]'));
1267
1268 // test url search on list of all articles
1269 $entry = new Entry($this->getLoggedInUser());
1270 $entry->setUrl('http://domain/qux');
1271 $entry->setTitle('Le manège');
1272 $entry->setArchived(true);
1273 $this->getEntityManager()->persist($entry);
1274 $this->getEntityManager()->flush();
1275
1276 $crawler = $client->request('GET', '/all/list');
1277
1278 $form = $crawler->filter('form[name=search]')->form();
1279 $data = [
1280 'search_entry[term]' => 'domain', // the search will match an entry with 'domain' in its url
1281 ];
1282
1283 $crawler = $client->submit($form, $data);
1284
1285 $this->assertCount(1, $crawler->filter('div[class=entry]'));
1286
1287 // same as previous test but for case-sensitivity
1288 $crawler = $client->request('GET', '/all/list');
1289
1290 $form = $crawler->filter('form[name=search]')->form();
1291 $data = [
1292 'search_entry[term]' => 'doMain', // the search will match an entry with 'domain' in its url
1293 ];
1294
1295 $crawler = $client->submit($form, $data);
1296
1297 $this->assertCount(1, $crawler->filter('div[class=entry]'));
1298 }
1299
1300 public function dataForLanguage()
1301 {
1302 return [
1303 'ru' => [
1304 'https://www.pravda.ru/world/09-06-2017/1337283-qatar-0/',
1305 'ru',
1306 ],
1307 'fr-FR' => [
1308 'https://www.zataz.com/90-des-dossiers-medicaux-des-coreens-du-sud-vendus-a-des-entreprises-privees/',
1309 'fr_FR',
1310 ],
1311 'de' => [
1312 'http://www.bild.de/politik/ausland/theresa-may/wahlbeben-grossbritannien-analyse-52108924.bild.html',
1313 'de',
1314 ],
1315 'it' => [
1316 'http://www.ansa.it/sito/notizie/mondo/europa/2017/06/08/voto-gb-seggi-aperti-misure-sicurezza-rafforzate_0cb71f7f-e23b-4d5f-95ca-bc12296419f0.html',
1317 'it',
1318 ],
1319 'zh_CN' => [
1320 'http://www.hao123.com/shequ?__noscript__-=1',
1321 'zh_CN',
1322 ],
1323 'de_AT' => [
1324 'https://buy.garmin.com/de-AT/AT/catalog/product/compareResult.ep?compareProduct=112885&compareProduct=36728',
1325 'de_AT',
1326 ],
1327 'ru_RU' => [
1328 'http://netler.ru/ikt/windows-error-reporting.htm',
1329 'ru_RU',
1330 ],
1331 'pt_BR' => [
1332 'http://precodoscombustiveis.com.br/postos/cidade/4121/pr/maringa',
1333 'pt_BR',
1334 ],
1335 'fucked_list_of_languages' => [
1336 'http://geocatalog.webservice-energy.org/geonetwork/srv/eng/main.home',
1337 null,
1338 ],
1339 'es-ES' => [
1340 'https://www.muylinux.com/2015/04/17/odf-reino-unido-microsoft-google/',
1341 'es_ES',
1342 ],
1343 ];
1344 }
1345
1346 /**
1347 * @dataProvider dataForLanguage
1348 */
1349 public function testLanguageValidation($url, $expectedLanguage)
1350 {
1351 $this->logInAs('admin');
1352 $client = $this->getClient();
1353
1354 $crawler = $client->request('GET', '/new');
1355
1356 $this->assertSame(200, $client->getResponse()->getStatusCode());
1357
1358 $form = $crawler->filter('form[name=entry]')->form();
1359
1360 $data = [
1361 'entry[url]' => $url,
1362 ];
1363
1364 $client->submit($form, $data);
1365
1366 $this->assertSame(302, $client->getResponse()->getStatusCode());
1367
1368 $content = $client->getContainer()
1369 ->get('doctrine.orm.entity_manager')
1370 ->getRepository('WallabagCoreBundle:Entry')
1371 ->findByUrlAndUserId($url, $this->getLoggedInUserId());
1372
1373 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
1374 $this->assertSame($url, $content->getUrl());
1375 $this->assertSame($expectedLanguage, $content->getLanguage());
1376 }
1377
1378 /**
1379 * This test will require an internet connection.
1380 */
1381 public function testRestrictedArticle()
1382 {
1383 $url = 'https://www.monde-diplomatique.fr/2017/05/BONNET/57475';
1384 $this->logInAs('admin');
1385 $client = $this->getClient();
1386 $em = $client->getContainer()->get('doctrine.orm.entity_manager');
1387
1388 // enable restricted access
1389 $client->getContainer()->get('craue_config')->set('restricted_access', 1);
1390
1391 // create a new site_credential
1392 $user = $client->getContainer()->get('security.token_storage')->getToken()->getUser();
1393 $credential = new SiteCredential($user);
1394 $credential->setHost('monde-diplomatique.fr');
1395 $credential->setUsername($client->getContainer()->get('wallabag_core.helper.crypto_proxy')->crypt('foo'));
1396 $credential->setPassword($client->getContainer()->get('wallabag_core.helper.crypto_proxy')->crypt('bar'));
1397
1398 $em->persist($credential);
1399 $em->flush();
1400
1401 $crawler = $client->request('GET', '/new');
1402
1403 $this->assertSame(200, $client->getResponse()->getStatusCode());
1404
1405 $form = $crawler->filter('form[name=entry]')->form();
1406
1407 $data = [
1408 'entry[url]' => $url,
1409 ];
1410
1411 $client->submit($form, $data);
1412
1413 $this->assertSame(302, $client->getResponse()->getStatusCode());
1414
1415 $crawler = $client->followRedirect();
1416
1417 $this->assertSame(200, $client->getResponse()->getStatusCode());
1418 $this->assertContains('flashes.entry.notice.entry_saved', $crawler->filter('body')->extract(['_text'])[0]);
1419
1420 $content = $em
1421 ->getRepository('WallabagCoreBundle:Entry')
1422 ->findByUrlAndUserId($url, $this->getLoggedInUserId());
1423
1424 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
1425 $this->assertSame('Crimes et réformes aux Philippines', $content->getTitle());
1426
1427 $client->getContainer()->get('craue_config')->set('restricted_access', 0);
1428 }
1429 }