diff options
Diffstat (limited to 'tests')
7 files changed, 290 insertions, 12 deletions
diff --git a/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php index c39cc357..ee5b2ab7 100644 --- a/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php | |||
@@ -3,6 +3,7 @@ | |||
3 | namespace Tests\Wallabag\ApiBundle\Controller; | 3 | namespace Tests\Wallabag\ApiBundle\Controller; |
4 | 4 | ||
5 | use Tests\Wallabag\ApiBundle\WallabagApiTestCase; | 5 | use Tests\Wallabag\ApiBundle\WallabagApiTestCase; |
6 | use Wallabag\CoreBundle\Entity\Tag; | ||
6 | 7 | ||
7 | class WallabagRestControllerTest extends WallabagApiTestCase | 8 | class WallabagRestControllerTest extends WallabagApiTestCase |
8 | { | 9 | { |
@@ -121,6 +122,73 @@ class WallabagRestControllerTest extends WallabagApiTestCase | |||
121 | ); | 122 | ); |
122 | } | 123 | } |
123 | 124 | ||
125 | public function testGetTaggedEntries() | ||
126 | { | ||
127 | $this->client->request('GET', '/api/entries', ['tags' => 'foo,bar']); | ||
128 | |||
129 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | ||
130 | |||
131 | $content = json_decode($this->client->getResponse()->getContent(), true); | ||
132 | |||
133 | $this->assertGreaterThanOrEqual(1, count($content)); | ||
134 | $this->assertNotEmpty($content['_embedded']['items']); | ||
135 | $this->assertGreaterThanOrEqual(1, $content['total']); | ||
136 | $this->assertEquals(1, $content['page']); | ||
137 | $this->assertGreaterThanOrEqual(1, $content['pages']); | ||
138 | |||
139 | $this->assertTrue( | ||
140 | $this->client->getResponse()->headers->contains( | ||
141 | 'Content-Type', | ||
142 | 'application/json' | ||
143 | ) | ||
144 | ); | ||
145 | } | ||
146 | |||
147 | public function testGetDatedEntries() | ||
148 | { | ||
149 | $this->client->request('GET', '/api/entries', ['since' => 1]); | ||
150 | |||
151 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | ||
152 | |||
153 | $content = json_decode($this->client->getResponse()->getContent(), true); | ||
154 | |||
155 | $this->assertGreaterThanOrEqual(1, count($content)); | ||
156 | $this->assertNotEmpty($content['_embedded']['items']); | ||
157 | $this->assertGreaterThanOrEqual(1, $content['total']); | ||
158 | $this->assertEquals(1, $content['page']); | ||
159 | $this->assertGreaterThanOrEqual(1, $content['pages']); | ||
160 | |||
161 | $this->assertTrue( | ||
162 | $this->client->getResponse()->headers->contains( | ||
163 | 'Content-Type', | ||
164 | 'application/json' | ||
165 | ) | ||
166 | ); | ||
167 | } | ||
168 | |||
169 | public function testGetDatedSupEntries() | ||
170 | { | ||
171 | $future = new \DateTime(date('Y-m-d H:i:s')); | ||
172 | $this->client->request('GET', '/api/entries', ['since' => $future->getTimestamp() + 1000]); | ||
173 | |||
174 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | ||
175 | |||
176 | $content = json_decode($this->client->getResponse()->getContent(), true); | ||
177 | |||
178 | $this->assertGreaterThanOrEqual(1, count($content)); | ||
179 | $this->assertEmpty($content['_embedded']['items']); | ||
180 | $this->assertEquals(0, $content['total']); | ||
181 | $this->assertEquals(1, $content['page']); | ||
182 | $this->assertEquals(1, $content['pages']); | ||
183 | |||
184 | $this->assertTrue( | ||
185 | $this->client->getResponse()->headers->contains( | ||
186 | 'Content-Type', | ||
187 | 'application/json' | ||
188 | ) | ||
189 | ); | ||
190 | } | ||
191 | |||
124 | public function testDeleteEntry() | 192 | public function testDeleteEntry() |
125 | { | 193 | { |
126 | $entry = $this->client->getContainer() | 194 | $entry = $this->client->getContainer() |
@@ -292,7 +360,7 @@ class WallabagRestControllerTest extends WallabagApiTestCase | |||
292 | $entry = $this->client->getContainer() | 360 | $entry = $this->client->getContainer() |
293 | ->get('doctrine.orm.entity_manager') | 361 | ->get('doctrine.orm.entity_manager') |
294 | ->getRepository('WallabagCoreBundle:Entry') | 362 | ->getRepository('WallabagCoreBundle:Entry') |
295 | ->findOneWithTags(1); | 363 | ->findOneWithTags($this->user->getId()); |
296 | 364 | ||
297 | $entry = $entry[0]; | 365 | $entry = $entry[0]; |
298 | 366 | ||
@@ -354,7 +422,7 @@ class WallabagRestControllerTest extends WallabagApiTestCase | |||
354 | $entry = $this->client->getContainer() | 422 | $entry = $this->client->getContainer() |
355 | ->get('doctrine.orm.entity_manager') | 423 | ->get('doctrine.orm.entity_manager') |
356 | ->getRepository('WallabagCoreBundle:Entry') | 424 | ->getRepository('WallabagCoreBundle:Entry') |
357 | ->findOneWithTags(1); | 425 | ->findOneWithTags($this->user->getId()); |
358 | $entry = $entry[0]; | 426 | $entry = $entry[0]; |
359 | 427 | ||
360 | if (!$entry) { | 428 | if (!$entry) { |
@@ -405,7 +473,7 @@ class WallabagRestControllerTest extends WallabagApiTestCase | |||
405 | $this->assertEquals($tag['label'], $content['label']); | 473 | $this->assertEquals($tag['label'], $content['label']); |
406 | $this->assertEquals($tag['slug'], $content['slug']); | 474 | $this->assertEquals($tag['slug'], $content['slug']); |
407 | 475 | ||
408 | $entries = $entry = $this->client->getContainer() | 476 | $entries = $this->client->getContainer() |
409 | ->get('doctrine.orm.entity_manager') | 477 | ->get('doctrine.orm.entity_manager') |
410 | ->getRepository('WallabagCoreBundle:Entry') | 478 | ->getRepository('WallabagCoreBundle:Entry') |
411 | ->findAllByTagId($this->user->getId(), $tag['id']); | 479 | ->findAllByTagId($this->user->getId(), $tag['id']); |
@@ -413,6 +481,112 @@ class WallabagRestControllerTest extends WallabagApiTestCase | |||
413 | $this->assertCount(0, $entries); | 481 | $this->assertCount(0, $entries); |
414 | } | 482 | } |
415 | 483 | ||
484 | public function testDeleteTagByLabel() | ||
485 | { | ||
486 | $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); | ||
487 | $entry = $this->client->getContainer() | ||
488 | ->get('doctrine.orm.entity_manager') | ||
489 | ->getRepository('WallabagCoreBundle:Entry') | ||
490 | ->findOneWithTags($this->user->getId()); | ||
491 | |||
492 | $entry = $entry[0]; | ||
493 | |||
494 | $tag = new Tag(); | ||
495 | $tag->setLabel('Awesome tag for test'); | ||
496 | $em->persist($tag); | ||
497 | |||
498 | $entry->addTag($tag); | ||
499 | |||
500 | $em->persist($entry); | ||
501 | $em->flush(); | ||
502 | |||
503 | $this->client->request('DELETE', '/api/tag/label.json', ['tag' => $tag->getLabel()]); | ||
504 | |||
505 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | ||
506 | |||
507 | $content = json_decode($this->client->getResponse()->getContent(), true); | ||
508 | |||
509 | $this->assertArrayHasKey('label', $content); | ||
510 | $this->assertEquals($tag->getLabel(), $content['label']); | ||
511 | $this->assertEquals($tag->getSlug(), $content['slug']); | ||
512 | |||
513 | $entries = $this->client->getContainer() | ||
514 | ->get('doctrine.orm.entity_manager') | ||
515 | ->getRepository('WallabagCoreBundle:Entry') | ||
516 | ->findAllByTagId($this->user->getId(), $tag->getId()); | ||
517 | |||
518 | $this->assertCount(0, $entries); | ||
519 | } | ||
520 | |||
521 | public function testDeleteTagByLabelNotFound() | ||
522 | { | ||
523 | $this->client->request('DELETE', '/api/tag/label.json', ['tag' => 'does not exist']); | ||
524 | |||
525 | $this->assertEquals(404, $this->client->getResponse()->getStatusCode()); | ||
526 | } | ||
527 | |||
528 | public function testDeleteTagsByLabel() | ||
529 | { | ||
530 | $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); | ||
531 | $entry = $this->client->getContainer() | ||
532 | ->get('doctrine.orm.entity_manager') | ||
533 | ->getRepository('WallabagCoreBundle:Entry') | ||
534 | ->findOneWithTags($this->user->getId()); | ||
535 | |||
536 | $entry = $entry[0]; | ||
537 | |||
538 | $tag = new Tag(); | ||
539 | $tag->setLabel('Awesome tag for tagsLabel'); | ||
540 | $em->persist($tag); | ||
541 | |||
542 | $tag2 = new Tag(); | ||
543 | $tag2->setLabel('Awesome tag for tagsLabel 2'); | ||
544 | $em->persist($tag2); | ||
545 | |||
546 | $entry->addTag($tag); | ||
547 | $entry->addTag($tag2); | ||
548 | |||
549 | $em->persist($entry); | ||
550 | $em->flush(); | ||
551 | |||
552 | $this->client->request('DELETE', '/api/tags/label.json', ['tags' => $tag->getLabel().','.$tag2->getLabel()]); | ||
553 | |||
554 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | ||
555 | |||
556 | $content = json_decode($this->client->getResponse()->getContent(), true); | ||
557 | |||
558 | $this->assertCount(2, $content); | ||
559 | |||
560 | $this->assertArrayHasKey('label', $content[0]); | ||
561 | $this->assertEquals($tag->getLabel(), $content[0]['label']); | ||
562 | $this->assertEquals($tag->getSlug(), $content[0]['slug']); | ||
563 | |||
564 | $this->assertArrayHasKey('label', $content[1]); | ||
565 | $this->assertEquals($tag2->getLabel(), $content[1]['label']); | ||
566 | $this->assertEquals($tag2->getSlug(), $content[1]['slug']); | ||
567 | |||
568 | $entries = $this->client->getContainer() | ||
569 | ->get('doctrine.orm.entity_manager') | ||
570 | ->getRepository('WallabagCoreBundle:Entry') | ||
571 | ->findAllByTagId($this->user->getId(), $tag->getId()); | ||
572 | |||
573 | $this->assertCount(0, $entries); | ||
574 | |||
575 | $entries = $this->client->getContainer() | ||
576 | ->get('doctrine.orm.entity_manager') | ||
577 | ->getRepository('WallabagCoreBundle:Entry') | ||
578 | ->findAllByTagId($this->user->getId(), $tag2->getId()); | ||
579 | |||
580 | $this->assertCount(0, $entries); | ||
581 | } | ||
582 | |||
583 | public function testDeleteTagsByLabelNotFound() | ||
584 | { | ||
585 | $this->client->request('DELETE', '/api/tags/label.json', ['tags' => 'does not exist']); | ||
586 | |||
587 | $this->assertEquals(404, $this->client->getResponse()->getStatusCode()); | ||
588 | } | ||
589 | |||
416 | public function testGetVersion() | 590 | public function testGetVersion() |
417 | { | 591 | { |
418 | $this->client->request('GET', '/api/version'); | 592 | $this->client->request('GET', '/api/version'); |
diff --git a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php index 089a1c5f..07ff2772 100644 --- a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php | |||
@@ -33,7 +33,7 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
33 | } | 33 | } |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * Ensure next tests will have a clean database | 36 | * Ensure next tests will have a clean database. |
37 | */ | 37 | */ |
38 | public static function tearDownAfterClass() | 38 | public static function tearDownAfterClass() |
39 | { | 39 | { |
@@ -87,7 +87,6 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
87 | $this->assertContains('Setting up database.', $tester->getDisplay()); | 87 | $this->assertContains('Setting up database.', $tester->getDisplay()); |
88 | $this->assertContains('Administration setup.', $tester->getDisplay()); | 88 | $this->assertContains('Administration setup.', $tester->getDisplay()); |
89 | $this->assertContains('Config setup.', $tester->getDisplay()); | 89 | $this->assertContains('Config setup.', $tester->getDisplay()); |
90 | $this->assertContains('Installing assets.', $tester->getDisplay()); | ||
91 | } | 90 | } |
92 | 91 | ||
93 | public function testRunInstallCommandWithReset() | 92 | public function testRunInstallCommandWithReset() |
@@ -119,7 +118,6 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
119 | $this->assertContains('Droping database, creating database and schema, clearing the cache', $tester->getDisplay()); | 118 | $this->assertContains('Droping database, creating database and schema, clearing the cache', $tester->getDisplay()); |
120 | $this->assertContains('Administration setup.', $tester->getDisplay()); | 119 | $this->assertContains('Administration setup.', $tester->getDisplay()); |
121 | $this->assertContains('Config setup.', $tester->getDisplay()); | 120 | $this->assertContains('Config setup.', $tester->getDisplay()); |
122 | $this->assertContains('Installing assets.', $tester->getDisplay()); | ||
123 | 121 | ||
124 | // we force to reset everything | 122 | // we force to reset everything |
125 | $this->assertContains('Droping database, creating database and schema, clearing the cache', $tester->getDisplay()); | 123 | $this->assertContains('Droping database, creating database and schema, clearing the cache', $tester->getDisplay()); |
@@ -164,7 +162,6 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
164 | $this->assertContains('Setting up database.', $tester->getDisplay()); | 162 | $this->assertContains('Setting up database.', $tester->getDisplay()); |
165 | $this->assertContains('Administration setup.', $tester->getDisplay()); | 163 | $this->assertContains('Administration setup.', $tester->getDisplay()); |
166 | $this->assertContains('Config setup.', $tester->getDisplay()); | 164 | $this->assertContains('Config setup.', $tester->getDisplay()); |
167 | $this->assertContains('Installing assets.', $tester->getDisplay()); | ||
168 | 165 | ||
169 | // the current database doesn't already exist | 166 | // the current database doesn't already exist |
170 | $this->assertContains('Creating database and schema, clearing the cache', $tester->getDisplay()); | 167 | $this->assertContains('Creating database and schema, clearing the cache', $tester->getDisplay()); |
@@ -202,7 +199,6 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
202 | $this->assertContains('Setting up database.', $tester->getDisplay()); | 199 | $this->assertContains('Setting up database.', $tester->getDisplay()); |
203 | $this->assertContains('Administration setup.', $tester->getDisplay()); | 200 | $this->assertContains('Administration setup.', $tester->getDisplay()); |
204 | $this->assertContains('Config setup.', $tester->getDisplay()); | 201 | $this->assertContains('Config setup.', $tester->getDisplay()); |
205 | $this->assertContains('Installing assets.', $tester->getDisplay()); | ||
206 | 202 | ||
207 | $this->assertContains('Droping schema and creating schema', $tester->getDisplay()); | 203 | $this->assertContains('Droping schema and creating schema', $tester->getDisplay()); |
208 | } | 204 | } |
@@ -257,7 +253,6 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
257 | $this->assertContains('Setting up database.', $tester->getDisplay()); | 253 | $this->assertContains('Setting up database.', $tester->getDisplay()); |
258 | $this->assertContains('Administration setup.', $tester->getDisplay()); | 254 | $this->assertContains('Administration setup.', $tester->getDisplay()); |
259 | $this->assertContains('Config setup.', $tester->getDisplay()); | 255 | $this->assertContains('Config setup.', $tester->getDisplay()); |
260 | $this->assertContains('Installing assets.', $tester->getDisplay()); | ||
261 | 256 | ||
262 | $this->assertContains('Creating schema', $tester->getDisplay()); | 257 | $this->assertContains('Creating schema', $tester->getDisplay()); |
263 | } | 258 | } |
@@ -290,6 +285,5 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
290 | $this->assertContains('Setting up database.', $tester->getDisplay()); | 285 | $this->assertContains('Setting up database.', $tester->getDisplay()); |
291 | $this->assertContains('Administration setup.', $tester->getDisplay()); | 286 | $this->assertContains('Administration setup.', $tester->getDisplay()); |
292 | $this->assertContains('Config setup.', $tester->getDisplay()); | 287 | $this->assertContains('Config setup.', $tester->getDisplay()); |
293 | $this->assertContains('Installing assets.', $tester->getDisplay()); | ||
294 | } | 288 | } |
295 | } | 289 | } |
diff --git a/tests/Wallabag/CoreBundle/Controller/DeveloperControllerTest.php b/tests/Wallabag/CoreBundle/Controller/DeveloperControllerTest.php index 79452ace..97ed0d58 100644 --- a/tests/Wallabag/CoreBundle/Controller/DeveloperControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/DeveloperControllerTest.php | |||
@@ -18,12 +18,19 @@ class DeveloperControllerTest extends WallabagCoreTestCase | |||
18 | 18 | ||
19 | $form = $crawler->filter('button[type=submit]')->form(); | 19 | $form = $crawler->filter('button[type=submit]')->form(); |
20 | 20 | ||
21 | $client->submit($form); | 21 | $data = [ |
22 | 'client[name]' => 'My app', | ||
23 | ]; | ||
24 | |||
25 | $crawler = $client->submit($form, $data); | ||
22 | 26 | ||
23 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 27 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
24 | 28 | ||
25 | $newNbClients = $em->getRepository('WallabagApiBundle:Client')->findAll(); | 29 | $newNbClients = $em->getRepository('WallabagApiBundle:Client')->findAll(); |
26 | $this->assertGreaterThan(count($nbClients), count($newNbClients)); | 30 | $this->assertGreaterThan(count($nbClients), count($newNbClients)); |
31 | |||
32 | $this->assertGreaterThan(1, $alert = $crawler->filter('.settings ul li strong')->extract(['_text'])); | ||
33 | $this->assertContains('My app', $alert[0]); | ||
27 | } | 34 | } |
28 | 35 | ||
29 | public function testListingClient() | 36 | public function testListingClient() |
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index 5c739c78..a74c17d9 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php | |||
@@ -236,6 +236,16 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
236 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 236 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
237 | } | 237 | } |
238 | 238 | ||
239 | public function testUntagged() | ||
240 | { | ||
241 | $this->logInAs('admin'); | ||
242 | $client = $this->getClient(); | ||
243 | |||
244 | $client->request('GET', '/untagged/list'); | ||
245 | |||
246 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | ||
247 | } | ||
248 | |||
239 | public function testStarred() | 249 | public function testStarred() |
240 | { | 250 | { |
241 | $this->logInAs('admin'); | 251 | $this->logInAs('admin'); |
@@ -698,4 +708,47 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
698 | $crawler = $client->submit($form, $data); | 708 | $crawler = $client->submit($form, $data); |
699 | $this->assertCount(2, $crawler->filter('div[class=entry]')); | 709 | $this->assertCount(2, $crawler->filter('div[class=entry]')); |
700 | } | 710 | } |
711 | |||
712 | public function testCache() | ||
713 | { | ||
714 | $this->logInAs('admin'); | ||
715 | $client = $this->getClient(); | ||
716 | |||
717 | $content = $client->getContainer() | ||
718 | ->get('doctrine.orm.entity_manager') | ||
719 | ->getRepository('WallabagCoreBundle:Entry') | ||
720 | ->findOneByUser($this->getLoggedInUserId()); | ||
721 | |||
722 | // no uuid | ||
723 | $client->request('GET', '/share/'.$content->getUuid()); | ||
724 | $this->assertEquals(404, $client->getResponse()->getStatusCode()); | ||
725 | |||
726 | // generating the uuid | ||
727 | $client->request('GET', '/share/'.$content->getId()); | ||
728 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | ||
729 | |||
730 | // follow link with uuid | ||
731 | $crawler = $client->followRedirect(); | ||
732 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | ||
733 | $this->assertContains('max-age=25200', $client->getResponse()->headers->get('cache-control')); | ||
734 | $this->assertContains('public', $client->getResponse()->headers->get('cache-control')); | ||
735 | $this->assertContains('s-maxage=25200', $client->getResponse()->headers->get('cache-control')); | ||
736 | $this->assertNotContains('no-cache', $client->getResponse()->headers->get('cache-control')); | ||
737 | |||
738 | // sharing is now disabled | ||
739 | $client->getContainer()->get('craue_config')->set('share_public', 0); | ||
740 | $client->request('GET', '/share/'.$content->getUuid()); | ||
741 | $this->assertEquals(404, $client->getResponse()->getStatusCode()); | ||
742 | |||
743 | $client->request('GET', '/view/'.$content->getId()); | ||
744 | $this->assertContains('no-cache', $client->getResponse()->headers->get('cache-control')); | ||
745 | |||
746 | // removing the share | ||
747 | $client->request('GET', '/share/delete/'.$content->getId()); | ||
748 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | ||
749 | |||
750 | // share is now disable | ||
751 | $client->request('GET', '/share/'.$content->getUuid()); | ||
752 | $this->assertEquals(404, $client->getResponse()->getStatusCode()); | ||
753 | } | ||
701 | } | 754 | } |
diff --git a/tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php b/tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php index 03355f5a..08f4676e 100644 --- a/tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php | |||
@@ -69,4 +69,19 @@ class SecurityControllerTest extends WallabagCoreTestCase | |||
69 | $this->assertTrue($user->isTrustedComputer('ABCDEF')); | 69 | $this->assertTrue($user->isTrustedComputer('ABCDEF')); |
70 | $this->assertFalse($user->isTrustedComputer('FEDCBA')); | 70 | $this->assertFalse($user->isTrustedComputer('FEDCBA')); |
71 | } | 71 | } |
72 | |||
73 | public function testEnabledRegistration() | ||
74 | { | ||
75 | $client = $this->getClient(); | ||
76 | |||
77 | if (!$client->getContainer()->getParameter('fosuser_registration')) { | ||
78 | $this->markTestSkipped('fosuser_registration is not enabled.'); | ||
79 | |||
80 | return; | ||
81 | } | ||
82 | |||
83 | $client->followRedirects(); | ||
84 | $crawler = $client->request('GET', '/register'); | ||
85 | $this->assertContains('registration.submit', $crawler->filter('body')->extract(['_text'])[0]); | ||
86 | } | ||
72 | } | 87 | } |
diff --git a/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php b/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php index 58450e5f..71652760 100644 --- a/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php | |||
@@ -131,4 +131,35 @@ class TagControllerTest extends WallabagCoreTestCase | |||
131 | 131 | ||
132 | $this->assertEquals(404, $client->getResponse()->getStatusCode()); | 132 | $this->assertEquals(404, $client->getResponse()->getStatusCode()); |
133 | } | 133 | } |
134 | |||
135 | public function testShowEntriesForTagAction() | ||
136 | { | ||
137 | $this->logInAs('admin'); | ||
138 | $client = $this->getClient(); | ||
139 | |||
140 | $entry = $client->getContainer() | ||
141 | ->get('doctrine.orm.entity_manager') | ||
142 | ->getRepository('WallabagCoreBundle:Entry') | ||
143 | ->findOneByUsernameAndNotArchived('admin'); | ||
144 | |||
145 | $tag = $client->getContainer() | ||
146 | ->get('doctrine.orm.entity_manager') | ||
147 | ->getRepository('WallabagCoreBundle:Tag') | ||
148 | ->findOneByEntryAndTagLabel($entry, 'foo'); | ||
149 | |||
150 | $crawler = $client->request('GET', '/tag/list/'.$tag->getSlug()); | ||
151 | |||
152 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | ||
153 | $this->assertCount(2, $crawler->filter('div[class=entry]')); | ||
154 | |||
155 | $tag = $client->getContainer() | ||
156 | ->get('doctrine.orm.entity_manager') | ||
157 | ->getRepository('WallabagCoreBundle:Tag') | ||
158 | ->findOneByLabel('baz'); | ||
159 | |||
160 | $crawler = $client->request('GET', '/tag/list/'.$tag->getSlug()); | ||
161 | |||
162 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | ||
163 | $this->assertCount(0, $crawler->filter('div[class=entry]')); | ||
164 | } | ||
134 | } | 165 | } |
diff --git a/tests/Wallabag/CoreBundle/EventListener/LocaleListenerTest.php b/tests/Wallabag/CoreBundle/EventListener/LocaleListenerTest.php index 2a7f9390..078bb69a 100644 --- a/tests/Wallabag/CoreBundle/EventListener/LocaleListenerTest.php +++ b/tests/Wallabag/CoreBundle/EventListener/LocaleListenerTest.php | |||
@@ -15,7 +15,11 @@ class LocaleListenerTest extends \PHPUnit_Framework_TestCase | |||
15 | { | 15 | { |
16 | private function getEvent(Request $request) | 16 | private function getEvent(Request $request) |
17 | { | 17 | { |
18 | return new GetResponseEvent($this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface'), $request, HttpKernelInterface::MASTER_REQUEST); | 18 | $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface') |
19 | ->disableOriginalConstructor() | ||
20 | ->getMock(); | ||
21 | |||
22 | return new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST); | ||
19 | } | 23 | } |
20 | 24 | ||
21 | public function testWithoutSession() | 25 | public function testWithoutSession() |