diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests')
14 files changed, 272 insertions, 272 deletions
diff --git a/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php b/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php index bd61f750..0673d581 100644 --- a/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php +++ b/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php | |||
@@ -37,11 +37,11 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
37 | $application = new Application(static::$kernel); | 37 | $application = new Application(static::$kernel); |
38 | $application->setAutoExit(false); | 38 | $application->setAutoExit(false); |
39 | 39 | ||
40 | $code = $application->run(new ArrayInput(array( | 40 | $code = $application->run(new ArrayInput([ |
41 | 'command' => 'doctrine:fixtures:load', | 41 | 'command' => 'doctrine:fixtures:load', |
42 | '--no-interaction' => true, | 42 | '--no-interaction' => true, |
43 | '--env' => 'test', | 43 | '--env' => 'test', |
44 | )), new NullOutput()); | 44 | ]), new NullOutput()); |
45 | } | 45 | } |
46 | 46 | ||
47 | public function testRunInstallCommand() | 47 | public function testRunInstallCommand() |
@@ -63,9 +63,9 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
63 | $command->getHelperSet()->set($question, 'question'); | 63 | $command->getHelperSet()->set($question, 'question'); |
64 | 64 | ||
65 | $tester = new CommandTester($command); | 65 | $tester = new CommandTester($command); |
66 | $tester->execute(array( | 66 | $tester->execute([ |
67 | 'command' => $command->getName(), | 67 | 'command' => $command->getName(), |
68 | )); | 68 | ]); |
69 | 69 | ||
70 | $this->assertContains('Checking system requirements.', $tester->getDisplay()); | 70 | $this->assertContains('Checking system requirements.', $tester->getDisplay()); |
71 | $this->assertContains('Setting up database.', $tester->getDisplay()); | 71 | $this->assertContains('Setting up database.', $tester->getDisplay()); |
@@ -93,10 +93,10 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
93 | $command->getHelperSet()->set($question, 'question'); | 93 | $command->getHelperSet()->set($question, 'question'); |
94 | 94 | ||
95 | $tester = new CommandTester($command); | 95 | $tester = new CommandTester($command); |
96 | $tester->execute(array( | 96 | $tester->execute([ |
97 | 'command' => $command->getName(), | 97 | 'command' => $command->getName(), |
98 | '--reset' => true, | 98 | '--reset' => true, |
99 | )); | 99 | ]); |
100 | 100 | ||
101 | $this->assertContains('Checking system requirements.', $tester->getDisplay()); | 101 | $this->assertContains('Checking system requirements.', $tester->getDisplay()); |
102 | $this->assertContains('Setting up database.', $tester->getDisplay()); | 102 | $this->assertContains('Setting up database.', $tester->getDisplay()); |
@@ -116,10 +116,10 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
116 | 116 | ||
117 | // drop database first, so the install command won't ask to reset things | 117 | // drop database first, so the install command won't ask to reset things |
118 | $command = $application->find('doctrine:database:drop'); | 118 | $command = $application->find('doctrine:database:drop'); |
119 | $command->run(new ArrayInput(array( | 119 | $command->run(new ArrayInput([ |
120 | 'command' => 'doctrine:database:drop', | 120 | 'command' => 'doctrine:database:drop', |
121 | '--force' => true, | 121 | '--force' => true, |
122 | )), new NullOutput()); | 122 | ]), new NullOutput()); |
123 | 123 | ||
124 | // start a new application to avoid lagging connexion to pgsql | 124 | // start a new application to avoid lagging connexion to pgsql |
125 | $client = static::createClient(); | 125 | $client = static::createClient(); |
@@ -140,9 +140,9 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
140 | $command->getHelperSet()->set($question, 'question'); | 140 | $command->getHelperSet()->set($question, 'question'); |
141 | 141 | ||
142 | $tester = new CommandTester($command); | 142 | $tester = new CommandTester($command); |
143 | $tester->execute(array( | 143 | $tester->execute([ |
144 | 'command' => $command->getName(), | 144 | 'command' => $command->getName(), |
145 | )); | 145 | ]); |
146 | 146 | ||
147 | $this->assertContains('Checking system requirements.', $tester->getDisplay()); | 147 | $this->assertContains('Checking system requirements.', $tester->getDisplay()); |
148 | $this->assertContains('Setting up database.', $tester->getDisplay()); | 148 | $this->assertContains('Setting up database.', $tester->getDisplay()); |
@@ -178,9 +178,9 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
178 | $command->getHelperSet()->set($question, 'question'); | 178 | $command->getHelperSet()->set($question, 'question'); |
179 | 179 | ||
180 | $tester = new CommandTester($command); | 180 | $tester = new CommandTester($command); |
181 | $tester->execute(array( | 181 | $tester->execute([ |
182 | 'command' => $command->getName(), | 182 | 'command' => $command->getName(), |
183 | )); | 183 | ]); |
184 | 184 | ||
185 | $this->assertContains('Checking system requirements.', $tester->getDisplay()); | 185 | $this->assertContains('Checking system requirements.', $tester->getDisplay()); |
186 | $this->assertContains('Setting up database.', $tester->getDisplay()); | 186 | $this->assertContains('Setting up database.', $tester->getDisplay()); |
@@ -201,19 +201,19 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
201 | // drop database first, so the install command won't ask to reset things | 201 | // drop database first, so the install command won't ask to reset things |
202 | $command = new DropDatabaseDoctrineCommand(); | 202 | $command = new DropDatabaseDoctrineCommand(); |
203 | $command->setApplication($application); | 203 | $command->setApplication($application); |
204 | $command->run(new ArrayInput(array( | 204 | $command->run(new ArrayInput([ |
205 | 'command' => 'doctrine:database:drop', | 205 | 'command' => 'doctrine:database:drop', |
206 | '--force' => true, | 206 | '--force' => true, |
207 | )), new NullOutput()); | 207 | ]), new NullOutput()); |
208 | 208 | ||
209 | $this->getClient()->getContainer()->get('doctrine')->getConnection()->close(); | 209 | $this->getClient()->getContainer()->get('doctrine')->getConnection()->close(); |
210 | 210 | ||
211 | $command = new CreateDatabaseDoctrineCommand(); | 211 | $command = new CreateDatabaseDoctrineCommand(); |
212 | $command->setApplication($application); | 212 | $command->setApplication($application); |
213 | $command->run(new ArrayInput(array( | 213 | $command->run(new ArrayInput([ |
214 | 'command' => 'doctrine:database:create', | 214 | 'command' => 'doctrine:database:create', |
215 | '--env' => 'test', | 215 | '--env' => 'test', |
216 | )), new NullOutput()); | 216 | ]), new NullOutput()); |
217 | 217 | ||
218 | $command = $application->find('wallabag:install'); | 218 | $command = $application->find('wallabag:install'); |
219 | 219 | ||
@@ -233,9 +233,9 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
233 | $command->getHelperSet()->set($question, 'question'); | 233 | $command->getHelperSet()->set($question, 'question'); |
234 | 234 | ||
235 | $tester = new CommandTester($command); | 235 | $tester = new CommandTester($command); |
236 | $tester->execute(array( | 236 | $tester->execute([ |
237 | 'command' => $command->getName(), | 237 | 'command' => $command->getName(), |
238 | )); | 238 | ]); |
239 | 239 | ||
240 | $this->assertContains('Checking system requirements.', $tester->getDisplay()); | 240 | $this->assertContains('Checking system requirements.', $tester->getDisplay()); |
241 | $this->assertContains('Setting up database.', $tester->getDisplay()); | 241 | $this->assertContains('Setting up database.', $tester->getDisplay()); |
@@ -265,10 +265,10 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
265 | $command->getHelperSet()->set($question, 'question'); | 265 | $command->getHelperSet()->set($question, 'question'); |
266 | 266 | ||
267 | $tester = new CommandTester($command); | 267 | $tester = new CommandTester($command); |
268 | $tester->execute(array( | 268 | $tester->execute([ |
269 | 'command' => $command->getName(), | 269 | 'command' => $command->getName(), |
270 | '--no-interaction' => true, | 270 | '--no-interaction' => true, |
271 | )); | 271 | ]); |
272 | 272 | ||
273 | $this->assertContains('Checking system requirements.', $tester->getDisplay()); | 273 | $this->assertContains('Checking system requirements.', $tester->getDisplay()); |
274 | $this->assertContains('Setting up database.', $tester->getDisplay()); | 274 | $this->assertContains('Setting up database.', $tester->getDisplay()); |
diff --git a/src/Wallabag/CoreBundle/Tests/Command/TagAllCommandTest.php b/src/Wallabag/CoreBundle/Tests/Command/TagAllCommandTest.php index 653c1a93..4f544c1d 100644 --- a/src/Wallabag/CoreBundle/Tests/Command/TagAllCommandTest.php +++ b/src/Wallabag/CoreBundle/Tests/Command/TagAllCommandTest.php | |||
@@ -21,9 +21,9 @@ class TagAllCommandTest extends WallabagCoreTestCase | |||
21 | $command = $application->find('wallabag:tag:all'); | 21 | $command = $application->find('wallabag:tag:all'); |
22 | 22 | ||
23 | $tester = new CommandTester($command); | 23 | $tester = new CommandTester($command); |
24 | $tester->execute(array( | 24 | $tester->execute([ |
25 | 'command' => $command->getName(), | 25 | 'command' => $command->getName(), |
26 | )); | 26 | ]); |
27 | } | 27 | } |
28 | 28 | ||
29 | public function testRunTagAllCommandWithBadUsername() | 29 | public function testRunTagAllCommandWithBadUsername() |
@@ -34,10 +34,10 @@ class TagAllCommandTest extends WallabagCoreTestCase | |||
34 | $command = $application->find('wallabag:tag:all'); | 34 | $command = $application->find('wallabag:tag:all'); |
35 | 35 | ||
36 | $tester = new CommandTester($command); | 36 | $tester = new CommandTester($command); |
37 | $tester->execute(array( | 37 | $tester->execute([ |
38 | 'command' => $command->getName(), | 38 | 'command' => $command->getName(), |
39 | 'username' => 'unknown', | 39 | 'username' => 'unknown', |
40 | )); | 40 | ]); |
41 | 41 | ||
42 | $this->assertContains('User "unknown" not found', $tester->getDisplay()); | 42 | $this->assertContains('User "unknown" not found', $tester->getDisplay()); |
43 | } | 43 | } |
@@ -50,10 +50,10 @@ class TagAllCommandTest extends WallabagCoreTestCase | |||
50 | $command = $application->find('wallabag:tag:all'); | 50 | $command = $application->find('wallabag:tag:all'); |
51 | 51 | ||
52 | $tester = new CommandTester($command); | 52 | $tester = new CommandTester($command); |
53 | $tester->execute(array( | 53 | $tester->execute([ |
54 | 'command' => $command->getName(), | 54 | 'command' => $command->getName(), |
55 | 'username' => 'admin', | 55 | 'username' => 'admin', |
56 | )); | 56 | ]); |
57 | 57 | ||
58 | $this->assertContains('Tagging entries for user « admin »... Done', $tester->getDisplay()); | 58 | $this->assertContains('Tagging entries for user « admin »... Done', $tester->getDisplay()); |
59 | } | 59 | } |
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php index f2d26750..1aa1a7ed 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php | |||
@@ -43,12 +43,12 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
43 | 43 | ||
44 | $form = $crawler->filter('button[id=config_save]')->form(); | 44 | $form = $crawler->filter('button[id=config_save]')->form(); |
45 | 45 | ||
46 | $data = array( | 46 | $data = [ |
47 | 'config[theme]' => 'baggy', | 47 | 'config[theme]' => 'baggy', |
48 | 'config[items_per_page]' => '30', | 48 | 'config[items_per_page]' => '30', |
49 | 'config[reading_speed]' => '0.5', | 49 | 'config[reading_speed]' => '0.5', |
50 | 'config[language]' => 'en', | 50 | 'config[language]' => 'en', |
51 | ); | 51 | ]; |
52 | 52 | ||
53 | $client->submit($form, $data); | 53 | $client->submit($form, $data); |
54 | 54 | ||
@@ -56,19 +56,19 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
56 | 56 | ||
57 | $crawler = $client->followRedirect(); | 57 | $crawler = $client->followRedirect(); |
58 | 58 | ||
59 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); | 59 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(['_text'])); |
60 | $this->assertContains('flashes.config.notice.config_saved', $alert[0]); | 60 | $this->assertContains('flashes.config.notice.config_saved', $alert[0]); |
61 | } | 61 | } |
62 | 62 | ||
63 | public function dataForUpdateFailed() | 63 | public function dataForUpdateFailed() |
64 | { | 64 | { |
65 | return array( | 65 | return [ |
66 | array(array( | 66 | [[ |
67 | 'config[theme]' => 'baggy', | 67 | 'config[theme]' => 'baggy', |
68 | 'config[items_per_page]' => '', | 68 | 'config[items_per_page]' => '', |
69 | 'config[language]' => 'en', | 69 | 'config[language]' => 'en', |
70 | )), | 70 | ]], |
71 | ); | 71 | ]; |
72 | } | 72 | } |
73 | 73 | ||
74 | /** | 74 | /** |
@@ -89,46 +89,46 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
89 | 89 | ||
90 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 90 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
91 | 91 | ||
92 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(array('_text'))); | 92 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text'])); |
93 | $this->assertContains('This value should not be blank', $alert[0]); | 93 | $this->assertContains('This value should not be blank', $alert[0]); |
94 | } | 94 | } |
95 | 95 | ||
96 | public function dataForChangePasswordFailed() | 96 | public function dataForChangePasswordFailed() |
97 | { | 97 | { |
98 | return array( | 98 | return [ |
99 | array( | 99 | [ |
100 | array( | 100 | [ |
101 | 'change_passwd[old_password]' => 'material', | 101 | 'change_passwd[old_password]' => 'material', |
102 | 'change_passwd[new_password][first]' => '', | 102 | 'change_passwd[new_password][first]' => '', |
103 | 'change_passwd[new_password][second]' => '', | 103 | 'change_passwd[new_password][second]' => '', |
104 | ), | 104 | ], |
105 | 'validator.password_wrong_value', | 105 | 'validator.password_wrong_value', |
106 | ), | 106 | ], |
107 | array( | 107 | [ |
108 | array( | 108 | [ |
109 | 'change_passwd[old_password]' => 'mypassword', | 109 | 'change_passwd[old_password]' => 'mypassword', |
110 | 'change_passwd[new_password][first]' => '', | 110 | 'change_passwd[new_password][first]' => '', |
111 | 'change_passwd[new_password][second]' => '', | 111 | 'change_passwd[new_password][second]' => '', |
112 | ), | 112 | ], |
113 | 'This value should not be blank', | 113 | 'This value should not be blank', |
114 | ), | 114 | ], |
115 | array( | 115 | [ |
116 | array( | 116 | [ |
117 | 'change_passwd[old_password]' => 'mypassword', | 117 | 'change_passwd[old_password]' => 'mypassword', |
118 | 'change_passwd[new_password][first]' => 'hop', | 118 | 'change_passwd[new_password][first]' => 'hop', |
119 | 'change_passwd[new_password][second]' => '', | 119 | 'change_passwd[new_password][second]' => '', |
120 | ), | 120 | ], |
121 | 'validator.password_must_match', | 121 | 'validator.password_must_match', |
122 | ), | 122 | ], |
123 | array( | 123 | [ |
124 | array( | 124 | [ |
125 | 'change_passwd[old_password]' => 'mypassword', | 125 | 'change_passwd[old_password]' => 'mypassword', |
126 | 'change_passwd[new_password][first]' => 'hop', | 126 | 'change_passwd[new_password][first]' => 'hop', |
127 | 'change_passwd[new_password][second]' => 'hop', | 127 | 'change_passwd[new_password][second]' => 'hop', |
128 | ), | 128 | ], |
129 | 'validator.password_too_short', | 129 | 'validator.password_too_short', |
130 | ), | 130 | ], |
131 | ); | 131 | ]; |
132 | } | 132 | } |
133 | 133 | ||
134 | /** | 134 | /** |
@@ -149,7 +149,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
149 | 149 | ||
150 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 150 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
151 | 151 | ||
152 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(array('_text'))); | 152 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text'])); |
153 | $this->assertContains($expectedMessage, $alert[0]); | 153 | $this->assertContains($expectedMessage, $alert[0]); |
154 | } | 154 | } |
155 | 155 | ||
@@ -164,11 +164,11 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
164 | 164 | ||
165 | $form = $crawler->filter('button[id=change_passwd_save]')->form(); | 165 | $form = $crawler->filter('button[id=change_passwd_save]')->form(); |
166 | 166 | ||
167 | $data = array( | 167 | $data = [ |
168 | 'change_passwd[old_password]' => 'mypassword', | 168 | 'change_passwd[old_password]' => 'mypassword', |
169 | 'change_passwd[new_password][first]' => 'mypassword', | 169 | 'change_passwd[new_password][first]' => 'mypassword', |
170 | 'change_passwd[new_password][second]' => 'mypassword', | 170 | 'change_passwd[new_password][second]' => 'mypassword', |
171 | ); | 171 | ]; |
172 | 172 | ||
173 | $client->submit($form, $data); | 173 | $client->submit($form, $data); |
174 | 174 | ||
@@ -176,28 +176,28 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
176 | 176 | ||
177 | $crawler = $client->followRedirect(); | 177 | $crawler = $client->followRedirect(); |
178 | 178 | ||
179 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); | 179 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(['_text'])); |
180 | $this->assertContains('flashes.config.notice.password_updated', $alert[0]); | 180 | $this->assertContains('flashes.config.notice.password_updated', $alert[0]); |
181 | } | 181 | } |
182 | 182 | ||
183 | public function dataForUserFailed() | 183 | public function dataForUserFailed() |
184 | { | 184 | { |
185 | return array( | 185 | return [ |
186 | array( | 186 | [ |
187 | array( | 187 | [ |
188 | 'update_user[name]' => '', | 188 | 'update_user[name]' => '', |
189 | 'update_user[email]' => '', | 189 | 'update_user[email]' => '', |
190 | ), | 190 | ], |
191 | 'fos_user.email.blank', | 191 | 'fos_user.email.blank', |
192 | ), | 192 | ], |
193 | array( | 193 | [ |
194 | array( | 194 | [ |
195 | 'update_user[name]' => '', | 195 | 'update_user[name]' => '', |
196 | 'update_user[email]' => 'test', | 196 | 'update_user[email]' => 'test', |
197 | ), | 197 | ], |
198 | 'fos_user.email.invalid', | 198 | 'fos_user.email.invalid', |
199 | ), | 199 | ], |
200 | ); | 200 | ]; |
201 | } | 201 | } |
202 | 202 | ||
203 | /** | 203 | /** |
@@ -218,7 +218,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
218 | 218 | ||
219 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 219 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
220 | 220 | ||
221 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(array('_text'))); | 221 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text'])); |
222 | $this->assertContains($expectedMessage, $alert[0]); | 222 | $this->assertContains($expectedMessage, $alert[0]); |
223 | } | 223 | } |
224 | 224 | ||
@@ -233,10 +233,10 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
233 | 233 | ||
234 | $form = $crawler->filter('button[id=update_user_save]')->form(); | 234 | $form = $crawler->filter('button[id=update_user_save]')->form(); |
235 | 235 | ||
236 | $data = array( | 236 | $data = [ |
237 | 'update_user[name]' => 'new name', | 237 | 'update_user[name]' => 'new name', |
238 | 'update_user[email]' => 'admin@wallabag.io', | 238 | 'update_user[email]' => 'admin@wallabag.io', |
239 | ); | 239 | ]; |
240 | 240 | ||
241 | $client->submit($form, $data); | 241 | $client->submit($form, $data); |
242 | 242 | ||
@@ -244,59 +244,59 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
244 | 244 | ||
245 | $crawler = $client->followRedirect(); | 245 | $crawler = $client->followRedirect(); |
246 | 246 | ||
247 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(array('_text'))); | 247 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text'])); |
248 | $this->assertContains('flashes.config.notice.user_updated', $alert[0]); | 248 | $this->assertContains('flashes.config.notice.user_updated', $alert[0]); |
249 | } | 249 | } |
250 | 250 | ||
251 | public function dataForNewUserFailed() | 251 | public function dataForNewUserFailed() |
252 | { | 252 | { |
253 | return array( | 253 | return [ |
254 | array( | 254 | [ |
255 | array( | 255 | [ |
256 | 'new_user[username]' => '', | 256 | 'new_user[username]' => '', |
257 | 'new_user[plainPassword][first]' => '', | 257 | 'new_user[plainPassword][first]' => '', |
258 | 'new_user[plainPassword][second]' => '', | 258 | 'new_user[plainPassword][second]' => '', |
259 | 'new_user[email]' => '', | 259 | 'new_user[email]' => '', |
260 | ), | 260 | ], |
261 | 'fos_user.username.blank', | 261 | 'fos_user.username.blank', |
262 | ), | 262 | ], |
263 | array( | 263 | [ |
264 | array( | 264 | [ |
265 | 'new_user[username]' => 'a', | 265 | 'new_user[username]' => 'a', |
266 | 'new_user[plainPassword][first]' => 'mypassword', | 266 | 'new_user[plainPassword][first]' => 'mypassword', |
267 | 'new_user[plainPassword][second]' => 'mypassword', | 267 | 'new_user[plainPassword][second]' => 'mypassword', |
268 | 'new_user[email]' => '', | 268 | 'new_user[email]' => '', |
269 | ), | 269 | ], |
270 | 'fos_user.username.short', | 270 | 'fos_user.username.short', |
271 | ), | 271 | ], |
272 | array( | 272 | [ |
273 | array( | 273 | [ |
274 | 'new_user[username]' => 'wallace', | 274 | 'new_user[username]' => 'wallace', |
275 | 'new_user[plainPassword][first]' => 'mypassword', | 275 | 'new_user[plainPassword][first]' => 'mypassword', |
276 | 'new_user[plainPassword][second]' => 'mypassword', | 276 | 'new_user[plainPassword][second]' => 'mypassword', |
277 | 'new_user[email]' => 'test', | 277 | 'new_user[email]' => 'test', |
278 | ), | 278 | ], |
279 | 'fos_user.email.invalid', | 279 | 'fos_user.email.invalid', |
280 | ), | 280 | ], |
281 | array( | 281 | [ |
282 | array( | 282 | [ |
283 | 'new_user[username]' => 'admin', | 283 | 'new_user[username]' => 'admin', |
284 | 'new_user[plainPassword][first]' => 'wallacewallace', | 284 | 'new_user[plainPassword][first]' => 'wallacewallace', |
285 | 'new_user[plainPassword][second]' => 'wallacewallace', | 285 | 'new_user[plainPassword][second]' => 'wallacewallace', |
286 | 'new_user[email]' => 'wallace@wallace.me', | 286 | 'new_user[email]' => 'wallace@wallace.me', |
287 | ), | 287 | ], |
288 | 'fos_user.username.already_used', | 288 | 'fos_user.username.already_used', |
289 | ), | 289 | ], |
290 | array( | 290 | [ |
291 | array( | 291 | [ |
292 | 'new_user[username]' => 'wallace', | 292 | 'new_user[username]' => 'wallace', |
293 | 'new_user[plainPassword][first]' => 'mypassword1', | 293 | 'new_user[plainPassword][first]' => 'mypassword1', |
294 | 'new_user[plainPassword][second]' => 'mypassword2', | 294 | 'new_user[plainPassword][second]' => 'mypassword2', |
295 | 'new_user[email]' => 'wallace@wallace.me', | 295 | 'new_user[email]' => 'wallace@wallace.me', |
296 | ), | 296 | ], |
297 | 'validator.password_must_match', | 297 | 'validator.password_must_match', |
298 | ), | 298 | ], |
299 | ); | 299 | ]; |
300 | } | 300 | } |
301 | 301 | ||
302 | /** | 302 | /** |
@@ -317,7 +317,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
317 | 317 | ||
318 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 318 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
319 | 319 | ||
320 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(array('_text'))); | 320 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text'])); |
321 | $this->assertContains($expectedMessage, $alert[0]); | 321 | $this->assertContains($expectedMessage, $alert[0]); |
322 | } | 322 | } |
323 | 323 | ||
@@ -332,12 +332,12 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
332 | 332 | ||
333 | $form = $crawler->filter('button[id=new_user_save]')->form(); | 333 | $form = $crawler->filter('button[id=new_user_save]')->form(); |
334 | 334 | ||
335 | $data = array( | 335 | $data = [ |
336 | 'new_user[username]' => 'wallace', | 336 | 'new_user[username]' => 'wallace', |
337 | 'new_user[plainPassword][first]' => 'wallace1', | 337 | 'new_user[plainPassword][first]' => 'wallace1', |
338 | 'new_user[plainPassword][second]' => 'wallace1', | 338 | 'new_user[plainPassword][second]' => 'wallace1', |
339 | 'new_user[email]' => 'wallace@wallace.me', | 339 | 'new_user[email]' => 'wallace@wallace.me', |
340 | ); | 340 | ]; |
341 | 341 | ||
342 | $client->submit($form, $data); | 342 | $client->submit($form, $data); |
343 | 343 | ||
@@ -345,7 +345,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
345 | 345 | ||
346 | $crawler = $client->followRedirect(); | 346 | $crawler = $client->followRedirect(); |
347 | 347 | ||
348 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); | 348 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(['_text'])); |
349 | $this->assertContains('flashes.config.notice.user_added', $alert[0]); | 349 | $this->assertContains('flashes.config.notice.user_added', $alert[0]); |
350 | 350 | ||
351 | $em = $client->getContainer()->get('doctrine.orm.entity_manager'); | 351 | $em = $client->getContainer()->get('doctrine.orm.entity_manager'); |
@@ -381,7 +381,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
381 | 381 | ||
382 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 382 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
383 | 383 | ||
384 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); | 384 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); |
385 | $this->assertContains('config.form_rss.no_token', $body[0]); | 385 | $this->assertContains('config.form_rss.no_token', $body[0]); |
386 | 386 | ||
387 | $client->request('GET', '/generate-token'); | 387 | $client->request('GET', '/generate-token'); |
@@ -389,7 +389,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
389 | 389 | ||
390 | $crawler = $client->followRedirect(); | 390 | $crawler = $client->followRedirect(); |
391 | 391 | ||
392 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); | 392 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); |
393 | $this->assertNotContains('config.form_rss.no_token', $body[0]); | 393 | $this->assertNotContains('config.form_rss.no_token', $body[0]); |
394 | } | 394 | } |
395 | 395 | ||
@@ -401,9 +401,9 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
401 | $client->request( | 401 | $client->request( |
402 | 'GET', | 402 | 'GET', |
403 | '/generate-token', | 403 | '/generate-token', |
404 | array(), | 404 | [], |
405 | array(), | 405 | [], |
406 | array('HTTP_X-Requested-With' => 'XMLHttpRequest') | 406 | ['HTTP_X-Requested-With' => 'XMLHttpRequest'] |
407 | ); | 407 | ); |
408 | 408 | ||
409 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 409 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
@@ -422,9 +422,9 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
422 | 422 | ||
423 | $form = $crawler->filter('button[id=rss_config_save]')->form(); | 423 | $form = $crawler->filter('button[id=rss_config_save]')->form(); |
424 | 424 | ||
425 | $data = array( | 425 | $data = [ |
426 | 'rss_config[rss_limit]' => 12, | 426 | 'rss_config[rss_limit]' => 12, |
427 | ); | 427 | ]; |
428 | 428 | ||
429 | $client->submit($form, $data); | 429 | $client->submit($form, $data); |
430 | 430 | ||
@@ -432,26 +432,26 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
432 | 432 | ||
433 | $crawler = $client->followRedirect(); | 433 | $crawler = $client->followRedirect(); |
434 | 434 | ||
435 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); | 435 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(['_text'])); |
436 | $this->assertContains('flashes.config.notice.rss_updated', $alert[0]); | 436 | $this->assertContains('flashes.config.notice.rss_updated', $alert[0]); |
437 | } | 437 | } |
438 | 438 | ||
439 | public function dataForRssFailed() | 439 | public function dataForRssFailed() |
440 | { | 440 | { |
441 | return array( | 441 | return [ |
442 | array( | 442 | [ |
443 | array( | 443 | [ |
444 | 'rss_config[rss_limit]' => 0, | 444 | 'rss_config[rss_limit]' => 0, |
445 | ), | 445 | ], |
446 | 'This value should be 1 or more.', | 446 | 'This value should be 1 or more.', |
447 | ), | 447 | ], |
448 | array( | 448 | [ |
449 | array( | 449 | [ |
450 | 'rss_config[rss_limit]' => 1000000000000, | 450 | 'rss_config[rss_limit]' => 1000000000000, |
451 | ), | 451 | ], |
452 | 'validator.rss_limit_too_hight', | 452 | 'validator.rss_limit_too_hight', |
453 | ), | 453 | ], |
454 | ); | 454 | ]; |
455 | } | 455 | } |
456 | 456 | ||
457 | /** | 457 | /** |
@@ -472,7 +472,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
472 | 472 | ||
473 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 473 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
474 | 474 | ||
475 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(array('_text'))); | 475 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text'])); |
476 | $this->assertContains($expectedMessage, $alert[0]); | 476 | $this->assertContains($expectedMessage, $alert[0]); |
477 | } | 477 | } |
478 | 478 | ||
@@ -487,10 +487,10 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
487 | 487 | ||
488 | $form = $crawler->filter('button[id=tagging_rule_save]')->form(); | 488 | $form = $crawler->filter('button[id=tagging_rule_save]')->form(); |
489 | 489 | ||
490 | $data = array( | 490 | $data = [ |
491 | 'tagging_rule[rule]' => 'readingTime <= 3', | 491 | 'tagging_rule[rule]' => 'readingTime <= 3', |
492 | 'tagging_rule[tags]' => 'short reading', | 492 | 'tagging_rule[tags]' => 'short reading', |
493 | ); | 493 | ]; |
494 | 494 | ||
495 | $client->submit($form, $data); | 495 | $client->submit($form, $data); |
496 | 496 | ||
@@ -498,7 +498,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
498 | 498 | ||
499 | $crawler = $client->followRedirect(); | 499 | $crawler = $client->followRedirect(); |
500 | 500 | ||
501 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); | 501 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(['_text'])); |
502 | $this->assertContains('flashes.config.notice.tagging_rules_updated', $alert[0]); | 502 | $this->assertContains('flashes.config.notice.tagging_rules_updated', $alert[0]); |
503 | 503 | ||
504 | $deleteLink = $crawler->filter('.delete')->last()->link(); | 504 | $deleteLink = $crawler->filter('.delete')->last()->link(); |
@@ -507,34 +507,34 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
507 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 507 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
508 | 508 | ||
509 | $crawler = $client->followRedirect(); | 509 | $crawler = $client->followRedirect(); |
510 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); | 510 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(['_text'])); |
511 | $this->assertContains('flashes.config.notice.tagging_rules_deleted', $alert[0]); | 511 | $this->assertContains('flashes.config.notice.tagging_rules_deleted', $alert[0]); |
512 | } | 512 | } |
513 | 513 | ||
514 | public function dataForTaggingRuleFailed() | 514 | public function dataForTaggingRuleFailed() |
515 | { | 515 | { |
516 | return array( | 516 | return [ |
517 | array( | 517 | [ |
518 | array( | 518 | [ |
519 | 'tagging_rule[rule]' => 'unknownVar <= 3', | 519 | 'tagging_rule[rule]' => 'unknownVar <= 3', |
520 | 'tagging_rule[tags]' => 'cool tag', | 520 | 'tagging_rule[tags]' => 'cool tag', |
521 | ), | 521 | ], |
522 | array( | 522 | [ |
523 | 'The variable', | 523 | 'The variable', |
524 | 'does not exist.', | 524 | 'does not exist.', |
525 | ), | 525 | ], |
526 | ), | 526 | ], |
527 | array( | 527 | [ |
528 | array( | 528 | [ |
529 | 'tagging_rule[rule]' => 'length(domainName) <= 42', | 529 | 'tagging_rule[rule]' => 'length(domainName) <= 42', |
530 | 'tagging_rule[tags]' => 'cool tag', | 530 | 'tagging_rule[tags]' => 'cool tag', |
531 | ), | 531 | ], |
532 | array( | 532 | [ |
533 | 'The operator', | 533 | 'The operator', |
534 | 'does not exist.', | 534 | 'does not exist.', |
535 | ), | 535 | ], |
536 | ), | 536 | ], |
537 | ); | 537 | ]; |
538 | } | 538 | } |
539 | 539 | ||
540 | /** | 540 | /** |
@@ -555,7 +555,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
555 | 555 | ||
556 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 556 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
557 | 557 | ||
558 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); | 558 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); |
559 | 559 | ||
560 | foreach ($messages as $message) { | 560 | foreach ($messages as $message) { |
561 | $this->assertContains($message, $body[0]); | 561 | $this->assertContains($message, $body[0]); |
@@ -574,7 +574,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
574 | $crawler = $client->request('GET', '/tagging-rule/delete/'.$rule->getId()); | 574 | $crawler = $client->request('GET', '/tagging-rule/delete/'.$rule->getId()); |
575 | 575 | ||
576 | $this->assertEquals(403, $client->getResponse()->getStatusCode()); | 576 | $this->assertEquals(403, $client->getResponse()->getStatusCode()); |
577 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); | 577 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); |
578 | $this->assertContains('You can not access this tagging rule', $body[0]); | 578 | $this->assertContains('You can not access this tagging rule', $body[0]); |
579 | } | 579 | } |
580 | 580 | ||
@@ -593,11 +593,11 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
593 | 593 | ||
594 | $form = $crawler->filter('button[id=change_passwd_save]')->form(); | 594 | $form = $crawler->filter('button[id=change_passwd_save]')->form(); |
595 | 595 | ||
596 | $data = array( | 596 | $data = [ |
597 | 'change_passwd[old_password]' => 'mypassword', | 597 | 'change_passwd[old_password]' => 'mypassword', |
598 | 'change_passwd[new_password][first]' => 'mypassword', | 598 | 'change_passwd[new_password][first]' => 'mypassword', |
599 | 'change_passwd[new_password][second]' => 'mypassword', | 599 | 'change_passwd[new_password][second]' => 'mypassword', |
600 | ); | 600 | ]; |
601 | 601 | ||
602 | $client->submit($form, $data); | 602 | $client->submit($form, $data); |
603 | 603 | ||
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php index 46fbaf91..5260ca53 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php | |||
@@ -28,7 +28,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
28 | $crawler = $client->followRedirect(); | 28 | $crawler = $client->followRedirect(); |
29 | 29 | ||
30 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 30 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
31 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); | 31 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); |
32 | $this->assertContains('quickstart.intro.paragraph_1', $body[0]); | 32 | $this->assertContains('quickstart.intro.paragraph_1', $body[0]); |
33 | 33 | ||
34 | // Test if quickstart is disabled when user has 1 entry | 34 | // Test if quickstart is disabled when user has 1 entry |
@@ -38,16 +38,16 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
38 | 38 | ||
39 | $form = $crawler->filter('form[name=entry]')->form(); | 39 | $form = $crawler->filter('form[name=entry]')->form(); |
40 | 40 | ||
41 | $data = array( | 41 | $data = [ |
42 | 'entry[url]' => $this->url, | 42 | 'entry[url]' => $this->url, |
43 | ); | 43 | ]; |
44 | 44 | ||
45 | $client->submit($form, $data); | 45 | $client->submit($form, $data); |
46 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 46 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
47 | $client->followRedirect(); | 47 | $client->followRedirect(); |
48 | 48 | ||
49 | $crawler = $client->request('GET', '/unread/list'); | 49 | $crawler = $client->request('GET', '/unread/list'); |
50 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); | 50 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); |
51 | $this->assertContains('entry.list.number_on_the_page', $body[0]); | 51 | $this->assertContains('entry.list.number_on_the_page', $body[0]); |
52 | } | 52 | } |
53 | 53 | ||
@@ -74,7 +74,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
74 | $this->assertCount(4, $crawler->filter('div[class=entry]')); | 74 | $this->assertCount(4, $crawler->filter('div[class=entry]')); |
75 | 75 | ||
76 | // Good URL | 76 | // Good URL |
77 | $client->request('GET', '/bookmarklet', array('url' => $this->url)); | 77 | $client->request('GET', '/bookmarklet', ['url' => $this->url]); |
78 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 78 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
79 | $client->followRedirect(); | 79 | $client->followRedirect(); |
80 | $crawler = $client->request('GET', '/'); | 80 | $crawler = $client->request('GET', '/'); |
@@ -103,7 +103,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
103 | $crawler = $client->submit($form); | 103 | $crawler = $client->submit($form); |
104 | 104 | ||
105 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 105 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
106 | $this->assertCount(1, $alert = $crawler->filter('form ul li')->extract(array('_text'))); | 106 | $this->assertCount(1, $alert = $crawler->filter('form ul li')->extract(['_text'])); |
107 | $this->assertEquals('This value should not be blank.', $alert[0]); | 107 | $this->assertEquals('This value should not be blank.', $alert[0]); |
108 | } | 108 | } |
109 | 109 | ||
@@ -121,9 +121,9 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
121 | 121 | ||
122 | $form = $crawler->filter('form[name=entry]')->form(); | 122 | $form = $crawler->filter('form[name=entry]')->form(); |
123 | 123 | ||
124 | $data = array( | 124 | $data = [ |
125 | 'entry[url]' => $this->url, | 125 | 'entry[url]' => $this->url, |
126 | ); | 126 | ]; |
127 | 127 | ||
128 | $client->submit($form, $data); | 128 | $client->submit($form, $data); |
129 | 129 | ||
@@ -150,9 +150,9 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
150 | 150 | ||
151 | $form = $crawler->filter('form[name=entry]')->form(); | 151 | $form = $crawler->filter('form[name=entry]')->form(); |
152 | 152 | ||
153 | $data = array( | 153 | $data = [ |
154 | 'entry[url]' => $this->url, | 154 | 'entry[url]' => $this->url, |
155 | ); | 155 | ]; |
156 | 156 | ||
157 | $client->submit($form, $data); | 157 | $client->submit($form, $data); |
158 | 158 | ||
@@ -174,9 +174,9 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
174 | 174 | ||
175 | $form = $crawler->filter('form[name=entry]')->form(); | 175 | $form = $crawler->filter('form[name=entry]')->form(); |
176 | 176 | ||
177 | $data = array( | 177 | $data = [ |
178 | 'entry[url]' => $url = 'https://github.com/wallabag/wallabag', | 178 | 'entry[url]' => $url = 'https://github.com/wallabag/wallabag', |
179 | ); | 179 | ]; |
180 | 180 | ||
181 | $client->submit($form, $data); | 181 | $client->submit($form, $data); |
182 | 182 | ||
@@ -245,7 +245,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
245 | $crawler = $client->request('GET', '/view/'.$content->getId()); | 245 | $crawler = $client->request('GET', '/view/'.$content->getId()); |
246 | 246 | ||
247 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 247 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
248 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); | 248 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); |
249 | $this->assertContains($content->getTitle(), $body[0]); | 249 | $this->assertContains($content->getTitle(), $body[0]); |
250 | } | 250 | } |
251 | 251 | ||
@@ -315,9 +315,9 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
315 | 315 | ||
316 | $form = $crawler->filter('button[type=submit]')->form(); | 316 | $form = $crawler->filter('button[type=submit]')->form(); |
317 | 317 | ||
318 | $data = array( | 318 | $data = [ |
319 | 'entry[title]' => 'My updated title hehe :)', | 319 | 'entry[title]' => 'My updated title hehe :)', |
320 | ); | 320 | ]; |
321 | 321 | ||
322 | $client->submit($form, $data); | 322 | $client->submit($form, $data); |
323 | 323 | ||
@@ -325,7 +325,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
325 | 325 | ||
326 | $crawler = $client->followRedirect(); | 326 | $crawler = $client->followRedirect(); |
327 | 327 | ||
328 | $this->assertGreaterThan(1, $alert = $crawler->filter('div[id=article] h1')->extract(array('_text'))); | 328 | $this->assertGreaterThan(1, $alert = $crawler->filter('div[id=article] h1')->extract(['_text'])); |
329 | $this->assertContains('My updated title hehe :)', $alert[0]); | 329 | $this->assertContains('My updated title hehe :)', $alert[0]); |
330 | } | 330 | } |
331 | 331 | ||
@@ -461,10 +461,10 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
461 | 461 | ||
462 | $form = $crawler->filter('button[id=submit-filter]')->form(); | 462 | $form = $crawler->filter('button[id=submit-filter]')->form(); |
463 | 463 | ||
464 | $data = array( | 464 | $data = [ |
465 | 'entry_filter[readingTime][right_number]' => 11, | 465 | 'entry_filter[readingTime][right_number]' => 11, |
466 | 'entry_filter[readingTime][left_number]' => 11, | 466 | 'entry_filter[readingTime][left_number]' => 11, |
467 | ); | 467 | ]; |
468 | 468 | ||
469 | $crawler = $client->submit($form, $data); | 469 | $crawler = $client->submit($form, $data); |
470 | 470 | ||
@@ -480,28 +480,28 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
480 | 480 | ||
481 | $form = $crawler->filter('button[id=submit-filter]')->form(); | 481 | $form = $crawler->filter('button[id=submit-filter]')->form(); |
482 | 482 | ||
483 | $data = array( | 483 | $data = [ |
484 | 'entry_filter[createdAt][left_date]' => date('d/m/Y'), | 484 | 'entry_filter[createdAt][left_date]' => date('d/m/Y'), |
485 | 'entry_filter[createdAt][right_date]' => date('d/m/Y', strtotime('+1 day')), | 485 | 'entry_filter[createdAt][right_date]' => date('d/m/Y', strtotime('+1 day')), |
486 | ); | 486 | ]; |
487 | 487 | ||
488 | $crawler = $client->submit($form, $data); | 488 | $crawler = $client->submit($form, $data); |
489 | 489 | ||
490 | $this->assertCount(5, $crawler->filter('div[class=entry]')); | 490 | $this->assertCount(5, $crawler->filter('div[class=entry]')); |
491 | 491 | ||
492 | $data = array( | 492 | $data = [ |
493 | 'entry_filter[createdAt][left_date]' => date('d/m/Y'), | 493 | 'entry_filter[createdAt][left_date]' => date('d/m/Y'), |
494 | 'entry_filter[createdAt][right_date]' => date('d/m/Y'), | 494 | 'entry_filter[createdAt][right_date]' => date('d/m/Y'), |
495 | ); | 495 | ]; |
496 | 496 | ||
497 | $crawler = $client->submit($form, $data); | 497 | $crawler = $client->submit($form, $data); |
498 | 498 | ||
499 | $this->assertCount(5, $crawler->filter('div[class=entry]')); | 499 | $this->assertCount(5, $crawler->filter('div[class=entry]')); |
500 | 500 | ||
501 | $data = array( | 501 | $data = [ |
502 | 'entry_filter[createdAt][left_date]' => '01/01/1970', | 502 | 'entry_filter[createdAt][left_date]' => '01/01/1970', |
503 | 'entry_filter[createdAt][right_date]' => '01/01/1970', | 503 | 'entry_filter[createdAt][right_date]' => '01/01/1970', |
504 | ); | 504 | ]; |
505 | 505 | ||
506 | $crawler = $client->submit($form, $data); | 506 | $crawler = $client->submit($form, $data); |
507 | 507 | ||
@@ -516,9 +516,9 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
516 | 516 | ||
517 | $form = $crawler->filter('button[id=config_save]')->form(); | 517 | $form = $crawler->filter('button[id=config_save]')->form(); |
518 | 518 | ||
519 | $data = array( | 519 | $data = [ |
520 | 'config[items_per_page]' => '1', | 520 | 'config[items_per_page]' => '1', |
521 | ); | 521 | ]; |
522 | 522 | ||
523 | $client->submit($form, $data); | 523 | $client->submit($form, $data); |
524 | 524 | ||
@@ -531,9 +531,9 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
531 | // reset pagination | 531 | // reset pagination |
532 | $crawler = $client->request('GET', '/config'); | 532 | $crawler = $client->request('GET', '/config'); |
533 | $form = $crawler->filter('button[id=config_save]')->form(); | 533 | $form = $crawler->filter('button[id=config_save]')->form(); |
534 | $data = array( | 534 | $data = [ |
535 | 'config[items_per_page]' => '12', | 535 | 'config[items_per_page]' => '12', |
536 | ); | 536 | ]; |
537 | $client->submit($form, $data); | 537 | $client->submit($form, $data); |
538 | } | 538 | } |
539 | 539 | ||
@@ -544,17 +544,17 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
544 | 544 | ||
545 | $crawler = $client->request('GET', '/unread/list'); | 545 | $crawler = $client->request('GET', '/unread/list'); |
546 | $form = $crawler->filter('button[id=submit-filter]')->form(); | 546 | $form = $crawler->filter('button[id=submit-filter]')->form(); |
547 | $data = array( | 547 | $data = [ |
548 | 'entry_filter[domainName]' => 'domain', | 548 | 'entry_filter[domainName]' => 'domain', |
549 | ); | 549 | ]; |
550 | 550 | ||
551 | $crawler = $client->submit($form, $data); | 551 | $crawler = $client->submit($form, $data); |
552 | $this->assertCount(5, $crawler->filter('div[class=entry]')); | 552 | $this->assertCount(5, $crawler->filter('div[class=entry]')); |
553 | 553 | ||
554 | $form = $crawler->filter('button[id=submit-filter]')->form(); | 554 | $form = $crawler->filter('button[id=submit-filter]')->form(); |
555 | $data = array( | 555 | $data = [ |
556 | 'entry_filter[domainName]' => 'wallabag', | 556 | 'entry_filter[domainName]' => 'wallabag', |
557 | ); | 557 | ]; |
558 | 558 | ||
559 | $crawler = $client->submit($form, $data); | 559 | $crawler = $client->submit($form, $data); |
560 | $this->assertCount(0, $crawler->filter('div[class=entry]')); | 560 | $this->assertCount(0, $crawler->filter('div[class=entry]')); |
@@ -601,17 +601,17 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
601 | 601 | ||
602 | $crawler = $client->request('GET', '/unread/list'); | 602 | $crawler = $client->request('GET', '/unread/list'); |
603 | $form = $crawler->filter('button[id=submit-filter]')->form(); | 603 | $form = $crawler->filter('button[id=submit-filter]')->form(); |
604 | $data = array( | 604 | $data = [ |
605 | 'entry_filter[language]' => 'fr', | 605 | 'entry_filter[language]' => 'fr', |
606 | ); | 606 | ]; |
607 | 607 | ||
608 | $crawler = $client->submit($form, $data); | 608 | $crawler = $client->submit($form, $data); |
609 | $this->assertCount(2, $crawler->filter('div[class=entry]')); | 609 | $this->assertCount(2, $crawler->filter('div[class=entry]')); |
610 | 610 | ||
611 | $form = $crawler->filter('button[id=submit-filter]')->form(); | 611 | $form = $crawler->filter('button[id=submit-filter]')->form(); |
612 | $data = array( | 612 | $data = [ |
613 | 'entry_filter[language]' => 'en', | 613 | 'entry_filter[language]' => 'en', |
614 | ); | 614 | ]; |
615 | 615 | ||
616 | $crawler = $client->submit($form, $data); | 616 | $crawler = $client->submit($form, $data); |
617 | $this->assertCount(2, $crawler->filter('div[class=entry]')); | 617 | $this->assertCount(2, $crawler->filter('div[class=entry]')); |
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/RssControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/RssControllerTest.php index 45a74c43..87a01b8e 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/RssControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/RssControllerTest.php | |||
@@ -34,17 +34,17 @@ class RssControllerTest extends WallabagCoreTestCase | |||
34 | 34 | ||
35 | public function dataForBadUrl() | 35 | public function dataForBadUrl() |
36 | { | 36 | { |
37 | return array( | 37 | return [ |
38 | array( | 38 | [ |
39 | '/admin/YZIOAUZIAO/unread.xml', | 39 | '/admin/YZIOAUZIAO/unread.xml', |
40 | ), | 40 | ], |
41 | array( | 41 | [ |
42 | '/wallace/YZIOAUZIAO/starred.xml', | 42 | '/wallace/YZIOAUZIAO/starred.xml', |
43 | ), | 43 | ], |
44 | array( | 44 | [ |
45 | '/wallace/YZIOAUZIAO/archives.xml', | 45 | '/wallace/YZIOAUZIAO/archives.xml', |
46 | ), | 46 | ], |
47 | ); | 47 | ]; |
48 | } | 48 | } |
49 | 49 | ||
50 | /** | 50 | /** |
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php index ed292633..2910fa4f 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php | |||
@@ -13,7 +13,7 @@ class SecurityControllerTest extends WallabagCoreTestCase | |||
13 | $client->followRedirects(); | 13 | $client->followRedirects(); |
14 | 14 | ||
15 | $crawler = $client->request('GET', '/config'); | 15 | $crawler = $client->request('GET', '/config'); |
16 | $this->assertContains('config.form_rss.description', $crawler->filter('body')->extract(array('_text'))[0]); | 16 | $this->assertContains('config.form_rss.description', $crawler->filter('body')->extract(['_text'])[0]); |
17 | } | 17 | } |
18 | 18 | ||
19 | public function testLoginWith2Factor() | 19 | public function testLoginWith2Factor() |
@@ -38,7 +38,7 @@ class SecurityControllerTest extends WallabagCoreTestCase | |||
38 | 38 | ||
39 | $this->logInAs('admin'); | 39 | $this->logInAs('admin'); |
40 | $crawler = $client->request('GET', '/config'); | 40 | $crawler = $client->request('GET', '/config'); |
41 | $this->assertContains('scheb_two_factor.trusted', $crawler->filter('body')->extract(array('_text'))[0]); | 41 | $this->assertContains('scheb_two_factor.trusted', $crawler->filter('body')->extract(['_text'])[0]); |
42 | 42 | ||
43 | // restore user | 43 | // restore user |
44 | $user = $em | 44 | $user = $em |
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php index 1457c807..8af37ea4 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php | |||
@@ -32,9 +32,9 @@ class TagControllerTest extends WallabagCoreTestCase | |||
32 | 32 | ||
33 | $form = $crawler->filter('form[name=tag]')->form(); | 33 | $form = $crawler->filter('form[name=tag]')->form(); |
34 | 34 | ||
35 | $data = array( | 35 | $data = [ |
36 | 'tag[label]' => $this->tagName, | 36 | 'tag[label]' => $this->tagName, |
37 | ); | 37 | ]; |
38 | 38 | ||
39 | $client->submit($form, $data); | 39 | $client->submit($form, $data); |
40 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 40 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
@@ -53,9 +53,9 @@ class TagControllerTest extends WallabagCoreTestCase | |||
53 | $this->assertEquals(1, count($newEntry->getTags())); | 53 | $this->assertEquals(1, count($newEntry->getTags())); |
54 | 54 | ||
55 | # tag already exists but still not assigned to this entry | 55 | # tag already exists but still not assigned to this entry |
56 | $data = array( | 56 | $data = [ |
57 | 'tag[label]' => 'foo', | 57 | 'tag[label]' => 'foo', |
58 | ); | 58 | ]; |
59 | 59 | ||
60 | $client->submit($form, $data); | 60 | $client->submit($form, $data); |
61 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 61 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
@@ -82,9 +82,9 @@ class TagControllerTest extends WallabagCoreTestCase | |||
82 | 82 | ||
83 | $form = $crawler->filter('form[name=tag]')->form(); | 83 | $form = $crawler->filter('form[name=tag]')->form(); |
84 | 84 | ||
85 | $data = array( | 85 | $data = [ |
86 | 'tag[label]' => 'foo2, bar2', | 86 | 'tag[label]' => 'foo2, bar2', |
87 | ); | 87 | ]; |
88 | 88 | ||
89 | $client->submit($form, $data); | 89 | $client->submit($form, $data); |
90 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 90 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
diff --git a/src/Wallabag/CoreBundle/Tests/Form/DataTransformer/StringToListTransformerTest.php b/src/Wallabag/CoreBundle/Tests/Form/DataTransformer/StringToListTransformerTest.php index 7105488d..6b1e8613 100644 --- a/src/Wallabag/CoreBundle/Tests/Form/DataTransformer/StringToListTransformerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Form/DataTransformer/StringToListTransformerTest.php | |||
@@ -18,12 +18,12 @@ class StringToListTransformerTest extends \PHPUnit_Framework_TestCase | |||
18 | 18 | ||
19 | public function transformProvider() | 19 | public function transformProvider() |
20 | { | 20 | { |
21 | return array( | 21 | return [ |
22 | array(null, ''), | 22 | [null, ''], |
23 | array(array(), ''), | 23 | [[], ''], |
24 | array(array('single value'), 'single value'), | 24 | [['single value'], 'single value'], |
25 | array(array('first value', 'second value'), 'first value,second value'), | 25 | [['first value', 'second value'], 'first value,second value'], |
26 | ); | 26 | ]; |
27 | } | 27 | } |
28 | 28 | ||
29 | /** | 29 | /** |
@@ -38,13 +38,13 @@ class StringToListTransformerTest extends \PHPUnit_Framework_TestCase | |||
38 | 38 | ||
39 | public function reverseTransformProvider() | 39 | public function reverseTransformProvider() |
40 | { | 40 | { |
41 | return array( | 41 | return [ |
42 | array(null, null), | 42 | [null, null], |
43 | array('', array()), | 43 | ['', []], |
44 | array('single value', array('single value')), | 44 | ['single value', ['single value']], |
45 | array('first value,second value', array('first value', 'second value')), | 45 | ['first value,second value', ['first value', 'second value']], |
46 | array('first value, second value', array('first value', 'second value')), | 46 | ['first value, second value', ['first value', 'second value']], |
47 | array('first value, , second value', array('first value', 'second value')), | 47 | ['first value, , second value', ['first value', 'second value']], |
48 | ); | 48 | ]; |
49 | } | 49 | } |
50 | } | 50 | } |
diff --git a/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php b/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php index 74bfb054..9d7b0f36 100644 --- a/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php +++ b/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php | |||
@@ -17,19 +17,19 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
17 | ->method('tag'); | 17 | ->method('tag'); |
18 | 18 | ||
19 | $graby = $this->getMockBuilder('Graby\Graby') | 19 | $graby = $this->getMockBuilder('Graby\Graby') |
20 | ->setMethods(array('fetchContent')) | 20 | ->setMethods(['fetchContent']) |
21 | ->disableOriginalConstructor() | 21 | ->disableOriginalConstructor() |
22 | ->getMock(); | 22 | ->getMock(); |
23 | 23 | ||
24 | $graby->expects($this->any()) | 24 | $graby->expects($this->any()) |
25 | ->method('fetchContent') | 25 | ->method('fetchContent') |
26 | ->willReturn(array( | 26 | ->willReturn([ |
27 | 'html' => false, | 27 | 'html' => false, |
28 | 'title' => '', | 28 | 'title' => '', |
29 | 'url' => '', | 29 | 'url' => '', |
30 | 'content_type' => '', | 30 | 'content_type' => '', |
31 | 'language' => '', | 31 | 'language' => '', |
32 | )); | 32 | ]); |
33 | 33 | ||
34 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); | 34 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); |
35 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://user@:80'); | 35 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://user@:80'); |
@@ -51,19 +51,19 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
51 | ->method('tag'); | 51 | ->method('tag'); |
52 | 52 | ||
53 | $graby = $this->getMockBuilder('Graby\Graby') | 53 | $graby = $this->getMockBuilder('Graby\Graby') |
54 | ->setMethods(array('fetchContent')) | 54 | ->setMethods(['fetchContent']) |
55 | ->disableOriginalConstructor() | 55 | ->disableOriginalConstructor() |
56 | ->getMock(); | 56 | ->getMock(); |
57 | 57 | ||
58 | $graby->expects($this->any()) | 58 | $graby->expects($this->any()) |
59 | ->method('fetchContent') | 59 | ->method('fetchContent') |
60 | ->willReturn(array( | 60 | ->willReturn([ |
61 | 'html' => false, | 61 | 'html' => false, |
62 | 'title' => '', | 62 | 'title' => '', |
63 | 'url' => '', | 63 | 'url' => '', |
64 | 'content_type' => '', | 64 | 'content_type' => '', |
65 | 'language' => '', | 65 | 'language' => '', |
66 | )); | 66 | ]); |
67 | 67 | ||
68 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); | 68 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); |
69 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); | 69 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); |
@@ -85,23 +85,23 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
85 | ->method('tag'); | 85 | ->method('tag'); |
86 | 86 | ||
87 | $graby = $this->getMockBuilder('Graby\Graby') | 87 | $graby = $this->getMockBuilder('Graby\Graby') |
88 | ->setMethods(array('fetchContent')) | 88 | ->setMethods(['fetchContent']) |
89 | ->disableOriginalConstructor() | 89 | ->disableOriginalConstructor() |
90 | ->getMock(); | 90 | ->getMock(); |
91 | 91 | ||
92 | $graby->expects($this->any()) | 92 | $graby->expects($this->any()) |
93 | ->method('fetchContent') | 93 | ->method('fetchContent') |
94 | ->willReturn(array( | 94 | ->willReturn([ |
95 | 'html' => false, | 95 | 'html' => false, |
96 | 'title' => '', | 96 | 'title' => '', |
97 | 'url' => '', | 97 | 'url' => '', |
98 | 'content_type' => '', | 98 | 'content_type' => '', |
99 | 'language' => '', | 99 | 'language' => '', |
100 | 'open_graph' => array( | 100 | 'open_graph' => [ |
101 | 'og_title' => 'my title', | 101 | 'og_title' => 'my title', |
102 | 'og_description' => 'desc', | 102 | 'og_description' => 'desc', |
103 | ), | 103 | ], |
104 | )); | 104 | ]); |
105 | 105 | ||
106 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); | 106 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); |
107 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://domain.io'); | 107 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://domain.io'); |
@@ -123,24 +123,24 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
123 | ->method('tag'); | 123 | ->method('tag'); |
124 | 124 | ||
125 | $graby = $this->getMockBuilder('Graby\Graby') | 125 | $graby = $this->getMockBuilder('Graby\Graby') |
126 | ->setMethods(array('fetchContent')) | 126 | ->setMethods(['fetchContent']) |
127 | ->disableOriginalConstructor() | 127 | ->disableOriginalConstructor() |
128 | ->getMock(); | 128 | ->getMock(); |
129 | 129 | ||
130 | $graby->expects($this->any()) | 130 | $graby->expects($this->any()) |
131 | ->method('fetchContent') | 131 | ->method('fetchContent') |
132 | ->willReturn(array( | 132 | ->willReturn([ |
133 | 'html' => str_repeat('this is my content', 325), | 133 | 'html' => str_repeat('this is my content', 325), |
134 | 'title' => 'this is my title', | 134 | 'title' => 'this is my title', |
135 | 'url' => 'http://1.1.1.1', | 135 | 'url' => 'http://1.1.1.1', |
136 | 'content_type' => 'text/html', | 136 | 'content_type' => 'text/html', |
137 | 'language' => 'fr', | 137 | 'language' => 'fr', |
138 | 'open_graph' => array( | 138 | 'open_graph' => [ |
139 | 'og_title' => 'my OG title', | 139 | 'og_title' => 'my OG title', |
140 | 'og_description' => 'OG desc', | 140 | 'og_description' => 'OG desc', |
141 | 'og_image' => 'http://3.3.3.3/cover.jpg', | 141 | 'og_image' => 'http://3.3.3.3/cover.jpg', |
142 | ), | 142 | ], |
143 | )); | 143 | ]); |
144 | 144 | ||
145 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); | 145 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); |
146 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); | 146 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); |
@@ -217,7 +217,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
217 | 217 | ||
218 | $entry = new Entry(new User()); | 218 | $entry = new Entry(new User()); |
219 | 219 | ||
220 | $proxy->assignTagsToEntry($entry, array(' tag1', 'tag2 ')); | 220 | $proxy->assignTagsToEntry($entry, [' tag1', 'tag2 ']); |
221 | 221 | ||
222 | $this->assertCount(2, $entry->getTags()); | 222 | $this->assertCount(2, $entry->getTags()); |
223 | $this->assertEquals('tag1', $entry->getTags()[0]->getLabel()); | 223 | $this->assertEquals('tag1', $entry->getTags()[0]->getLabel()); |
@@ -253,7 +253,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
253 | 253 | ||
254 | $entry = new Entry(new User()); | 254 | $entry = new Entry(new User()); |
255 | 255 | ||
256 | $proxy->assignTagsToEntry($entry, array()); | 256 | $proxy->assignTagsToEntry($entry, []); |
257 | 257 | ||
258 | $this->assertCount(0, $entry->getTags()); | 258 | $this->assertCount(0, $entry->getTags()); |
259 | } | 259 | } |
@@ -299,7 +299,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
299 | private function getTaggerMock() | 299 | private function getTaggerMock() |
300 | { | 300 | { |
301 | return $this->getMockBuilder('Wallabag\CoreBundle\Helper\RuleBasedTagger') | 301 | return $this->getMockBuilder('Wallabag\CoreBundle\Helper\RuleBasedTagger') |
302 | ->setMethods(array('tag')) | 302 | ->setMethods(['tag']) |
303 | ->disableOriginalConstructor() | 303 | ->disableOriginalConstructor() |
304 | ->getMock(); | 304 | ->getMock(); |
305 | } | 305 | } |
diff --git a/src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php b/src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php index c43c62c3..e9025b45 100644 --- a/src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php | |||
@@ -36,7 +36,7 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase | |||
36 | 36 | ||
37 | public function testTagWithNoMatchingRule() | 37 | public function testTagWithNoMatchingRule() |
38 | { | 38 | { |
39 | $taggingRule = $this->getTaggingRule('rule as string', array('foo', 'bar')); | 39 | $taggingRule = $this->getTaggingRule('rule as string', ['foo', 'bar']); |
40 | $user = $this->getUser([$taggingRule]); | 40 | $user = $this->getUser([$taggingRule]); |
41 | $entry = new Entry($user); | 41 | $entry = new Entry($user); |
42 | 42 | ||
@@ -53,7 +53,7 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase | |||
53 | 53 | ||
54 | public function testTagWithAMatchingRule() | 54 | public function testTagWithAMatchingRule() |
55 | { | 55 | { |
56 | $taggingRule = $this->getTaggingRule('rule as string', array('foo', 'bar')); | 56 | $taggingRule = $this->getTaggingRule('rule as string', ['foo', 'bar']); |
57 | $user = $this->getUser([$taggingRule]); | 57 | $user = $this->getUser([$taggingRule]); |
58 | $entry = new Entry($user); | 58 | $entry = new Entry($user); |
59 | 59 | ||
@@ -74,8 +74,8 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase | |||
74 | 74 | ||
75 | public function testTagWithAMixOfMatchingRules() | 75 | public function testTagWithAMixOfMatchingRules() |
76 | { | 76 | { |
77 | $taggingRule = $this->getTaggingRule('bla bla', array('hey')); | 77 | $taggingRule = $this->getTaggingRule('bla bla', ['hey']); |
78 | $otherTaggingRule = $this->getTaggingRule('rule as string', array('foo')); | 78 | $otherTaggingRule = $this->getTaggingRule('rule as string', ['foo']); |
79 | 79 | ||
80 | $user = $this->getUser([$taggingRule, $otherTaggingRule]); | 80 | $user = $this->getUser([$taggingRule, $otherTaggingRule]); |
81 | $entry = new Entry($user); | 81 | $entry = new Entry($user); |
@@ -94,7 +94,7 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase | |||
94 | 94 | ||
95 | public function testWhenTheTagExists() | 95 | public function testWhenTheTagExists() |
96 | { | 96 | { |
97 | $taggingRule = $this->getTaggingRule('rule as string', array('foo')); | 97 | $taggingRule = $this->getTaggingRule('rule as string', ['foo']); |
98 | $user = $this->getUser([$taggingRule]); | 98 | $user = $this->getUser([$taggingRule]); |
99 | $entry = new Entry($user); | 99 | $entry = new Entry($user); |
100 | $tag = new Tag(); | 100 | $tag = new Tag(); |
@@ -122,8 +122,8 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase | |||
122 | 122 | ||
123 | public function testSameTagWithDifferentfMatchingRules() | 123 | public function testSameTagWithDifferentfMatchingRules() |
124 | { | 124 | { |
125 | $taggingRule = $this->getTaggingRule('bla bla', array('hey')); | 125 | $taggingRule = $this->getTaggingRule('bla bla', ['hey']); |
126 | $otherTaggingRule = $this->getTaggingRule('rule as string', array('hey')); | 126 | $otherTaggingRule = $this->getTaggingRule('rule as string', ['hey']); |
127 | 127 | ||
128 | $user = $this->getUser([$taggingRule, $otherTaggingRule]); | 128 | $user = $this->getUser([$taggingRule, $otherTaggingRule]); |
129 | $entry = new Entry($user); | 129 | $entry = new Entry($user); |
@@ -142,7 +142,7 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase | |||
142 | 142 | ||
143 | public function testTagAllEntriesForAUser() | 143 | public function testTagAllEntriesForAUser() |
144 | { | 144 | { |
145 | $taggingRule = $this->getTaggingRule('bla bla', array('hey')); | 145 | $taggingRule = $this->getTaggingRule('bla bla', ['hey']); |
146 | 146 | ||
147 | $user = $this->getUser([$taggingRule]); | 147 | $user = $this->getUser([$taggingRule]); |
148 | 148 | ||
@@ -152,7 +152,7 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase | |||
152 | 152 | ||
153 | $this->rulerz | 153 | $this->rulerz |
154 | ->method('filter') | 154 | ->method('filter') |
155 | ->willReturn(array(new Entry($user), new Entry($user))); | 155 | ->willReturn([new Entry($user), new Entry($user)]); |
156 | 156 | ||
157 | $entries = $this->tagger->tagAllForUser($user); | 157 | $entries = $this->tagger->tagAllForUser($user); |
158 | 158 | ||
diff --git a/src/Wallabag/CoreBundle/Tests/Mock/InstallCommandMock.php b/src/Wallabag/CoreBundle/Tests/Mock/InstallCommandMock.php index 69bc48e0..ff9cdafd 100644 --- a/src/Wallabag/CoreBundle/Tests/Mock/InstallCommandMock.php +++ b/src/Wallabag/CoreBundle/Tests/Mock/InstallCommandMock.php | |||
@@ -15,7 +15,7 @@ use Wallabag\CoreBundle\Command\InstallCommand; | |||
15 | */ | 15 | */ |
16 | class InstallCommandMock extends InstallCommand | 16 | class InstallCommandMock extends InstallCommand |
17 | { | 17 | { |
18 | protected function runCommand($command, $parameters = array()) | 18 | protected function runCommand($command, $parameters = []) |
19 | { | 19 | { |
20 | return $this; | 20 | return $this; |
21 | } | 21 | } |
diff --git a/src/Wallabag/CoreBundle/Tests/ParamConverter/UsernameRssTokenConverterTest.php b/src/Wallabag/CoreBundle/Tests/ParamConverter/UsernameRssTokenConverterTest.php index b95be133..ee10938a 100644 --- a/src/Wallabag/CoreBundle/Tests/ParamConverter/UsernameRssTokenConverterTest.php +++ b/src/Wallabag/CoreBundle/Tests/ParamConverter/UsernameRssTokenConverterTest.php | |||
@@ -11,7 +11,7 @@ class UsernameRssTokenConverterTest extends \PHPUnit_Framework_TestCase | |||
11 | { | 11 | { |
12 | public function testSupportsWithNoRegistry() | 12 | public function testSupportsWithNoRegistry() |
13 | { | 13 | { |
14 | $params = new ParamConverter(array()); | 14 | $params = new ParamConverter([]); |
15 | $converter = new UsernameRssTokenConverter(); | 15 | $converter = new UsernameRssTokenConverter(); |
16 | 16 | ||
17 | $this->assertFalse($converter->supports($params)); | 17 | $this->assertFalse($converter->supports($params)); |
@@ -25,9 +25,9 @@ class UsernameRssTokenConverterTest extends \PHPUnit_Framework_TestCase | |||
25 | 25 | ||
26 | $registry->expects($this->once()) | 26 | $registry->expects($this->once()) |
27 | ->method('getManagers') | 27 | ->method('getManagers') |
28 | ->will($this->returnValue(array())); | 28 | ->will($this->returnValue([])); |
29 | 29 | ||
30 | $params = new ParamConverter(array()); | 30 | $params = new ParamConverter([]); |
31 | $converter = new UsernameRssTokenConverter($registry); | 31 | $converter = new UsernameRssTokenConverter($registry); |
32 | 32 | ||
33 | $this->assertFalse($converter->supports($params)); | 33 | $this->assertFalse($converter->supports($params)); |
@@ -41,9 +41,9 @@ class UsernameRssTokenConverterTest extends \PHPUnit_Framework_TestCase | |||
41 | 41 | ||
42 | $registry->expects($this->once()) | 42 | $registry->expects($this->once()) |
43 | ->method('getManagers') | 43 | ->method('getManagers') |
44 | ->will($this->returnValue(array('default' => null))); | 44 | ->will($this->returnValue(['default' => null])); |
45 | 45 | ||
46 | $params = new ParamConverter(array()); | 46 | $params = new ParamConverter([]); |
47 | $converter = new UsernameRssTokenConverter($registry); | 47 | $converter = new UsernameRssTokenConverter($registry); |
48 | 48 | ||
49 | $this->assertFalse($converter->supports($params)); | 49 | $this->assertFalse($converter->supports($params)); |
@@ -74,14 +74,14 @@ class UsernameRssTokenConverterTest extends \PHPUnit_Framework_TestCase | |||
74 | 74 | ||
75 | $registry->expects($this->once()) | 75 | $registry->expects($this->once()) |
76 | ->method('getManagers') | 76 | ->method('getManagers') |
77 | ->will($this->returnValue(array('default' => null))); | 77 | ->will($this->returnValue(['default' => null])); |
78 | 78 | ||
79 | $registry->expects($this->once()) | 79 | $registry->expects($this->once()) |
80 | ->method('getManagerForClass') | 80 | ->method('getManagerForClass') |
81 | ->with('superclass') | 81 | ->with('superclass') |
82 | ->will($this->returnValue($em)); | 82 | ->will($this->returnValue($em)); |
83 | 83 | ||
84 | $params = new ParamConverter(array('class' => 'superclass')); | 84 | $params = new ParamConverter(['class' => 'superclass']); |
85 | $converter = new UsernameRssTokenConverter($registry); | 85 | $converter = new UsernameRssTokenConverter($registry); |
86 | 86 | ||
87 | $this->assertFalse($converter->supports($params)); | 87 | $this->assertFalse($converter->supports($params)); |
@@ -112,14 +112,14 @@ class UsernameRssTokenConverterTest extends \PHPUnit_Framework_TestCase | |||
112 | 112 | ||
113 | $registry->expects($this->once()) | 113 | $registry->expects($this->once()) |
114 | ->method('getManagers') | 114 | ->method('getManagers') |
115 | ->will($this->returnValue(array('default' => null))); | 115 | ->will($this->returnValue(['default' => null])); |
116 | 116 | ||
117 | $registry->expects($this->once()) | 117 | $registry->expects($this->once()) |
118 | ->method('getManagerForClass') | 118 | ->method('getManagerForClass') |
119 | ->with('WallabagUserBundle:User') | 119 | ->with('WallabagUserBundle:User') |
120 | ->will($this->returnValue($em)); | 120 | ->will($this->returnValue($em)); |
121 | 121 | ||
122 | $params = new ParamConverter(array('class' => 'WallabagUserBundle:User')); | 122 | $params = new ParamConverter(['class' => 'WallabagUserBundle:User']); |
123 | $converter = new UsernameRssTokenConverter($registry); | 123 | $converter = new UsernameRssTokenConverter($registry); |
124 | 124 | ||
125 | $this->assertTrue($converter->supports($params)); | 125 | $this->assertTrue($converter->supports($params)); |
@@ -131,7 +131,7 @@ class UsernameRssTokenConverterTest extends \PHPUnit_Framework_TestCase | |||
131 | */ | 131 | */ |
132 | public function testApplyEmptyRequest() | 132 | public function testApplyEmptyRequest() |
133 | { | 133 | { |
134 | $params = new ParamConverter(array()); | 134 | $params = new ParamConverter([]); |
135 | $converter = new UsernameRssTokenConverter(); | 135 | $converter = new UsernameRssTokenConverter(); |
136 | 136 | ||
137 | $converter->apply(new Request(), $params); | 137 | $converter->apply(new Request(), $params); |
@@ -170,9 +170,9 @@ class UsernameRssTokenConverterTest extends \PHPUnit_Framework_TestCase | |||
170 | ->with('WallabagUserBundle:User') | 170 | ->with('WallabagUserBundle:User') |
171 | ->will($this->returnValue($em)); | 171 | ->will($this->returnValue($em)); |
172 | 172 | ||
173 | $params = new ParamConverter(array('class' => 'WallabagUserBundle:User')); | 173 | $params = new ParamConverter(['class' => 'WallabagUserBundle:User']); |
174 | $converter = new UsernameRssTokenConverter($registry); | 174 | $converter = new UsernameRssTokenConverter($registry); |
175 | $request = new Request(array(), array(), array('username' => 'test', 'token' => 'test')); | 175 | $request = new Request([], [], ['username' => 'test', 'token' => 'test']); |
176 | 176 | ||
177 | $converter->apply($request, $params); | 177 | $converter->apply($request, $params); |
178 | } | 178 | } |
@@ -208,9 +208,9 @@ class UsernameRssTokenConverterTest extends \PHPUnit_Framework_TestCase | |||
208 | ->with('WallabagUserBundle:User') | 208 | ->with('WallabagUserBundle:User') |
209 | ->will($this->returnValue($em)); | 209 | ->will($this->returnValue($em)); |
210 | 210 | ||
211 | $params = new ParamConverter(array('class' => 'WallabagUserBundle:User', 'name' => 'user')); | 211 | $params = new ParamConverter(['class' => 'WallabagUserBundle:User', 'name' => 'user']); |
212 | $converter = new UsernameRssTokenConverter($registry); | 212 | $converter = new UsernameRssTokenConverter($registry); |
213 | $request = new Request(array(), array(), array('username' => 'test', 'token' => 'test')); | 213 | $request = new Request([], [], ['username' => 'test', 'token' => 'test']); |
214 | 214 | ||
215 | $converter->apply($request, $params); | 215 | $converter->apply($request, $params); |
216 | 216 | ||
diff --git a/src/Wallabag/CoreBundle/Tests/Subscriber/TablePrefixSubscriberTest.php b/src/Wallabag/CoreBundle/Tests/Subscriber/TablePrefixSubscriberTest.php index 49dbb316..e5eafab1 100644 --- a/src/Wallabag/CoreBundle/Tests/Subscriber/TablePrefixSubscriberTest.php +++ b/src/Wallabag/CoreBundle/Tests/Subscriber/TablePrefixSubscriberTest.php | |||
@@ -11,23 +11,23 @@ class TablePrefixSubscriberTest extends \PHPUnit_Framework_TestCase | |||
11 | { | 11 | { |
12 | public function dataForPrefix() | 12 | public function dataForPrefix() |
13 | { | 13 | { |
14 | return array( | 14 | return [ |
15 | array('wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '"wallabag_user"', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()), | 15 | ['wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '"wallabag_user"', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()], |
16 | array('wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '`wallabag_user`', new \Doctrine\DBAL\Platforms\MySqlPlatform()), | 16 | ['wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '`wallabag_user`', new \Doctrine\DBAL\Platforms\MySqlPlatform()], |
17 | array('wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '"wallabag_user"', new \Doctrine\DBAL\Platforms\SqlitePlatform()), | 17 | ['wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '"wallabag_user"', new \Doctrine\DBAL\Platforms\SqlitePlatform()], |
18 | 18 | ||
19 | array('wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()), | 19 | ['wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()], |
20 | array('wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\MySqlPlatform()), | 20 | ['wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\MySqlPlatform()], |
21 | array('wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\SqlitePlatform()), | 21 | ['wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\SqlitePlatform()], |
22 | 22 | ||
23 | array('', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '"user"', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()), | 23 | ['', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '"user"', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()], |
24 | array('', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '`user`', new \Doctrine\DBAL\Platforms\MySqlPlatform()), | 24 | ['', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '`user`', new \Doctrine\DBAL\Platforms\MySqlPlatform()], |
25 | array('', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '"user"', new \Doctrine\DBAL\Platforms\SqlitePlatform()), | 25 | ['', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '"user"', new \Doctrine\DBAL\Platforms\SqlitePlatform()], |
26 | 26 | ||
27 | array('', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()), | 27 | ['', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()], |
28 | array('', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\MySqlPlatform()), | 28 | ['', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\MySqlPlatform()], |
29 | array('', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\SqlitePlatform()), | 29 | ['', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\SqlitePlatform()], |
30 | ); | 30 | ]; |
31 | } | 31 | } |
32 | 32 | ||
33 | /** | 33 | /** |
@@ -42,7 +42,7 @@ class TablePrefixSubscriberTest extends \PHPUnit_Framework_TestCase | |||
42 | $subscriber = new TablePrefixSubscriber($prefix); | 42 | $subscriber = new TablePrefixSubscriber($prefix); |
43 | 43 | ||
44 | $metaClass = new ClassMetadata($entityName); | 44 | $metaClass = new ClassMetadata($entityName); |
45 | $metaClass->setPrimaryTable(array('name' => $tableName)); | 45 | $metaClass->setPrimaryTable(['name' => $tableName]); |
46 | 46 | ||
47 | $metaDataEvent = new LoadClassMetadataEventArgs($metaClass, $em); | 47 | $metaDataEvent = new LoadClassMetadataEventArgs($metaClass, $em); |
48 | 48 | ||
@@ -64,7 +64,7 @@ class TablePrefixSubscriberTest extends \PHPUnit_Framework_TestCase | |||
64 | ->getMock(); | 64 | ->getMock(); |
65 | 65 | ||
66 | $metaClass = new ClassMetadata($entityName); | 66 | $metaClass = new ClassMetadata($entityName); |
67 | $metaClass->setPrimaryTable(array('name' => $tableName)); | 67 | $metaClass->setPrimaryTable(['name' => $tableName]); |
68 | 68 | ||
69 | $metaDataEvent = new LoadClassMetadataEventArgs($metaClass, $em); | 69 | $metaDataEvent = new LoadClassMetadataEventArgs($metaClass, $em); |
70 | 70 | ||
@@ -88,18 +88,18 @@ class TablePrefixSubscriberTest extends \PHPUnit_Framework_TestCase | |||
88 | $subscriber = new TablePrefixSubscriber('yo_'); | 88 | $subscriber = new TablePrefixSubscriber('yo_'); |
89 | 89 | ||
90 | $metaClass = new ClassMetadata('Wallabag\UserBundle\Entity\Entry'); | 90 | $metaClass = new ClassMetadata('Wallabag\UserBundle\Entity\Entry'); |
91 | $metaClass->setPrimaryTable(array('name' => 'entry')); | 91 | $metaClass->setPrimaryTable(['name' => 'entry']); |
92 | $metaClass->mapManyToMany(array( | 92 | $metaClass->mapManyToMany([ |
93 | 'fieldName' => 'tags', | 93 | 'fieldName' => 'tags', |
94 | 'joinTable' => array('name' => null, 'schema' => null), | 94 | 'joinTable' => ['name' => null, 'schema' => null], |
95 | 'targetEntity' => 'Tag', | 95 | 'targetEntity' => 'Tag', |
96 | 'mappedBy' => null, | 96 | 'mappedBy' => null, |
97 | 'inversedBy' => 'entries', | 97 | 'inversedBy' => 'entries', |
98 | 'cascade' => array('persist'), | 98 | 'cascade' => ['persist'], |
99 | 'indexBy' => null, | 99 | 'indexBy' => null, |
100 | 'orphanRemoval' => false, | 100 | 'orphanRemoval' => false, |
101 | 'fetch' => 2, | 101 | 'fetch' => 2, |
102 | )); | 102 | ]); |
103 | 103 | ||
104 | $metaDataEvent = new LoadClassMetadataEventArgs($metaClass, $em); | 104 | $metaDataEvent = new LoadClassMetadataEventArgs($metaClass, $em); |
105 | 105 | ||
diff --git a/src/Wallabag/CoreBundle/Tests/WallabagCoreTestCase.php b/src/Wallabag/CoreBundle/Tests/WallabagCoreTestCase.php index c4905478..05450c0b 100644 --- a/src/Wallabag/CoreBundle/Tests/WallabagCoreTestCase.php +++ b/src/Wallabag/CoreBundle/Tests/WallabagCoreTestCase.php | |||
@@ -24,10 +24,10 @@ abstract class WallabagCoreTestCase extends WebTestCase | |||
24 | { | 24 | { |
25 | $crawler = $this->client->request('GET', '/login'); | 25 | $crawler = $this->client->request('GET', '/login'); |
26 | $form = $crawler->filter('button[type=submit]')->form(); | 26 | $form = $crawler->filter('button[type=submit]')->form(); |
27 | $data = array( | 27 | $data = [ |
28 | '_username' => $username, | 28 | '_username' => $username, |
29 | '_password' => 'mypassword', | 29 | '_password' => 'mypassword', |
30 | ); | 30 | ]; |
31 | 31 | ||
32 | $this->client->submit($form, $data); | 32 | $this->client->submit($form, $data); |
33 | } | 33 | } |