aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php60
-rw-r--r--tests/Wallabag/CoreBundle/Command/CleanDuplicatesCommandTest.php108
-rw-r--r--tests/Wallabag/CoreBundle/Command/ExportCommandTest.php2
-rw-r--r--tests/Wallabag/CoreBundle/Command/InstallCommandTest.php12
-rw-r--r--tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php2
-rw-r--r--tests/Wallabag/ImportBundle/Command/ImportCommandTest.php31
-rw-r--r--tests/Wallabag/UserBundle/Controller/ManageControllerTest.php26
7 files changed, 218 insertions, 23 deletions
diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
index e6ffd664..362c269b 100644
--- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
+++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
@@ -767,19 +767,67 @@ class EntryRestControllerTest extends WallabagApiTestCase
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 public function testPostEntriesListAction()
773 {
774 $list = [
775 'http://www.lemonde.fr/musiques/article/2017/04/23/loin-de-la-politique-le-printemps-de-bourges-retombe-en-enfance_5115862_1654986.html',
776 'http://0.0.0.0/entry2',
777 ];
778
779 $this->client->request('POST', '/api/entries/lists?urls='.json_encode($list));
770 780
771 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 781 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
772 782
773 $content = json_decode($this->client->getResponse()->getContent(), true); 783 $content = json_decode($this->client->getResponse()->getContent(), true);
774 784
775 $this->assertInternalType('int', $content[0]['entry']); 785 $this->assertInternalType('int', $content[0]['entry']);
776 $this->assertEquals('http://0.0.0.0/entry4', $content[0]['url']); 786 $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 787
778 $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager') 788 $this->assertInternalType('int', $content[1]['entry']);
779 ->getRepository('WallabagCoreBundle:Entry') 789 $this->assertEquals('http://0.0.0.0/entry2', $content[1]['url']);
780 ->findByUrlAndUserId('http://0.0.0.0/entry4', 1); 790 }
781 791
782 $tags = $entry->getTags(); 792 public function testDeleteEntriesListAction()
783 $this->assertCount(2, $tags); 793 {
794 $list = [
795 'http://www.lemonde.fr/musiques/article/2017/04/23/loin-de-la-politique-le-printemps-de-bourges-retombe-en-enfance_5115862_1654986.html',
796 'http://0.0.0.0/entry3',
797 ];
798
799 $this->client->request('DELETE', '/api/entries/list?urls='.json_encode($list));
800
801 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
802
803 $content = json_decode($this->client->getResponse()->getContent(), true);
804
805 $this->assertTrue($content[0]['entry']);
806 $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']);
807
808 $this->assertFalse($content[1]['entry']);
809 $this->assertEquals('http://0.0.0.0/entry3', $content[1]['url']);
810 }
811
812 public function testLimitBulkAction()
813 {
814 $list = [
815 'http://0.0.0.0/entry1',
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 ];
827
828 $this->client->request('POST', '/api/entries/lists?urls='.json_encode($list));
829
830 $this->assertEquals(400, $this->client->getResponse()->getStatusCode());
831 $this->assertContains('API limit reached', $this->client->getResponse()->getContent());
784 } 832 }
785} 833}
diff --git a/tests/Wallabag/CoreBundle/Command/CleanDuplicatesCommandTest.php b/tests/Wallabag/CoreBundle/Command/CleanDuplicatesCommandTest.php
new file mode 100644
index 00000000..e6e57f30
--- /dev/null
+++ b/tests/Wallabag/CoreBundle/Command/CleanDuplicatesCommandTest.php
@@ -0,0 +1,108 @@
1<?php
2
3namespace Tests\Wallabag\CoreBundle\Command;
4
5use Symfony\Bundle\FrameworkBundle\Console\Application;
6use Symfony\Component\Console\Tester\CommandTester;
7use Wallabag\CoreBundle\Command\CleanDuplicatesCommand;
8use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
9use Wallabag\CoreBundle\Entity\Entry;
10
11class CleanDuplicatesCommandTest extends WallabagCoreTestCase
12{
13 public function testRunCleanDuplicates()
14 {
15 $application = new Application($this->getClient()->getKernel());
16 $application->add(new CleanDuplicatesCommand());
17
18 $command = $application->find('wallabag:clean-duplicates');
19
20 $tester = new CommandTester($command);
21 $tester->execute([
22 'command' => $command->getName(),
23 ]);
24
25 $this->assertContains('Cleaning through 3 user accounts', $tester->getDisplay());
26 $this->assertContains('Finished cleaning. 0 duplicates found in total', $tester->getDisplay());
27 }
28
29 public function testRunCleanDuplicatesCommandWithBadUsername()
30 {
31 $application = new Application($this->getClient()->getKernel());
32 $application->add(new CleanDuplicatesCommand());
33
34 $command = $application->find('wallabag:clean-duplicates');
35
36 $tester = new CommandTester($command);
37 $tester->execute([
38 'command' => $command->getName(),
39 'username' => 'unknown',
40 ]);
41
42 $this->assertContains('User "unknown" not found', $tester->getDisplay());
43 }
44
45 public function testRunCleanDuplicatesCommandForUser()
46 {
47 $application = new Application($this->getClient()->getKernel());
48 $application->add(new CleanDuplicatesCommand());
49
50 $command = $application->find('wallabag:clean-duplicates');
51
52 $tester = new CommandTester($command);
53 $tester->execute([
54 'command' => $command->getName(),
55 'username' => 'admin',
56 ]);
57
58 $this->assertContains('Cleaned 0 duplicates for user admin', $tester->getDisplay());
59 }
60
61 public function testDuplicate()
62 {
63 $url = 'http://www.lemonde.fr/sport/visuel/2017/05/05/rondelle-prison-blanchissage-comprendre-le-hockey-sur-glace_5122587_3242.html';
64 $client = $this->getClient();
65 $em = $client->getContainer()->get('doctrine.orm.entity_manager');
66
67 $this->logInAs('admin');
68
69 $nbEntries = $em->getRepository('WallabagCoreBundle:Entry')->findAllByUrlAndUserId($url, $this->getLoggedInUserId());
70 $this->assertCount(0, $nbEntries);
71
72 $user = $em->getRepository('WallabagUserBundle:User')->findOneById($this->getLoggedInUserId());
73
74 $entry1 = new Entry($user);
75 $entry1->setUrl($url);
76
77 $entry2 = new Entry($user);
78 $entry2->setUrl($url);
79
80 $em->persist($entry1);
81 $em->persist($entry2);
82
83 $em->flush();
84
85 $nbEntries = $em->getRepository('WallabagCoreBundle:Entry')->findAllByUrlAndUserId($url, $this->getLoggedInUserId());
86 $this->assertCount(2, $nbEntries);
87
88 $application = new Application($this->getClient()->getKernel());
89 $application->add(new CleanDuplicatesCommand());
90
91 $command = $application->find('wallabag:clean-duplicates');
92
93 $tester = new CommandTester($command);
94 $tester->execute([
95 'command' => $command->getName(),
96 'username' => 'admin',
97 ]);
98
99 $this->assertContains('Cleaned 1 duplicates for user admin', $tester->getDisplay());
100
101 $nbEntries = $em->getRepository('WallabagCoreBundle:Entry')->findAllByUrlAndUserId($url, $this->getLoggedInUserId());
102 $this->assertCount(1, $nbEntries);
103
104 $query = $em->createQuery('DELETE FROM Wallabag\CoreBundle\Entity\Entry e WHERE e.url = :url');
105 $query->setParameter('url', $url);
106 $query->execute();
107 }
108}
diff --git a/tests/Wallabag/CoreBundle/Command/ExportCommandTest.php b/tests/Wallabag/CoreBundle/Command/ExportCommandTest.php
index 6798c5d7..b21f3318 100644
--- a/tests/Wallabag/CoreBundle/Command/ExportCommandTest.php
+++ b/tests/Wallabag/CoreBundle/Command/ExportCommandTest.php
@@ -70,7 +70,7 @@ class ExportCommandTest extends WallabagCoreTestCase
70 $tester->execute([ 70 $tester->execute([
71 'command' => $command->getName(), 71 'command' => $command->getName(),
72 'username' => 'admin', 72 'username' => 'admin',
73 'filepath' => 'specialexport.json' 73 'filepath' => 'specialexport.json',
74 ]); 74 ]);
75 75
76 $this->assertFileExists('specialexport.json'); 76 $this->assertFileExists('specialexport.json');
diff --git a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php
index 1bfd41d5..122a87d4 100644
--- a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php
+++ b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php
@@ -87,6 +87,7 @@ 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('Run migrations.', $tester->getDisplay());
90 } 91 }
91 92
92 public function testRunInstallCommandWithReset() 93 public function testRunInstallCommandWithReset()
@@ -115,12 +116,13 @@ class InstallCommandTest extends WallabagCoreTestCase
115 116
116 $this->assertContains('Checking system requirements.', $tester->getDisplay()); 117 $this->assertContains('Checking system requirements.', $tester->getDisplay());
117 $this->assertContains('Setting up database.', $tester->getDisplay()); 118 $this->assertContains('Setting up database.', $tester->getDisplay());
118 $this->assertContains('Droping database, creating database and schema, clearing the cache', $tester->getDisplay()); 119 $this->assertContains('Dropping database, creating database and schema, clearing the cache', $tester->getDisplay());
119 $this->assertContains('Administration setup.', $tester->getDisplay()); 120 $this->assertContains('Administration setup.', $tester->getDisplay());
120 $this->assertContains('Config setup.', $tester->getDisplay()); 121 $this->assertContains('Config setup.', $tester->getDisplay());
122 $this->assertContains('Run migrations.', $tester->getDisplay());
121 123
122 // we force to reset everything 124 // we force to reset everything
123 $this->assertContains('Droping database, creating database and schema, clearing the cache', $tester->getDisplay()); 125 $this->assertContains('Dropping database, creating database and schema, clearing the cache', $tester->getDisplay());
124 } 126 }
125 127
126 public function testRunInstallCommandWithDatabaseRemoved() 128 public function testRunInstallCommandWithDatabaseRemoved()
@@ -168,6 +170,7 @@ class InstallCommandTest extends WallabagCoreTestCase
168 $this->assertContains('Setting up database.', $tester->getDisplay()); 170 $this->assertContains('Setting up database.', $tester->getDisplay());
169 $this->assertContains('Administration setup.', $tester->getDisplay()); 171 $this->assertContains('Administration setup.', $tester->getDisplay());
170 $this->assertContains('Config setup.', $tester->getDisplay()); 172 $this->assertContains('Config setup.', $tester->getDisplay());
173 $this->assertContains('Run migrations.', $tester->getDisplay());
171 174
172 // the current database doesn't already exist 175 // the current database doesn't already exist
173 $this->assertContains('Creating database and schema, clearing the cache', $tester->getDisplay()); 176 $this->assertContains('Creating database and schema, clearing the cache', $tester->getDisplay());
@@ -205,8 +208,9 @@ class InstallCommandTest extends WallabagCoreTestCase
205 $this->assertContains('Setting up database.', $tester->getDisplay()); 208 $this->assertContains('Setting up database.', $tester->getDisplay());
206 $this->assertContains('Administration setup.', $tester->getDisplay()); 209 $this->assertContains('Administration setup.', $tester->getDisplay());
207 $this->assertContains('Config setup.', $tester->getDisplay()); 210 $this->assertContains('Config setup.', $tester->getDisplay());
211 $this->assertContains('Run migrations.', $tester->getDisplay());
208 212
209 $this->assertContains('Droping schema and creating schema', $tester->getDisplay()); 213 $this->assertContains('Dropping schema and creating schema', $tester->getDisplay());
210 } 214 }
211 215
212 public function testRunInstallCommandChooseNothing() 216 public function testRunInstallCommandChooseNothing()
@@ -259,6 +263,7 @@ class InstallCommandTest extends WallabagCoreTestCase
259 $this->assertContains('Setting up database.', $tester->getDisplay()); 263 $this->assertContains('Setting up database.', $tester->getDisplay());
260 $this->assertContains('Administration setup.', $tester->getDisplay()); 264 $this->assertContains('Administration setup.', $tester->getDisplay());
261 $this->assertContains('Config setup.', $tester->getDisplay()); 265 $this->assertContains('Config setup.', $tester->getDisplay());
266 $this->assertContains('Run migrations.', $tester->getDisplay());
262 267
263 $this->assertContains('Creating schema', $tester->getDisplay()); 268 $this->assertContains('Creating schema', $tester->getDisplay());
264 } 269 }
@@ -291,5 +296,6 @@ class InstallCommandTest extends WallabagCoreTestCase
291 $this->assertContains('Setting up database.', $tester->getDisplay()); 296 $this->assertContains('Setting up database.', $tester->getDisplay());
292 $this->assertContains('Administration setup.', $tester->getDisplay()); 297 $this->assertContains('Administration setup.', $tester->getDisplay());
293 $this->assertContains('Config setup.', $tester->getDisplay()); 298 $this->assertContains('Config setup.', $tester->getDisplay());
299 $this->assertContains('Run migrations.', $tester->getDisplay());
294 } 300 }
295} 301}
diff --git a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
index 5956b502..8abb1bbb 100644
--- a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
+++ b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
@@ -111,7 +111,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
111 111
112 $this->assertEquals('http://domain.io', $entry->getUrl()); 112 $this->assertEquals('http://domain.io', $entry->getUrl());
113 $this->assertEquals('my title', $entry->getTitle()); 113 $this->assertEquals('my title', $entry->getTitle());
114 $this->assertEquals($this->fetchingErrorMessage . '<p><i>But we found a short description: </i></p>desc', $entry->getContent()); 114 $this->assertEquals($this->fetchingErrorMessage.'<p><i>But we found a short description: </i></p>desc', $entry->getContent());
115 $this->assertEmpty($entry->getPreviewPicture()); 115 $this->assertEmpty($entry->getPreviewPicture());
116 $this->assertEmpty($entry->getLanguage()); 116 $this->assertEmpty($entry->getLanguage());
117 $this->assertEmpty($entry->getHttpStatus()); 117 $this->assertEmpty($entry->getHttpStatus());
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;
10class ImportCommandTest extends WallabagCoreTestCase 10class 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/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}