diff options
Diffstat (limited to 'tests')
13 files changed, 119 insertions, 39 deletions
diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php index 19fb5170..f0173cef 100644 --- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php | |||
@@ -337,7 +337,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
337 | $this->assertEquals(false, $content['is_starred']); | 337 | $this->assertEquals(false, $content['is_starred']); |
338 | $this->assertEquals('New title for my article', $content['title']); | 338 | $this->assertEquals('New title for my article', $content['title']); |
339 | $this->assertEquals(1, $content['user_id']); | 339 | $this->assertEquals(1, $content['user_id']); |
340 | $this->assertCount(1, $content['tags']); | 340 | $this->assertCount(2, $content['tags']); |
341 | } | 341 | } |
342 | 342 | ||
343 | public function testPostSameEntry() | 343 | public function testPostSameEntry() |
@@ -356,7 +356,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
356 | $this->assertEquals('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', $content['url']); | 356 | $this->assertEquals('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', $content['url']); |
357 | $this->assertEquals(true, $content['is_archived']); | 357 | $this->assertEquals(true, $content['is_archived']); |
358 | $this->assertEquals(false, $content['is_starred']); | 358 | $this->assertEquals(false, $content['is_starred']); |
359 | $this->assertCount(2, $content['tags']); | 359 | $this->assertCount(3, $content['tags']); |
360 | } | 360 | } |
361 | 361 | ||
362 | public function testPostArchivedAndStarredEntry() | 362 | public function testPostArchivedAndStarredEntry() |
@@ -766,20 +766,69 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
766 | ], | 766 | ], |
767 | ]; | 767 | ]; |
768 | 768 | ||
769 | $this->client->request('DELETE', '/api/entries/tags/list?list='.json_encode($list)); | 769 | $this->client->request('DELETE', '/api/entries/tags/list?list=' . json_encode($list)); |
770 | } | ||
771 | |||
772 | |||
773 | public function testPostEntriesListAction() | ||
774 | { | ||
775 | $list = [ | ||
776 | 'http://www.lemonde.fr/musiques/article/2017/04/23/loin-de-la-politique-le-printemps-de-bourges-retombe-en-enfance_5115862_1654986.html', | ||
777 | 'http://0.0.0.0/entry2', | ||
778 | ]; | ||
779 | |||
780 | $this->client->request('POST', '/api/entries/lists?urls='.json_encode($list)); | ||
770 | 781 | ||
771 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | 782 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); |
772 | 783 | ||
773 | $content = json_decode($this->client->getResponse()->getContent(), true); | 784 | $content = json_decode($this->client->getResponse()->getContent(), true); |
774 | 785 | ||
775 | $this->assertInternalType('int', $content[0]['entry']); | 786 | $this->assertInternalType('int', $content[0]['entry']); |
776 | $this->assertEquals('http://0.0.0.0/entry4', $content[0]['url']); | 787 | $this->assertEquals('http://www.lemonde.fr/musiques/article/2017/04/23/loin-de-la-politique-le-printemps-de-bourges-retombe-en-enfance_5115862_1654986.html', $content[0]['url']); |
777 | 788 | ||
778 | $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager') | 789 | $this->assertInternalType('int', $content[1]['entry']); |
779 | ->getRepository('WallabagCoreBundle:Entry') | 790 | $this->assertEquals('http://0.0.0.0/entry2', $content[1]['url']); |
780 | ->findByUrlAndUserId('http://0.0.0.0/entry4', 1); | 791 | } |
781 | 792 | ||
782 | $tags = $entry->getTags(); | 793 | public function testDeleteEntriesListAction() |
783 | $this->assertCount(2, $tags); | 794 | { |
795 | $list = [ | ||
796 | 'http://www.lemonde.fr/musiques/article/2017/04/23/loin-de-la-politique-le-printemps-de-bourges-retombe-en-enfance_5115862_1654986.html', | ||
797 | 'http://0.0.0.0/entry3', | ||
798 | ]; | ||
799 | |||
800 | $this->client->request('DELETE', '/api/entries/list?urls='.json_encode($list)); | ||
801 | |||
802 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | ||
803 | |||
804 | $content = json_decode($this->client->getResponse()->getContent(), true); | ||
805 | |||
806 | $this->assertTrue($content[0]['entry']); | ||
807 | $this->assertEquals('http://www.lemonde.fr/musiques/article/2017/04/23/loin-de-la-politique-le-printemps-de-bourges-retombe-en-enfance_5115862_1654986.html', $content[0]['url']); | ||
808 | |||
809 | $this->assertFalse($content[1]['entry']); | ||
810 | $this->assertEquals('http://0.0.0.0/entry3', $content[1]['url']); | ||
811 | } | ||
812 | |||
813 | public function testLimitBulkAction() | ||
814 | { | ||
815 | $list = [ | ||
816 | 'http://0.0.0.0/entry1', | ||
817 | 'http://0.0.0.0/entry1', | ||
818 | 'http://0.0.0.0/entry1', | ||
819 | 'http://0.0.0.0/entry1', | ||
820 | 'http://0.0.0.0/entry1', | ||
821 | 'http://0.0.0.0/entry1', | ||
822 | 'http://0.0.0.0/entry1', | ||
823 | 'http://0.0.0.0/entry1', | ||
824 | 'http://0.0.0.0/entry1', | ||
825 | 'http://0.0.0.0/entry1', | ||
826 | 'http://0.0.0.0/entry1', | ||
827 | ]; | ||
828 | |||
829 | $this->client->request('POST', '/api/entries/lists?urls='.json_encode($list)); | ||
830 | |||
831 | $this->assertEquals(400, $this->client->getResponse()->getStatusCode()); | ||
832 | $this->assertContains('API limit reached', $this->client->getResponse()->getContent()); | ||
784 | } | 833 | } |
785 | } | 834 | } |
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index d26a56f8..35438c83 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php | |||
@@ -270,7 +270,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
270 | ->findOneByUrl($url); | 270 | ->findOneByUrl($url); |
271 | $tags = $entry->getTags(); | 271 | $tags = $entry->getTags(); |
272 | 272 | ||
273 | $this->assertCount(1, $tags); | 273 | $this->assertCount(2, $tags); |
274 | $this->assertEquals('wallabag', $tags[0]->getLabel()); | 274 | $this->assertEquals('wallabag', $tags[0]->getLabel()); |
275 | 275 | ||
276 | $em->remove($entry); | 276 | $em->remove($entry); |
@@ -299,8 +299,8 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
299 | 299 | ||
300 | $tags = $entry->getTags(); | 300 | $tags = $entry->getTags(); |
301 | 301 | ||
302 | $this->assertCount(1, $tags); | 302 | $this->assertCount(2, $tags); |
303 | $this->assertEquals('wallabag', $tags[0]->getLabel()); | 303 | $this->assertEquals('wallabag', $tags[1]->getLabel()); |
304 | 304 | ||
305 | $em->remove($entry); | 305 | $em->remove($entry); |
306 | $em->flush(); | 306 | $em->flush(); |
diff --git a/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php index 32a18e26..63f2c829 100644 --- a/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php | |||
@@ -189,11 +189,9 @@ class ExportControllerTest extends WallabagCoreTestCase | |||
189 | $this->assertContains($contentInDB[0]['language'], $csv[1]); | 189 | $this->assertContains($contentInDB[0]['language'], $csv[1]); |
190 | $this->assertContains($contentInDB[0]['createdAt']->format('d/m/Y h:i:s'), $csv[1]); | 190 | $this->assertContains($contentInDB[0]['createdAt']->format('d/m/Y h:i:s'), $csv[1]); |
191 | 191 | ||
192 | $expectedTag = []; | ||
193 | foreach ($contentInDB[0]['tags'] as $tag) { | 192 | foreach ($contentInDB[0]['tags'] as $tag) { |
194 | $expectedTag[] = $tag['label']; | 193 | $this->assertContains($tag['label'], $csv[1]); |
195 | } | 194 | } |
196 | $this->assertContains(implode(', ', $expectedTag), $csv[1]); | ||
197 | } | 195 | } |
198 | 196 | ||
199 | public function testJsonExport() | 197 | public function testJsonExport() |
@@ -241,7 +239,7 @@ class ExportControllerTest extends WallabagCoreTestCase | |||
241 | $this->assertEquals($contentInDB->getLanguage(), $content[0]['language']); | 239 | $this->assertEquals($contentInDB->getLanguage(), $content[0]['language']); |
242 | $this->assertEquals($contentInDB->getReadingtime(), $content[0]['reading_time']); | 240 | $this->assertEquals($contentInDB->getReadingtime(), $content[0]['reading_time']); |
243 | $this->assertEquals($contentInDB->getDomainname(), $content[0]['domain_name']); | 241 | $this->assertEquals($contentInDB->getDomainname(), $content[0]['domain_name']); |
244 | $this->assertEquals(['foo bar', 'baz'], $content[0]['tags']); | 242 | $this->assertEquals(['foo bar', 'baz', 'foot'], $content[0]['tags']); |
245 | } | 243 | } |
246 | 244 | ||
247 | public function testXmlExport() | 245 | public function testXmlExport() |
diff --git a/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php b/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php index fa1a3539..c3b22dcd 100644 --- a/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php | |||
@@ -46,7 +46,7 @@ class TagControllerTest extends WallabagCoreTestCase | |||
46 | ->getRepository('WallabagCoreBundle:Entry') | 46 | ->getRepository('WallabagCoreBundle:Entry') |
47 | ->findByUrlAndUserId('http://0.0.0.0/entry1', $this->getLoggedInUserId()); | 47 | ->findByUrlAndUserId('http://0.0.0.0/entry1', $this->getLoggedInUserId()); |
48 | 48 | ||
49 | $this->assertEquals(3, count($entry->getTags())); | 49 | $this->assertEquals(4, count($entry->getTags())); |
50 | 50 | ||
51 | // tag already exists and already assigned | 51 | // tag already exists and already assigned |
52 | $client->submit($form, $data); | 52 | $client->submit($form, $data); |
@@ -57,7 +57,7 @@ class TagControllerTest extends WallabagCoreTestCase | |||
57 | ->getRepository('WallabagCoreBundle:Entry') | 57 | ->getRepository('WallabagCoreBundle:Entry') |
58 | ->find($entry->getId()); | 58 | ->find($entry->getId()); |
59 | 59 | ||
60 | $this->assertEquals(3, count($newEntry->getTags())); | 60 | $this->assertEquals(4, count($newEntry->getTags())); |
61 | 61 | ||
62 | // tag already exists but still not assigned to this entry | 62 | // tag already exists but still not assigned to this entry |
63 | $data = [ | 63 | $data = [ |
@@ -72,7 +72,7 @@ class TagControllerTest extends WallabagCoreTestCase | |||
72 | ->getRepository('WallabagCoreBundle:Entry') | 72 | ->getRepository('WallabagCoreBundle:Entry') |
73 | ->find($entry->getId()); | 73 | ->find($entry->getId()); |
74 | 74 | ||
75 | $this->assertEquals(3, count($newEntry->getTags())); | 75 | $this->assertEquals(4, count($newEntry->getTags())); |
76 | } | 76 | } |
77 | 77 | ||
78 | public function testAddMultipleTagToEntry() | 78 | public function testAddMultipleTagToEntry() |
diff --git a/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php b/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php index 7be1eb18..7043c345 100644 --- a/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php +++ b/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php | |||
@@ -10,7 +10,7 @@ use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; | |||
10 | class ImportCommandTest extends WallabagCoreTestCase | 10 | class ImportCommandTest extends WallabagCoreTestCase |
11 | { | 11 | { |
12 | /** | 12 | /** |
13 | * @expectedException Symfony\Component\Console\Exception\RuntimeException | 13 | * @expectedException \Symfony\Component\Console\Exception\RuntimeException |
14 | * @expectedExceptionMessage Not enough arguments | 14 | * @expectedExceptionMessage Not enough arguments |
15 | */ | 15 | */ |
16 | public function testRunImportCommandWithoutArguments() | 16 | public function testRunImportCommandWithoutArguments() |
@@ -27,7 +27,7 @@ class ImportCommandTest extends WallabagCoreTestCase | |||
27 | } | 27 | } |
28 | 28 | ||
29 | /** | 29 | /** |
30 | * @expectedException Symfony\Component\Config\Definition\Exception\Exception | 30 | * @expectedException \Symfony\Component\Config\Definition\Exception\Exception |
31 | * @expectedExceptionMessage not found | 31 | * @expectedExceptionMessage not found |
32 | */ | 32 | */ |
33 | public function testRunImportCommandWithoutFilepath() | 33 | public function testRunImportCommandWithoutFilepath() |
@@ -40,16 +40,15 @@ class ImportCommandTest extends WallabagCoreTestCase | |||
40 | $tester = new CommandTester($command); | 40 | $tester = new CommandTester($command); |
41 | $tester->execute([ | 41 | $tester->execute([ |
42 | 'command' => $command->getName(), | 42 | 'command' => $command->getName(), |
43 | 'userId' => 1, | 43 | 'username' => 'admin', |
44 | 'filepath' => 1, | 44 | 'filepath' => 1, |
45 | ]); | 45 | ]); |
46 | } | 46 | } |
47 | 47 | ||
48 | /** | 48 | /** |
49 | * @expectedException Symfony\Component\Config\Definition\Exception\Exception | 49 | * @expectedException \Doctrine\ORM\NoResultException |
50 | * @expectedExceptionMessage User with id | ||
51 | */ | 50 | */ |
52 | public function testRunImportCommandWithoutUserId() | 51 | public function testRunImportCommandWithWrongUsername() |
53 | { | 52 | { |
54 | $application = new Application($this->getClient()->getKernel()); | 53 | $application = new Application($this->getClient()->getKernel()); |
55 | $application->add(new ImportCommand()); | 54 | $application->add(new ImportCommand()); |
@@ -59,7 +58,7 @@ class ImportCommandTest extends WallabagCoreTestCase | |||
59 | $tester = new CommandTester($command); | 58 | $tester = new CommandTester($command); |
60 | $tester->execute([ | 59 | $tester->execute([ |
61 | 'command' => $command->getName(), | 60 | 'command' => $command->getName(), |
62 | 'userId' => 0, | 61 | 'username' => 'random', |
63 | 'filepath' => './', | 62 | 'filepath' => './', |
64 | ]); | 63 | ]); |
65 | } | 64 | } |
@@ -74,7 +73,7 @@ class ImportCommandTest extends WallabagCoreTestCase | |||
74 | $tester = new CommandTester($command); | 73 | $tester = new CommandTester($command); |
75 | $tester->execute([ | 74 | $tester->execute([ |
76 | 'command' => $command->getName(), | 75 | 'command' => $command->getName(), |
77 | 'userId' => 1, | 76 | 'username' => 'admin', |
78 | 'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.root_dir').'/../tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json', | 77 | 'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.root_dir').'/../tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json', |
79 | '--importer' => 'v2', | 78 | '--importer' => 'v2', |
80 | ]); | 79 | ]); |
@@ -82,4 +81,20 @@ class ImportCommandTest extends WallabagCoreTestCase | |||
82 | $this->assertContains('imported', $tester->getDisplay()); | 81 | $this->assertContains('imported', $tester->getDisplay()); |
83 | $this->assertContains('already saved', $tester->getDisplay()); | 82 | $this->assertContains('already saved', $tester->getDisplay()); |
84 | } | 83 | } |
84 | |||
85 | public function testRunImportCommandWithUserId() | ||
86 | { | ||
87 | $application = new Application($this->getClient()->getKernel()); | ||
88 | $application->add(new ImportCommand()); | ||
89 | |||
90 | $command = $application->find('wallabag:import'); | ||
91 | |||
92 | $tester = new CommandTester($command); | ||
93 | $tester->execute([ | ||
94 | 'command' => $command->getName(), | ||
95 | 'username' => 1, | ||
96 | 'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.root_dir').'/../tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json', | ||
97 | '--useUserId' => true, | ||
98 | ]); | ||
99 | } | ||
85 | } | 100 | } |
diff --git a/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php index c1f82ea9..8e9f65e3 100644 --- a/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php | |||
@@ -120,7 +120,7 @@ class ChromeControllerTest extends WallabagCoreTestCase | |||
120 | 120 | ||
121 | $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.usinenouvelle.com is ok'); | 121 | $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.usinenouvelle.com is ok'); |
122 | $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.usinenouvelle.com is ok'); | 122 | $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.usinenouvelle.com is ok'); |
123 | $this->assertEquals(0, count($content->getTags())); | 123 | $this->assertEquals(1, count($content->getTags())); |
124 | 124 | ||
125 | $createdAt = $content->getCreatedAt(); | 125 | $createdAt = $content->getCreatedAt(); |
126 | $this->assertEquals('2011', $createdAt->format('Y')); | 126 | $this->assertEquals('2011', $createdAt->format('Y')); |
diff --git a/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php b/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php index 7557ea32..68453027 100644 --- a/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php | |||
@@ -121,7 +121,7 @@ class FirefoxControllerTest extends WallabagCoreTestCase | |||
121 | $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://lexpansion.lexpress.fr is ok'); | 121 | $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://lexpansion.lexpress.fr is ok'); |
122 | $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://lexpansion.lexpress.fr is ok'); | 122 | $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://lexpansion.lexpress.fr is ok'); |
123 | $this->assertNotEmpty($content->getLanguage(), 'Language for http://lexpansion.lexpress.fr is ok'); | 123 | $this->assertNotEmpty($content->getLanguage(), 'Language for http://lexpansion.lexpress.fr is ok'); |
124 | $this->assertEquals(2, count($content->getTags())); | 124 | $this->assertEquals(3, count($content->getTags())); |
125 | 125 | ||
126 | $content = $client->getContainer() | 126 | $content = $client->getContainer() |
127 | ->get('doctrine.orm.entity_manager') | 127 | ->get('doctrine.orm.entity_manager') |
diff --git a/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php b/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php index 3f6f2b9f..c2e5fdb7 100644 --- a/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php | |||
@@ -121,7 +121,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase | |||
121 | $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.liberation.fr is ok'); | 121 | $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.liberation.fr is ok'); |
122 | $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.liberation.fr is ok'); | 122 | $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.liberation.fr is ok'); |
123 | $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.liberation.fr is ok'); | 123 | $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.liberation.fr is ok'); |
124 | $this->assertEquals(0, count($content->getTags())); | 124 | $this->assertEquals(1, count($content->getTags())); |
125 | $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); | 125 | $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); |
126 | } | 126 | } |
127 | 127 | ||
diff --git a/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php b/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php index 75a7e332..96b32484 100644 --- a/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php | |||
@@ -121,7 +121,7 @@ class PinboardControllerTest extends WallabagCoreTestCase | |||
121 | $this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://ma.ttias.be is ok'); | 121 | $this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://ma.ttias.be is ok'); |
122 | $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://ma.ttias.be is ok'); | 122 | $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://ma.ttias.be is ok'); |
123 | $this->assertNotEmpty($content->getLanguage(), 'Language for https://ma.ttias.be is ok'); | 123 | $this->assertNotEmpty($content->getLanguage(), 'Language for https://ma.ttias.be is ok'); |
124 | $this->assertEquals(2, count($content->getTags())); | 124 | $this->assertEquals(3, count($content->getTags())); |
125 | $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); | 125 | $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); |
126 | $this->assertEquals('2016-10-26', $content->getCreatedAt()->format('Y-m-d')); | 126 | $this->assertEquals('2016-10-26', $content->getCreatedAt()->format('Y-m-d')); |
127 | } | 127 | } |
diff --git a/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php index acb61ca1..e6d33fe9 100644 --- a/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php | |||
@@ -121,7 +121,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase | |||
121 | $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.zataz.com is ok'); | 121 | $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.zataz.com is ok'); |
122 | $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.zataz.com is ok'); | 122 | $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.zataz.com is ok'); |
123 | $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.zataz.com is ok'); | 123 | $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.zataz.com is ok'); |
124 | $this->assertEquals(0, count($content->getTags())); | 124 | $this->assertEquals(1, count($content->getTags())); |
125 | $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); | 125 | $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); |
126 | $this->assertEquals('2016-09-08', $content->getCreatedAt()->format('Y-m-d')); | 126 | $this->assertEquals('2016-09-08', $content->getCreatedAt()->format('Y-m-d')); |
127 | } | 127 | } |
diff --git a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php index acc39997..0c7f97ed 100644 --- a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php | |||
@@ -129,7 +129,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase | |||
129 | $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.framablog.org is ok'); | 129 | $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.framablog.org is ok'); |
130 | $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.framablog.org is ok'); | 130 | $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.framablog.org is ok'); |
131 | $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.framablog.org is ok'); | 131 | $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.framablog.org is ok'); |
132 | $this->assertEquals(1, count($content->getTags())); | 132 | $this->assertEquals(2, count($content->getTags())); |
133 | $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); | 133 | $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); |
134 | } | 134 | } |
135 | 135 | ||
diff --git a/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php b/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php index 26e2f40b..556ab1bd 100644 --- a/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php | |||
@@ -122,7 +122,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase | |||
122 | $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.liberation.fr is ok'); | 122 | $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.liberation.fr is ok'); |
123 | $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.liberation.fr is ok'); | 123 | $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.liberation.fr is ok'); |
124 | $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.liberation.fr is ok'); | 124 | $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.liberation.fr is ok'); |
125 | $this->assertEquals(0, count($content->getTags())); | 125 | $this->assertEquals(1, count($content->getTags())); |
126 | 126 | ||
127 | $content = $client->getContainer() | 127 | $content = $client->getContainer() |
128 | ->get('doctrine.orm.entity_manager') | 128 | ->get('doctrine.orm.entity_manager') |
@@ -135,7 +135,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase | |||
135 | $this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://www.mediapart.fr is ok'); | 135 | $this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://www.mediapart.fr is ok'); |
136 | $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://www.mediapart.fr is ok'); | 136 | $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://www.mediapart.fr is ok'); |
137 | $this->assertNotEmpty($content->getLanguage(), 'Language for https://www.mediapart.fr is ok'); | 137 | $this->assertNotEmpty($content->getLanguage(), 'Language for https://www.mediapart.fr is ok'); |
138 | $this->assertEquals(2, count($content->getTags())); | 138 | $this->assertEquals(3, count($content->getTags())); |
139 | $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); | 139 | $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); |
140 | $this->assertEquals('2016-09-08', $content->getCreatedAt()->format('Y-m-d')); | 140 | $this->assertEquals('2016-09-08', $content->getCreatedAt()->format('Y-m-d')); |
141 | } | 141 | } |
diff --git a/tests/Wallabag/UserBundle/Controller/ManageControllerTest.php b/tests/Wallabag/UserBundle/Controller/ManageControllerTest.php index 4faddfc4..44b9a030 100644 --- a/tests/Wallabag/UserBundle/Controller/ManageControllerTest.php +++ b/tests/Wallabag/UserBundle/Controller/ManageControllerTest.php | |||
@@ -10,7 +10,7 @@ class ManageControllerTest extends WallabagCoreTestCase | |||
10 | { | 10 | { |
11 | $client = $this->getClient(); | 11 | $client = $this->getClient(); |
12 | 12 | ||
13 | $client->request('GET', '/users/'); | 13 | $client->request('GET', '/users/list'); |
14 | 14 | ||
15 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 15 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
16 | $this->assertContains('login', $client->getResponse()->headers->get('location')); | 16 | $this->assertContains('login', $client->getResponse()->headers->get('location')); |
@@ -22,7 +22,7 @@ class ManageControllerTest extends WallabagCoreTestCase | |||
22 | $client = $this->getClient(); | 22 | $client = $this->getClient(); |
23 | 23 | ||
24 | // Create a new user in the database | 24 | // Create a new user in the database |
25 | $crawler = $client->request('GET', '/users/'); | 25 | $crawler = $client->request('GET', '/users/list'); |
26 | $this->assertEquals(200, $client->getResponse()->getStatusCode(), 'Unexpected HTTP status code for GET /users/'); | 26 | $this->assertEquals(200, $client->getResponse()->getStatusCode(), 'Unexpected HTTP status code for GET /users/'); |
27 | $crawler = $client->click($crawler->selectLink('user.list.create_new_one')->link()); | 27 | $crawler = $client->click($crawler->selectLink('user.list.create_new_one')->link()); |
28 | 28 | ||
@@ -36,7 +36,7 @@ class ManageControllerTest extends WallabagCoreTestCase | |||
36 | 36 | ||
37 | $client->submit($form); | 37 | $client->submit($form); |
38 | $client->followRedirect(); | 38 | $client->followRedirect(); |
39 | $crawler = $client->request('GET', '/users/'); | 39 | $crawler = $client->request('GET', '/users/list'); |
40 | 40 | ||
41 | // Check data in the show view | 41 | // Check data in the show view |
42 | $this->assertGreaterThan(0, $crawler->filter('td:contains("test_user")')->count(), 'Missing element td:contains("test_user")'); | 42 | $this->assertGreaterThan(0, $crawler->filter('td:contains("test_user")')->count(), 'Missing element td:contains("test_user")'); |
@@ -57,7 +57,7 @@ class ManageControllerTest extends WallabagCoreTestCase | |||
57 | // Check the element contains an attribute with value equals "Foo User" | 57 | // Check the element contains an attribute with value equals "Foo User" |
58 | $this->assertGreaterThan(0, $crawler->filter('[value="Foo User"]')->count(), 'Missing element [value="Foo User"]'); | 58 | $this->assertGreaterThan(0, $crawler->filter('[value="Foo User"]')->count(), 'Missing element [value="Foo User"]'); |
59 | 59 | ||
60 | $crawler = $client->request('GET', '/users/'); | 60 | $crawler = $client->request('GET', '/users/list'); |
61 | $crawler = $client->click($crawler->selectLink('user.list.edit_action')->last()->link()); | 61 | $crawler = $client->click($crawler->selectLink('user.list.edit_action')->last()->link()); |
62 | 62 | ||
63 | // Delete the user | 63 | // Delete the user |
@@ -78,4 +78,22 @@ class ManageControllerTest extends WallabagCoreTestCase | |||
78 | 78 | ||
79 | $this->assertEquals('disabled', $disabled[0]); | 79 | $this->assertEquals('disabled', $disabled[0]); |
80 | } | 80 | } |
81 | |||
82 | public function testUserSearch() | ||
83 | { | ||
84 | $this->logInAs('admin'); | ||
85 | $client = $this->getClient(); | ||
86 | |||
87 | // Search on unread list | ||
88 | $crawler = $client->request('GET', '/users/list'); | ||
89 | |||
90 | $form = $crawler->filter('form[name=search_users]')->form(); | ||
91 | $data = [ | ||
92 | 'search_user[term]' => 'admin', | ||
93 | ]; | ||
94 | |||
95 | $crawler = $client->submit($form, $data); | ||
96 | |||
97 | $this->assertCount(2, $crawler->filter('tr')); // 1 result + table header | ||
98 | } | ||
81 | } | 99 | } |