aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests')
-rw-r--r--src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php274
-rw-r--r--src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php350
-rw-r--r--src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php2
-rw-r--r--src/Wallabag/CoreBundle/Tests/Controller/WallabagRestControllerTest.php8
-rw-r--r--src/Wallabag/CoreBundle/Tests/WallabagTestCase.php4
5 files changed, 631 insertions, 7 deletions
diff --git a/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php b/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php
new file mode 100644
index 00000000..64f6c329
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php
@@ -0,0 +1,274 @@
1<?php
2
3namespace Wallabag\CoreBundle\Tests\Command;
4
5use Wallabag\CoreBundle\Tests\WallabagTestCase;
6use Wallabag\CoreBundle\Command\InstallCommand;
7use Symfony\Bundle\FrameworkBundle\Console\Application;
8use Symfony\Component\Console\Tester\CommandTester;
9use Symfony\Component\Console\Input\ArrayInput;
10use Symfony\Component\Console\Output\NullOutput;
11use Doctrine\Bundle\DoctrineBundle\Command\DropDatabaseDoctrineCommand;
12use Doctrine\Bundle\DoctrineBundle\Command\CreateDatabaseDoctrineCommand;
13
14class InstallCommandTest extends WallabagTestCase
15{
16 public static function tearDownAfterClass()
17 {
18 $application = new Application(static::$kernel);
19 $application->setAutoExit(false);
20
21 $code = $application->run(new ArrayInput(array(
22 'command' => 'doctrine:fixtures:load',
23 '--no-interaction' => true,
24 '--env' => 'test',
25 )), new NullOutput());
26 }
27
28 public function testRunInstallCommand()
29 {
30 $this->container = static::$kernel->getContainer();
31
32 $application = new Application(static::$kernel);
33 $application->add(new InstallCommand());
34
35 $command = $application->find('wallabag:install');
36
37 // We mock the DialogHelper
38 $dialog = $this->getMockBuilder('Symfony\Component\Console\Helper\DialogHelper')
39 ->disableOriginalConstructor()
40 ->getMock();
41 $dialog->expects($this->any())
42 ->method('ask')
43 ->will($this->returnValue('test'));
44 $dialog->expects($this->any())
45 ->method('askConfirmation')
46 ->will($this->returnValue(true));
47
48 // We override the standard helper with our mock
49 $command->getHelperSet()->set($dialog, 'dialog');
50
51 $tester = new CommandTester($command);
52 $tester->execute(array(
53 'command' => $command->getName(),
54 ));
55
56 $this->assertContains('Step 1 of 4. Checking system requirements.', $tester->getDisplay());
57 $this->assertContains('Step 2 of 4. Setting up database.', $tester->getDisplay());
58 $this->assertContains('Step 3 of 4. Administration setup.', $tester->getDisplay());
59 $this->assertContains('Step 4 of 4. Installing assets.', $tester->getDisplay());
60 }
61
62 public function testRunInstallCommandWithReset()
63 {
64 $this->container = static::$kernel->getContainer();
65
66 $application = new Application(static::$kernel);
67 $application->add(new InstallCommand());
68
69 $command = $application->find('wallabag:install');
70
71 // We mock the DialogHelper
72 $dialog = $this->getMockBuilder('Symfony\Component\Console\Helper\DialogHelper')
73 ->disableOriginalConstructor()
74 ->getMock();
75 $dialog->expects($this->any())
76 ->method('ask')
77 ->will($this->returnValue('test'));
78 $dialog->expects($this->any())
79 ->method('askConfirmation')
80 ->will($this->returnValue(true));
81
82 // We override the standard helper with our mock
83 $command->getHelperSet()->set($dialog, 'dialog');
84
85 $tester = new CommandTester($command);
86 $tester->execute(array(
87 'command' => $command->getName(),
88 '--reset' => true,
89 ));
90
91 $this->assertContains('Step 1 of 4. Checking system requirements.', $tester->getDisplay());
92 $this->assertContains('Step 2 of 4. Setting up database.', $tester->getDisplay());
93 $this->assertContains('Step 3 of 4. Administration setup.', $tester->getDisplay());
94 $this->assertContains('Step 4 of 4. Installing assets.', $tester->getDisplay());
95
96 // we force to reset everything
97 $this->assertContains('Droping database, creating database and schema', $tester->getDisplay());
98 }
99
100 public function testRunInstallCommandWithDatabaseRemoved()
101 {
102 $this->container = static::$kernel->getContainer();
103
104 $application = new Application(static::$kernel);
105 $application->add(new InstallCommand());
106 $application->add(new DropDatabaseDoctrineCommand());
107
108 // drop database first, so the install command won't ask to reset things
109 $command = new DropDatabaseDoctrineCommand();
110 $command->setApplication($application);
111 $command->run(new ArrayInput(array(
112 'command' => 'doctrine:database:drop',
113 '--force' => true,
114 )), new NullOutput());
115
116 $command = $application->find('wallabag:install');
117
118 // We mock the DialogHelper
119 $dialog = $this->getMockBuilder('Symfony\Component\Console\Helper\DialogHelper')
120 ->disableOriginalConstructor()
121 ->getMock();
122 $dialog->expects($this->any())
123 ->method('ask')
124 ->will($this->returnValue('test'));
125 $dialog->expects($this->any())
126 ->method('askConfirmation')
127 ->will($this->returnValue(true));
128
129 // We override the standard helper with our mock
130 $command->getHelperSet()->set($dialog, 'dialog');
131
132 $tester = new CommandTester($command);
133 $tester->execute(array(
134 'command' => $command->getName(),
135 ));
136
137 $this->assertContains('Step 1 of 4. Checking system requirements.', $tester->getDisplay());
138 $this->assertContains('Step 2 of 4. Setting up database.', $tester->getDisplay());
139 $this->assertContains('Step 3 of 4. Administration setup.', $tester->getDisplay());
140 $this->assertContains('Step 4 of 4. Installing assets.', $tester->getDisplay());
141
142 // the current database doesn't already exist
143 $this->assertContains('Creating database and schema, clearing the cache', $tester->getDisplay());
144 }
145
146 public function testRunInstallCommandChooseResetSchema()
147 {
148 $this->container = static::$kernel->getContainer();
149
150 $application = new Application(static::$kernel);
151 $application->add(new InstallCommand());
152
153 $command = $application->find('wallabag:install');
154
155 // We mock the DialogHelper
156 $dialog = $this->getMockBuilder('Symfony\Component\Console\Helper\DialogHelper')
157 ->disableOriginalConstructor()
158 ->getMock();
159
160 $dialog->expects($this->exactly(3))
161 ->method('askConfirmation')
162 ->will($this->onConsecutiveCalls(
163 false, // don't want to reset the entire database
164 true, // do want to reset the schema
165 false // don't want to create a new user
166 ));
167
168 // We override the standard helper with our mock
169 $command->getHelperSet()->set($dialog, 'dialog');
170
171 $tester = new CommandTester($command);
172 $tester->execute(array(
173 'command' => $command->getName(),
174 ));
175
176 $this->assertContains('Step 1 of 4. Checking system requirements.', $tester->getDisplay());
177 $this->assertContains('Step 2 of 4. Setting up database.', $tester->getDisplay());
178 $this->assertContains('Step 3 of 4. Administration setup.', $tester->getDisplay());
179 $this->assertContains('Step 4 of 4. Installing assets.', $tester->getDisplay());
180
181 $this->assertContains('Droping schema and creating schema', $tester->getDisplay());
182 }
183
184 public function testRunInstallCommandChooseNothing()
185 {
186 $this->container = static::$kernel->getContainer();
187
188 $application = new Application(static::$kernel);
189 $application->add(new InstallCommand());
190 $application->add(new DropDatabaseDoctrineCommand());
191 $application->add(new CreateDatabaseDoctrineCommand());
192
193 // drop database first, so the install command won't ask to reset things
194 $command = new DropDatabaseDoctrineCommand();
195 $command->setApplication($application);
196 $command->run(new ArrayInput(array(
197 'command' => 'doctrine:database:drop',
198 '--force' => true,
199 )), new NullOutput());
200
201 $this->container->get('doctrine')->getManager()->getConnection()->close();
202
203 $command = new CreateDatabaseDoctrineCommand();
204 $command->setApplication($application);
205 $command->run(new ArrayInput(array(
206 'command' => 'doctrine:database:create',
207 '--env' => 'test',
208 )), new NullOutput());
209
210 $command = $application->find('wallabag:install');
211
212 // We mock the DialogHelper
213 $dialog = $this->getMockBuilder('Symfony\Component\Console\Helper\DialogHelper')
214 ->disableOriginalConstructor()
215 ->getMock();
216
217 $dialog->expects($this->exactly(2))
218 ->method('askConfirmation')
219 ->will($this->onConsecutiveCalls(
220 false, // don't want to reset the entire database
221 false // don't want to create a new user
222 ));
223
224 // We override the standard helper with our mock
225 $command->getHelperSet()->set($dialog, 'dialog');
226
227 $tester = new CommandTester($command);
228 $tester->execute(array(
229 'command' => $command->getName(),
230 ));
231
232 $this->assertContains('Step 1 of 4. Checking system requirements.', $tester->getDisplay());
233 $this->assertContains('Step 2 of 4. Setting up database.', $tester->getDisplay());
234 $this->assertContains('Step 3 of 4. Administration setup.', $tester->getDisplay());
235 $this->assertContains('Step 4 of 4. Installing assets.', $tester->getDisplay());
236
237 $this->assertContains('Creating schema', $tester->getDisplay());
238 }
239
240 public function testRunInstallCommandNoInteraction()
241 {
242 $this->container = static::$kernel->getContainer();
243
244 $application = new Application(static::$kernel);
245 $application->add(new InstallCommand());
246
247 $command = $application->find('wallabag:install');
248
249 // We mock the DialogHelper
250 $dialog = $this->getMockBuilder('Symfony\Component\Console\Helper\DialogHelper')
251 ->disableOriginalConstructor()
252 ->getMock();
253 $dialog->expects($this->any())
254 ->method('ask')
255 ->will($this->returnValue('test'));
256 $dialog->expects($this->any())
257 ->method('askConfirmation')
258 ->will($this->returnValue(true));
259
260 // We override the standard helper with our mock
261 $command->getHelperSet()->set($dialog, 'dialog');
262
263 $tester = new CommandTester($command);
264 $tester->execute(array(
265 'command' => $command->getName(),
266 '--no-interaction' => true,
267 ));
268
269 $this->assertContains('Step 1 of 4. Checking system requirements.', $tester->getDisplay());
270 $this->assertContains('Step 2 of 4. Setting up database.', $tester->getDisplay());
271 $this->assertContains('Step 3 of 4. Administration setup.', $tester->getDisplay());
272 $this->assertContains('Step 4 of 4. Installing assets.', $tester->getDisplay());
273 }
274}
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php
new file mode 100644
index 00000000..9b1a0986
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php
@@ -0,0 +1,350 @@
1<?php
2
3namespace Wallabag\CoreBundle\Tests\Controller;
4
5use Wallabag\CoreBundle\Tests\WallabagTestCase;
6
7class ConfigControllerTest extends WallabagTestCase
8{
9 public function testLogin()
10 {
11 $client = $this->getClient();
12
13 $client->request('GET', '/new');
14
15 $this->assertEquals(302, $client->getResponse()->getStatusCode());
16 $this->assertContains('login', $client->getResponse()->headers->get('location'));
17 }
18
19 public function testIndex()
20 {
21 $this->logInAs('admin');
22 $client = $this->getClient();
23
24 $crawler = $client->request('GET', '/config');
25
26 $this->assertEquals(200, $client->getResponse()->getStatusCode());
27
28 $this->assertCount(1, $crawler->filter('button[id=config_save]'));
29 $this->assertCount(1, $crawler->filter('button[id=change_passwd_save]'));
30 $this->assertCount(1, $crawler->filter('button[id=user_save]'));
31 }
32
33 public function testUpdate()
34 {
35 $this->logInAs('admin');
36 $client = $this->getClient();
37
38 $crawler = $client->request('GET', '/config');
39
40 $this->assertEquals(200, $client->getResponse()->getStatusCode());
41
42 $form = $crawler->filter('button[id=config_save]')->form();
43
44 $data = array(
45 'config[theme]' => 'baggy',
46 'config[items_per_page]' => '30',
47 'config[language]' => 'fr_FR',
48 );
49
50 $client->submit($form, $data);
51
52 $this->assertEquals(302, $client->getResponse()->getStatusCode());
53
54 $crawler = $client->followRedirect();
55
56 $this->assertGreaterThan(1, $alert = $crawler->filter('div.flash-notice')->extract(array('_text')));
57 $this->assertContains('Config saved', $alert[0]);
58 }
59
60 public function dataForUpdateFailed()
61 {
62 return array(
63 array(array(
64 'config[theme]' => 'baggy',
65 'config[items_per_page]' => '',
66 'config[language]' => 'fr_FR',
67 )),
68 array(array(
69 'config[theme]' => 'baggy',
70 'config[items_per_page]' => '12',
71 'config[language]' => '',
72 )),
73 );
74 }
75
76 /**
77 * @dataProvider dataForUpdateFailed
78 */
79 public function testUpdateFailed($data)
80 {
81 $this->logInAs('admin');
82 $client = $this->getClient();
83
84 $crawler = $client->request('GET', '/config');
85
86 $this->assertEquals(200, $client->getResponse()->getStatusCode());
87
88 $form = $crawler->filter('button[id=config_save]')->form();
89
90 $crawler = $client->submit($form, $data);
91
92 $this->assertEquals(200, $client->getResponse()->getStatusCode());
93
94 $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(array('_text')));
95 $this->assertContains('This value should not be blank', $alert[0]);
96 }
97
98 public function dataForChangePasswordFailed()
99 {
100 return array(
101 array(
102 array(
103 'change_passwd[old_password]' => 'baggy',
104 'change_passwd[new_password][first]' => '',
105 'change_passwd[new_password][second]' => '',
106 ),
107 'Wrong value for your current password',
108 ),
109 array(
110 array(
111 'change_passwd[old_password]' => 'mypassword',
112 'change_passwd[new_password][first]' => '',
113 'change_passwd[new_password][second]' => '',
114 ),
115 'This value should not be blank',
116 ),
117 array(
118 array(
119 'change_passwd[old_password]' => 'mypassword',
120 'change_passwd[new_password][first]' => 'hop',
121 'change_passwd[new_password][second]' => '',
122 ),
123 'The password fields must match',
124 ),
125 array(
126 array(
127 'change_passwd[old_password]' => 'mypassword',
128 'change_passwd[new_password][first]' => 'hop',
129 'change_passwd[new_password][second]' => 'hop',
130 ),
131 'Password should by at least',
132 ),
133 );
134 }
135
136 /**
137 * @dataProvider dataForChangePasswordFailed
138 */
139 public function testChangePasswordFailed($data, $expectedMessage)
140 {
141 $this->logInAs('admin');
142 $client = $this->getClient();
143
144 $crawler = $client->request('GET', '/config');
145
146 $this->assertEquals(200, $client->getResponse()->getStatusCode());
147
148 $form = $crawler->filter('button[id=change_passwd_save]')->form();
149
150 $crawler = $client->submit($form, $data);
151
152 $this->assertEquals(200, $client->getResponse()->getStatusCode());
153
154 $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(array('_text')));
155 $this->assertContains($expectedMessage, $alert[0]);
156 }
157
158 public function testChangePassword()
159 {
160 $this->logInAs('admin');
161 $client = $this->getClient();
162
163 $crawler = $client->request('GET', '/config');
164
165 $this->assertEquals(200, $client->getResponse()->getStatusCode());
166
167 $form = $crawler->filter('button[id=change_passwd_save]')->form();
168
169 $data = array(
170 'change_passwd[old_password]' => 'mypassword',
171 'change_passwd[new_password][first]' => 'mypassword',
172 'change_passwd[new_password][second]' => 'mypassword',
173 );
174
175 $client->submit($form, $data);
176
177 $this->assertEquals(302, $client->getResponse()->getStatusCode());
178
179 $crawler = $client->followRedirect();
180
181 $this->assertGreaterThan(1, $alert = $crawler->filter('div.flash-notice')->extract(array('_text')));
182 $this->assertContains('Password updated', $alert[0]);
183 }
184
185 public function dataForUserFailed()
186 {
187 return array(
188 array(
189 array(
190 'user[username]' => '',
191 'user[name]' => '',
192 'user[email]' => '',
193 ),
194 'This value should not be blank.',
195 ),
196 array(
197 array(
198 'user[username]' => 'ad',
199 'user[name]' => '',
200 'user[email]' => '',
201 ),
202 'This value is too short.',
203 ),
204 array(
205 array(
206 'user[username]' => 'admin',
207 'user[name]' => '',
208 'user[email]' => 'test',
209 ),
210 'This value is not a valid email address.',
211 ),
212 );
213 }
214
215 /**
216 * @dataProvider dataForUserFailed
217 */
218 public function testUserFailed($data, $expectedMessage)
219 {
220 $this->logInAs('admin');
221 $client = $this->getClient();
222
223 $crawler = $client->request('GET', '/config');
224
225 $this->assertEquals(200, $client->getResponse()->getStatusCode());
226
227 $form = $crawler->filter('button[id=user_save]')->form();
228
229 $crawler = $client->submit($form, $data);
230
231 $this->assertEquals(200, $client->getResponse()->getStatusCode());
232
233 $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(array('_text')));
234 $this->assertContains($expectedMessage, $alert[0]);
235 }
236
237 public function testUserUpdate()
238 {
239 $this->logInAs('admin');
240 $client = $this->getClient();
241
242 $crawler = $client->request('GET', '/config');
243
244 $this->assertEquals(200, $client->getResponse()->getStatusCode());
245
246 $form = $crawler->filter('button[id=user_save]')->form();
247
248 $data = array(
249 'user[username]' => 'admin',
250 'user[name]' => 'new name',
251 'user[email]' => 'admin@wallabag.io',
252 );
253
254 $client->submit($form, $data);
255
256 $this->assertEquals(302, $client->getResponse()->getStatusCode());
257
258 $crawler = $client->followRedirect();
259
260 $this->assertGreaterThan(1, $alert = $crawler->filter('div.flash-notice')->extract(array('_text')));
261 $this->assertContains('Information updated', $alert[0]);
262 }
263
264 public function dataForNewUserFailed()
265 {
266 return array(
267 array(
268 array(
269 'new_user[username]' => '',
270 'new_user[password]' => '',
271 'new_user[email]' => '',
272 ),
273 'This value should not be blank.',
274 ),
275 array(
276 array(
277 'new_user[username]' => 'ad',
278 'new_user[password]' => '',
279 'new_user[email]' => '',
280 ),
281 'This value is too short.',
282 ),
283 array(
284 array(
285 'new_user[username]' => 'wallace',
286 'new_user[password]' => '',
287 'new_user[email]' => 'test',
288 ),
289 'This value is not a valid email address.',
290 ),
291 array(
292 array(
293 'new_user[username]' => 'wallace',
294 'new_user[password]' => 'admin',
295 'new_user[email]' => 'wallace@wallace.me',
296 ),
297 'Password should by at least',
298 ),
299 );
300 }
301
302 /**
303 * @dataProvider dataForNewUserFailed
304 */
305 public function testNewUserFailed($data, $expectedMessage)
306 {
307 $this->logInAs('admin');
308 $client = $this->getClient();
309
310 $crawler = $client->request('GET', '/config');
311
312 $this->assertEquals(200, $client->getResponse()->getStatusCode());
313
314 $form = $crawler->filter('button[id=new_user_save]')->form();
315
316 $crawler = $client->submit($form, $data);
317
318 $this->assertEquals(200, $client->getResponse()->getStatusCode());
319
320 $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(array('_text')));
321 $this->assertContains($expectedMessage, $alert[0]);
322 }
323
324 public function testNewUserCreated()
325 {
326 $this->logInAs('admin');
327 $client = $this->getClient();
328
329 $crawler = $client->request('GET', '/config');
330
331 $this->assertEquals(200, $client->getResponse()->getStatusCode());
332
333 $form = $crawler->filter('button[id=new_user_save]')->form();
334
335 $data = array(
336 'new_user[username]' => 'wallace',
337 'new_user[password]' => 'wallace1',
338 'new_user[email]' => 'wallace@wallace.me',
339 );
340
341 $client->submit($form, $data);
342
343 $this->assertEquals(302, $client->getResponse()->getStatusCode());
344
345 $crawler = $client->followRedirect();
346
347 $this->assertGreaterThan(1, $alert = $crawler->filter('div.flash-notice')->extract(array('_text')));
348 $this->assertContains('User "wallace" added', $alert[0]);
349 }
350}
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
index 7276f8e4..2634141e 100644
--- a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
@@ -60,7 +60,7 @@ class EntryControllerTest extends WallabagTestCase
60 $form = $crawler->filter('button[type=submit]')->form(); 60 $form = $crawler->filter('button[type=submit]')->form();
61 61
62 $data = array( 62 $data = array(
63 'form[url]' => 'https://www.mailjet.com/blog/mailjet-zapier-integrations-made-easy/', 63 'entry[url]' => 'https://www.mailjet.com/blog/mailjet-zapier-integrations-made-easy/',
64 ); 64 );
65 65
66 $client->submit($form, $data); 66 $client->submit($form, $data);
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/WallabagRestControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/WallabagRestControllerTest.php
index d77e2303..fcfa8ccf 100644
--- a/src/Wallabag/CoreBundle/Tests/Controller/WallabagRestControllerTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Controller/WallabagRestControllerTest.php
@@ -47,7 +47,7 @@ class WallabagRestControllerTest extends WallabagTestCase
47 $client->request('GET', '/api/salts/admin.json'); 47 $client->request('GET', '/api/salts/admin.json');
48 $salt = json_decode($client->getResponse()->getContent()); 48 $salt = json_decode($client->getResponse()->getContent());
49 49
50 $headers = $this->generateHeaders('admin', 'test', $salt[0]); 50 $headers = $this->generateHeaders('admin', 'mypassword', $salt[0]);
51 51
52 $entry = $client->getContainer() 52 $entry = $client->getContainer()
53 ->get('doctrine.orm.entity_manager') 53 ->get('doctrine.orm.entity_manager')
@@ -73,7 +73,7 @@ class WallabagRestControllerTest extends WallabagTestCase
73 $client->request('GET', '/api/salts/admin.json'); 73 $client->request('GET', '/api/salts/admin.json');
74 $salt = json_decode($client->getResponse()->getContent()); 74 $salt = json_decode($client->getResponse()->getContent());
75 75
76 $headers = $this->generateHeaders('admin', 'test', $salt[0]); 76 $headers = $this->generateHeaders('admin', 'mypassword', $salt[0]);
77 77
78 $entry = $client->getContainer() 78 $entry = $client->getContainer()
79 ->get('doctrine.orm.entity_manager') 79 ->get('doctrine.orm.entity_manager')
@@ -101,7 +101,7 @@ class WallabagRestControllerTest extends WallabagTestCase
101 $client->request('GET', '/api/salts/admin.json'); 101 $client->request('GET', '/api/salts/admin.json');
102 $salt = json_decode($client->getResponse()->getContent()); 102 $salt = json_decode($client->getResponse()->getContent());
103 103
104 $headers = $this->generateHeaders('admin', 'test', $salt[0]); 104 $headers = $this->generateHeaders('admin', 'mypassword', $salt[0]);
105 105
106 $client->request('GET', '/api/entries', array(), array(), $headers); 106 $client->request('GET', '/api/entries', array(), array(), $headers);
107 107
@@ -125,7 +125,7 @@ class WallabagRestControllerTest extends WallabagTestCase
125 $client->request('GET', '/api/salts/admin.json'); 125 $client->request('GET', '/api/salts/admin.json');
126 $salt = json_decode($client->getResponse()->getContent()); 126 $salt = json_decode($client->getResponse()->getContent());
127 127
128 $headers = $this->generateHeaders('admin', 'test', $salt[0]); 128 $headers = $this->generateHeaders('admin', 'mypassword', $salt[0]);
129 129
130 $entry = $client->getContainer() 130 $entry = $client->getContainer()
131 ->get('doctrine.orm.entity_manager') 131 ->get('doctrine.orm.entity_manager')
diff --git a/src/Wallabag/CoreBundle/Tests/WallabagTestCase.php b/src/Wallabag/CoreBundle/Tests/WallabagTestCase.php
index a80b8bac..22016d8e 100644
--- a/src/Wallabag/CoreBundle/Tests/WallabagTestCase.php
+++ b/src/Wallabag/CoreBundle/Tests/WallabagTestCase.php
@@ -4,7 +4,7 @@ namespace Wallabag\CoreBundle\Tests;
4 4
5use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; 5use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
6 6
7class WallabagTestCase extends WebTestCase 7abstract class WallabagTestCase extends WebTestCase
8{ 8{
9 private $client = null; 9 private $client = null;
10 10
@@ -24,7 +24,7 @@ class WallabagTestCase extends WebTestCase
24 $form = $crawler->filter('button[type=submit]')->form(); 24 $form = $crawler->filter('button[type=submit]')->form();
25 $data = array( 25 $data = array(
26 '_username' => $username, 26 '_username' => $username,
27 '_password' => 'test', 27 '_password' => 'mypassword',
28 ); 28 );
29 29
30 $this->client->submit($form, $data); 30 $this->client->submit($form, $data);