diff options
author | Jérémy Benoist <j0k3r@users.noreply.github.com> | 2017-07-03 13:39:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-03 13:39:54 +0200 |
commit | 71e1cbc8eb5928d393b0772055d6b711e90a09b3 (patch) | |
tree | 71795eadcf13fda9198b8cd9a3da26d51826bbd9 /tests/Wallabag/CoreBundle | |
parent | 822c877949aff8ae57677671115f8f4fc69588d5 (diff) | |
parent | 38520658addc217f127b0627ea28dcf8d6e6178c (diff) | |
download | wallabag-71e1cbc8eb5928d393b0772055d6b711e90a09b3.tar.gz wallabag-71e1cbc8eb5928d393b0772055d6b711e90a09b3.tar.zst wallabag-71e1cbc8eb5928d393b0772055d6b711e90a09b3.zip |
Merge pull request #3258 from wallabag/cs-fixer
Add a real configuration for CS-Fixer
Diffstat (limited to 'tests/Wallabag/CoreBundle')
26 files changed, 463 insertions, 468 deletions
diff --git a/tests/Wallabag/CoreBundle/Command/CleanDuplicatesCommandTest.php b/tests/Wallabag/CoreBundle/Command/CleanDuplicatesCommandTest.php index e6e57f30..38e8dd07 100644 --- a/tests/Wallabag/CoreBundle/Command/CleanDuplicatesCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/CleanDuplicatesCommandTest.php | |||
@@ -4,8 +4,8 @@ namespace Tests\Wallabag\CoreBundle\Command; | |||
4 | 4 | ||
5 | use Symfony\Bundle\FrameworkBundle\Console\Application; | 5 | use Symfony\Bundle\FrameworkBundle\Console\Application; |
6 | use Symfony\Component\Console\Tester\CommandTester; | 6 | use Symfony\Component\Console\Tester\CommandTester; |
7 | use Wallabag\CoreBundle\Command\CleanDuplicatesCommand; | ||
8 | use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; | 7 | use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; |
8 | use Wallabag\CoreBundle\Command\CleanDuplicatesCommand; | ||
9 | use Wallabag\CoreBundle\Entity\Entry; | 9 | use Wallabag\CoreBundle\Entity\Entry; |
10 | 10 | ||
11 | class CleanDuplicatesCommandTest extends WallabagCoreTestCase | 11 | class CleanDuplicatesCommandTest extends WallabagCoreTestCase |
diff --git a/tests/Wallabag/CoreBundle/Command/ExportCommandTest.php b/tests/Wallabag/CoreBundle/Command/ExportCommandTest.php index 2eebf39b..25de2730 100644 --- a/tests/Wallabag/CoreBundle/Command/ExportCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/ExportCommandTest.php | |||
@@ -4,8 +4,8 @@ namespace Tests\Wallabag\CoreBundle\Command; | |||
4 | 4 | ||
5 | use Symfony\Bundle\FrameworkBundle\Console\Application; | 5 | use Symfony\Bundle\FrameworkBundle\Console\Application; |
6 | use Symfony\Component\Console\Tester\CommandTester; | 6 | use Symfony\Component\Console\Tester\CommandTester; |
7 | use Wallabag\CoreBundle\Command\ExportCommand; | ||
8 | use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; | 7 | use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; |
8 | use Wallabag\CoreBundle\Command\ExportCommand; | ||
9 | 9 | ||
10 | class ExportCommandTest extends WallabagCoreTestCase | 10 | class ExportCommandTest extends WallabagCoreTestCase |
11 | { | 11 | { |
diff --git a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php index 94fc0b94..f684a206 100644 --- a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php | |||
@@ -11,9 +11,9 @@ use Symfony\Bundle\FrameworkBundle\Console\Application; | |||
11 | use Symfony\Component\Console\Input\ArrayInput; | 11 | use Symfony\Component\Console\Input\ArrayInput; |
12 | use Symfony\Component\Console\Output\NullOutput; | 12 | use Symfony\Component\Console\Output\NullOutput; |
13 | use Symfony\Component\Console\Tester\CommandTester; | 13 | use Symfony\Component\Console\Tester\CommandTester; |
14 | use Wallabag\CoreBundle\Command\InstallCommand; | ||
15 | use Tests\Wallabag\CoreBundle\Mock\InstallCommandMock; | 14 | use Tests\Wallabag\CoreBundle\Mock\InstallCommandMock; |
16 | use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; | 15 | use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; |
16 | use Wallabag\CoreBundle\Command\InstallCommand; | ||
17 | 17 | ||
18 | class InstallCommandTest extends WallabagCoreTestCase | 18 | class InstallCommandTest extends WallabagCoreTestCase |
19 | { | 19 | { |
@@ -86,9 +86,9 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
86 | $tester->setInputs([ | 86 | $tester->setInputs([ |
87 | 'y', // dropping database | 87 | 'y', // dropping database |
88 | 'y', // create super admin | 88 | 'y', // create super admin |
89 | 'username_'.uniqid('', true), // username | 89 | 'username_' . uniqid('', true), // username |
90 | 'password_'.uniqid('', true), // password | 90 | 'password_' . uniqid('', true), // password |
91 | 'email_'.uniqid('', true).'@wallabag.it', // email | 91 | 'email_' . uniqid('', true) . '@wallabag.it', // email |
92 | ]); | 92 | ]); |
93 | $tester->execute([ | 93 | $tester->execute([ |
94 | 'command' => $command->getName(), | 94 | 'command' => $command->getName(), |
@@ -111,9 +111,9 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
111 | $tester = new CommandTester($command); | 111 | $tester = new CommandTester($command); |
112 | $tester->setInputs([ | 112 | $tester->setInputs([ |
113 | 'y', // create super admin | 113 | 'y', // create super admin |
114 | 'username_'.uniqid('', true), // username | 114 | 'username_' . uniqid('', true), // username |
115 | 'password_'.uniqid('', true), // password | 115 | 'password_' . uniqid('', true), // password |
116 | 'email_'.uniqid('', true).'@wallabag.it', // email | 116 | 'email_' . uniqid('', true) . '@wallabag.it', // email |
117 | ]); | 117 | ]); |
118 | $tester->execute([ | 118 | $tester->execute([ |
119 | 'command' => $command->getName(), | 119 | 'command' => $command->getName(), |
@@ -159,9 +159,9 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
159 | $tester = new CommandTester($command); | 159 | $tester = new CommandTester($command); |
160 | $tester->setInputs([ | 160 | $tester->setInputs([ |
161 | 'y', // create super admin | 161 | 'y', // create super admin |
162 | 'username_'.uniqid('', true), // username | 162 | 'username_' . uniqid('', true), // username |
163 | 'password_'.uniqid('', true), // password | 163 | 'password_' . uniqid('', true), // password |
164 | 'email_'.uniqid('', true).'@wallabag.it', // email | 164 | 'email_' . uniqid('', true) . '@wallabag.it', // email |
165 | ]); | 165 | ]); |
166 | $tester->execute([ | 166 | $tester->execute([ |
167 | 'command' => $command->getName(), | 167 | 'command' => $command->getName(), |
diff --git a/tests/Wallabag/CoreBundle/Command/TagAllCommandTest.php b/tests/Wallabag/CoreBundle/Command/TagAllCommandTest.php index 4cde3679..96d0e91f 100644 --- a/tests/Wallabag/CoreBundle/Command/TagAllCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/TagAllCommandTest.php | |||
@@ -4,8 +4,8 @@ namespace Tests\Wallabag\CoreBundle\Command; | |||
4 | 4 | ||
5 | use Symfony\Bundle\FrameworkBundle\Console\Application; | 5 | use Symfony\Bundle\FrameworkBundle\Console\Application; |
6 | use Symfony\Component\Console\Tester\CommandTester; | 6 | use Symfony\Component\Console\Tester\CommandTester; |
7 | use Wallabag\CoreBundle\Command\TagAllCommand; | ||
8 | use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; | 7 | use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; |
8 | use Wallabag\CoreBundle\Command\TagAllCommand; | ||
9 | 9 | ||
10 | class TagAllCommandTest extends WallabagCoreTestCase | 10 | class TagAllCommandTest extends WallabagCoreTestCase |
11 | { | 11 | { |
diff --git a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php index 5bc815ee..e4bf0998 100644 --- a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php | |||
@@ -3,11 +3,11 @@ | |||
3 | namespace tests\Wallabag\CoreBundle\Controller; | 3 | namespace tests\Wallabag\CoreBundle\Controller; |
4 | 4 | ||
5 | use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; | 5 | use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; |
6 | use Wallabag\AnnotationBundle\Entity\Annotation; | ||
6 | use Wallabag\CoreBundle\Entity\Config; | 7 | use Wallabag\CoreBundle\Entity\Config; |
7 | use Wallabag\UserBundle\Entity\User; | ||
8 | use Wallabag\CoreBundle\Entity\Entry; | 8 | use Wallabag\CoreBundle\Entity\Entry; |
9 | use Wallabag\CoreBundle\Entity\Tag; | 9 | use Wallabag\CoreBundle\Entity\Tag; |
10 | use Wallabag\AnnotationBundle\Entity\Annotation; | 10 | use Wallabag\UserBundle\Entity\User; |
11 | 11 | ||
12 | class ConfigControllerTest extends WallabagCoreTestCase | 12 | class ConfigControllerTest extends WallabagCoreTestCase |
13 | { | 13 | { |
@@ -17,7 +17,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
17 | 17 | ||
18 | $client->request('GET', '/new'); | 18 | $client->request('GET', '/new'); |
19 | 19 | ||
20 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 20 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
21 | $this->assertContains('login', $client->getResponse()->headers->get('location')); | 21 | $this->assertContains('login', $client->getResponse()->headers->get('location')); |
22 | } | 22 | } |
23 | 23 | ||
@@ -28,7 +28,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
28 | 28 | ||
29 | $crawler = $client->request('GET', '/config'); | 29 | $crawler = $client->request('GET', '/config'); |
30 | 30 | ||
31 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 31 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
32 | 32 | ||
33 | $this->assertCount(1, $crawler->filter('button[id=config_save]')); | 33 | $this->assertCount(1, $crawler->filter('button[id=config_save]')); |
34 | $this->assertCount(1, $crawler->filter('button[id=change_passwd_save]')); | 34 | $this->assertCount(1, $crawler->filter('button[id=change_passwd_save]')); |
@@ -43,7 +43,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
43 | 43 | ||
44 | $crawler = $client->request('GET', '/config'); | 44 | $crawler = $client->request('GET', '/config'); |
45 | 45 | ||
46 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 46 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
47 | 47 | ||
48 | $form = $crawler->filter('button[id=config_save]')->form(); | 48 | $form = $crawler->filter('button[id=config_save]')->form(); |
49 | 49 | ||
@@ -57,7 +57,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
57 | 57 | ||
58 | $client->submit($form, $data); | 58 | $client->submit($form, $data); |
59 | 59 | ||
60 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 60 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
61 | 61 | ||
62 | $crawler = $client->followRedirect(); | 62 | $crawler = $client->followRedirect(); |
63 | 63 | ||
@@ -131,13 +131,13 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
131 | 131 | ||
132 | $crawler = $client->request('GET', '/config'); | 132 | $crawler = $client->request('GET', '/config'); |
133 | 133 | ||
134 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 134 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
135 | 135 | ||
136 | $form = $crawler->filter('button[id=config_save]')->form(); | 136 | $form = $crawler->filter('button[id=config_save]')->form(); |
137 | 137 | ||
138 | $crawler = $client->submit($form, $data); | 138 | $crawler = $client->submit($form, $data); |
139 | 139 | ||
140 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 140 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
141 | 141 | ||
142 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text'])); | 142 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text'])); |
143 | $this->assertContains('This value should not be blank', $alert[0]); | 143 | $this->assertContains('This value should not be blank', $alert[0]); |
@@ -191,13 +191,13 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
191 | 191 | ||
192 | $crawler = $client->request('GET', '/config'); | 192 | $crawler = $client->request('GET', '/config'); |
193 | 193 | ||
194 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 194 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
195 | 195 | ||
196 | $form = $crawler->filter('button[id=change_passwd_save]')->form(); | 196 | $form = $crawler->filter('button[id=change_passwd_save]')->form(); |
197 | 197 | ||
198 | $crawler = $client->submit($form, $data); | 198 | $crawler = $client->submit($form, $data); |
199 | 199 | ||
200 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 200 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
201 | 201 | ||
202 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text'])); | 202 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text'])); |
203 | $this->assertContains($expectedMessage, $alert[0]); | 203 | $this->assertContains($expectedMessage, $alert[0]); |
@@ -210,7 +210,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
210 | 210 | ||
211 | $crawler = $client->request('GET', '/config'); | 211 | $crawler = $client->request('GET', '/config'); |
212 | 212 | ||
213 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 213 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
214 | 214 | ||
215 | $form = $crawler->filter('button[id=change_passwd_save]')->form(); | 215 | $form = $crawler->filter('button[id=change_passwd_save]')->form(); |
216 | 216 | ||
@@ -222,7 +222,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
222 | 222 | ||
223 | $client->submit($form, $data); | 223 | $client->submit($form, $data); |
224 | 224 | ||
225 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 225 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
226 | 226 | ||
227 | $crawler = $client->followRedirect(); | 227 | $crawler = $client->followRedirect(); |
228 | 228 | ||
@@ -259,13 +259,13 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
259 | 259 | ||
260 | $crawler = $client->request('GET', '/config'); | 260 | $crawler = $client->request('GET', '/config'); |
261 | 261 | ||
262 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 262 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
263 | 263 | ||
264 | $form = $crawler->filter('button[id=update_user_save]')->form(); | 264 | $form = $crawler->filter('button[id=update_user_save]')->form(); |
265 | 265 | ||
266 | $crawler = $client->submit($form, $data); | 266 | $crawler = $client->submit($form, $data); |
267 | 267 | ||
268 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 268 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
269 | 269 | ||
270 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text'])); | 270 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text'])); |
271 | $this->assertContains($expectedMessage, $alert[0]); | 271 | $this->assertContains($expectedMessage, $alert[0]); |
@@ -278,7 +278,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
278 | 278 | ||
279 | $crawler = $client->request('GET', '/config'); | 279 | $crawler = $client->request('GET', '/config'); |
280 | 280 | ||
281 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 281 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
282 | 282 | ||
283 | $form = $crawler->filter('button[id=update_user_save]')->form(); | 283 | $form = $crawler->filter('button[id=update_user_save]')->form(); |
284 | 284 | ||
@@ -289,7 +289,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
289 | 289 | ||
290 | $client->submit($form, $data); | 290 | $client->submit($form, $data); |
291 | 291 | ||
292 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 292 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
293 | 293 | ||
294 | $crawler = $client->followRedirect(); | 294 | $crawler = $client->followRedirect(); |
295 | 295 | ||
@@ -319,13 +319,13 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
319 | 319 | ||
320 | $crawler = $client->request('GET', '/config'); | 320 | $crawler = $client->request('GET', '/config'); |
321 | 321 | ||
322 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 322 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
323 | 323 | ||
324 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); | 324 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); |
325 | $this->assertContains('config.form_rss.no_token', $body[0]); | 325 | $this->assertContains('config.form_rss.no_token', $body[0]); |
326 | 326 | ||
327 | $client->request('GET', '/generate-token'); | 327 | $client->request('GET', '/generate-token'); |
328 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 328 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
329 | 329 | ||
330 | $crawler = $client->followRedirect(); | 330 | $crawler = $client->followRedirect(); |
331 | 331 | ||
@@ -346,7 +346,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
346 | ['HTTP_X-Requested-With' => 'XMLHttpRequest'] | 346 | ['HTTP_X-Requested-With' => 'XMLHttpRequest'] |
347 | ); | 347 | ); |
348 | 348 | ||
349 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 349 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
350 | $content = json_decode($client->getResponse()->getContent(), true); | 350 | $content = json_decode($client->getResponse()->getContent(), true); |
351 | $this->assertArrayHasKey('token', $content); | 351 | $this->assertArrayHasKey('token', $content); |
352 | } | 352 | } |
@@ -358,7 +358,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
358 | 358 | ||
359 | $crawler = $client->request('GET', '/config'); | 359 | $crawler = $client->request('GET', '/config'); |
360 | 360 | ||
361 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 361 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
362 | 362 | ||
363 | $form = $crawler->filter('button[id=rss_config_save]')->form(); | 363 | $form = $crawler->filter('button[id=rss_config_save]')->form(); |
364 | 364 | ||
@@ -368,7 +368,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
368 | 368 | ||
369 | $client->submit($form, $data); | 369 | $client->submit($form, $data); |
370 | 370 | ||
371 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 371 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
372 | 372 | ||
373 | $crawler = $client->followRedirect(); | 373 | $crawler = $client->followRedirect(); |
374 | 374 | ||
@@ -403,13 +403,13 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
403 | 403 | ||
404 | $crawler = $client->request('GET', '/config'); | 404 | $crawler = $client->request('GET', '/config'); |
405 | 405 | ||
406 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 406 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
407 | 407 | ||
408 | $form = $crawler->filter('button[id=rss_config_save]')->form(); | 408 | $form = $crawler->filter('button[id=rss_config_save]')->form(); |
409 | 409 | ||
410 | $crawler = $client->submit($form, $data); | 410 | $crawler = $client->submit($form, $data); |
411 | 411 | ||
412 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 412 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
413 | 413 | ||
414 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text'])); | 414 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text'])); |
415 | $this->assertContains($expectedMessage, $alert[0]); | 415 | $this->assertContains($expectedMessage, $alert[0]); |
@@ -423,7 +423,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
423 | 423 | ||
424 | $crawler = $client->request('GET', '/config'); | 424 | $crawler = $client->request('GET', '/config'); |
425 | 425 | ||
426 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 426 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
427 | 427 | ||
428 | $form = $crawler->filter('button[id=tagging_rule_save]')->form(); | 428 | $form = $crawler->filter('button[id=tagging_rule_save]')->form(); |
429 | 429 | ||
@@ -434,7 +434,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
434 | 434 | ||
435 | $client->submit($form, $data); | 435 | $client->submit($form, $data); |
436 | 436 | ||
437 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 437 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
438 | 438 | ||
439 | $crawler = $client->followRedirect(); | 439 | $crawler = $client->followRedirect(); |
440 | 440 | ||
@@ -443,7 +443,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
443 | $editLink = $crawler->filter('.mode_edit')->last()->link(); | 443 | $editLink = $crawler->filter('.mode_edit')->last()->link(); |
444 | 444 | ||
445 | $crawler = $client->click($editLink); | 445 | $crawler = $client->click($editLink); |
446 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 446 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
447 | $this->assertContains('?tagging-rule=', $client->getResponse()->headers->get('location')); | 447 | $this->assertContains('?tagging-rule=', $client->getResponse()->headers->get('location')); |
448 | 448 | ||
449 | $crawler = $client->followRedirect(); | 449 | $crawler = $client->followRedirect(); |
@@ -457,7 +457,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
457 | 457 | ||
458 | $client->submit($form, $data); | 458 | $client->submit($form, $data); |
459 | 459 | ||
460 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 460 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
461 | 461 | ||
462 | $crawler = $client->followRedirect(); | 462 | $crawler = $client->followRedirect(); |
463 | 463 | ||
@@ -468,7 +468,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
468 | $deleteLink = $crawler->filter('.delete')->last()->link(); | 468 | $deleteLink = $crawler->filter('.delete')->last()->link(); |
469 | 469 | ||
470 | $crawler = $client->click($deleteLink); | 470 | $crawler = $client->click($deleteLink); |
471 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 471 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
472 | 472 | ||
473 | $crawler = $client->followRedirect(); | 473 | $crawler = $client->followRedirect(); |
474 | $this->assertContains('flashes.config.notice.tagging_rules_deleted', $crawler->filter('body')->extract(['_text'])[0]); | 474 | $this->assertContains('flashes.config.notice.tagging_rules_deleted', $crawler->filter('body')->extract(['_text'])[0]); |
@@ -510,13 +510,13 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
510 | 510 | ||
511 | $crawler = $client->request('GET', '/config'); | 511 | $crawler = $client->request('GET', '/config'); |
512 | 512 | ||
513 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 513 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
514 | 514 | ||
515 | $form = $crawler->filter('button[id=tagging_rule_save]')->form(); | 515 | $form = $crawler->filter('button[id=tagging_rule_save]')->form(); |
516 | 516 | ||
517 | $crawler = $client->submit($form, $data); | 517 | $crawler = $client->submit($form, $data); |
518 | 518 | ||
519 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 519 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
520 | 520 | ||
521 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); | 521 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); |
522 | 522 | ||
@@ -532,7 +532,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
532 | 532 | ||
533 | $crawler = $client->request('GET', '/config'); | 533 | $crawler = $client->request('GET', '/config'); |
534 | 534 | ||
535 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 535 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
536 | 536 | ||
537 | $form = $crawler->filter('button[id=tagging_rule_save]')->form(); | 537 | $form = $crawler->filter('button[id=tagging_rule_save]')->form(); |
538 | 538 | ||
@@ -541,7 +541,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
541 | 'tagging_rule[tags]' => 'cool tag', | 541 | 'tagging_rule[tags]' => 'cool tag', |
542 | ]); | 542 | ]); |
543 | 543 | ||
544 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 544 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
545 | 545 | ||
546 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); | 546 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); |
547 | 547 | ||
@@ -557,9 +557,9 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
557 | ->getRepository('WallabagCoreBundle:TaggingRule') | 557 | ->getRepository('WallabagCoreBundle:TaggingRule') |
558 | ->findAll()[0]; | 558 | ->findAll()[0]; |
559 | 559 | ||
560 | $crawler = $client->request('GET', '/tagging-rule/edit/'.$rule->getId()); | 560 | $crawler = $client->request('GET', '/tagging-rule/edit/' . $rule->getId()); |
561 | 561 | ||
562 | $this->assertEquals(403, $client->getResponse()->getStatusCode()); | 562 | $this->assertSame(403, $client->getResponse()->getStatusCode()); |
563 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); | 563 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); |
564 | $this->assertContains('You can not access this tagging rule', $body[0]); | 564 | $this->assertContains('You can not access this tagging rule', $body[0]); |
565 | } | 565 | } |
@@ -573,9 +573,9 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
573 | ->getRepository('WallabagCoreBundle:TaggingRule') | 573 | ->getRepository('WallabagCoreBundle:TaggingRule') |
574 | ->findAll()[0]; | 574 | ->findAll()[0]; |
575 | 575 | ||
576 | $crawler = $client->request('GET', '/tagging-rule/edit/'.$rule->getId()); | 576 | $crawler = $client->request('GET', '/tagging-rule/edit/' . $rule->getId()); |
577 | 577 | ||
578 | $this->assertEquals(403, $client->getResponse()->getStatusCode()); | 578 | $this->assertSame(403, $client->getResponse()->getStatusCode()); |
579 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); | 579 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); |
580 | $this->assertContains('You can not access this tagging rule', $body[0]); | 580 | $this->assertContains('You can not access this tagging rule', $body[0]); |
581 | } | 581 | } |
@@ -591,7 +591,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
591 | 591 | ||
592 | $crawler = $client->request('GET', '/config'); | 592 | $crawler = $client->request('GET', '/config'); |
593 | 593 | ||
594 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 594 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
595 | 595 | ||
596 | $form = $crawler->filter('button[id=change_passwd_save]')->form(); | 596 | $form = $crawler->filter('button[id=change_passwd_save]')->form(); |
597 | 597 | ||
@@ -603,7 +603,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
603 | 603 | ||
604 | $client->submit($form, $data); | 604 | $client->submit($form, $data); |
605 | 605 | ||
606 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 606 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
607 | $this->assertContains('flashes.config.notice.password_not_updated_demo', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); | 607 | $this->assertContains('flashes.config.notice.password_not_updated_demo', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); |
608 | 608 | ||
609 | $config->set('demo_mode_enabled', 0); | 609 | $config->set('demo_mode_enabled', 0); |
@@ -642,7 +642,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
642 | $this->assertNotContains('config.form_user.delete.button', $body[0]); | 642 | $this->assertNotContains('config.form_user.delete.button', $body[0]); |
643 | 643 | ||
644 | $client->request('GET', '/account/delete'); | 644 | $client->request('GET', '/account/delete'); |
645 | $this->assertEquals(403, $client->getResponse()->getStatusCode()); | 645 | $this->assertSame(403, $client->getResponse()->getStatusCode()); |
646 | 646 | ||
647 | $user = $em | 647 | $user = $em |
648 | ->getRepository('WallabagUserBundle:User') | 648 | ->getRepository('WallabagUserBundle:User') |
@@ -692,7 +692,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
692 | // that this entry is also deleted | 692 | // that this entry is also deleted |
693 | $crawler = $client->request('GET', '/new'); | 693 | $crawler = $client->request('GET', '/new'); |
694 | 694 | ||
695 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 695 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
696 | 696 | ||
697 | $form = $crawler->filter('form[name=entry]')->form(); | 697 | $form = $crawler->filter('form[name=entry]')->form(); |
698 | $data = [ | 698 | $data = [ |
@@ -700,14 +700,14 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
700 | ]; | 700 | ]; |
701 | 701 | ||
702 | $client->submit($form, $data); | 702 | $client->submit($form, $data); |
703 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 703 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
704 | 704 | ||
705 | $crawler = $client->request('GET', '/config'); | 705 | $crawler = $client->request('GET', '/config'); |
706 | 706 | ||
707 | $deleteLink = $crawler->filter('.delete-account')->last()->link(); | 707 | $deleteLink = $crawler->filter('.delete-account')->last()->link(); |
708 | 708 | ||
709 | $client->click($deleteLink); | 709 | $client->click($deleteLink); |
710 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 710 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
711 | 711 | ||
712 | $em = $client->getContainer()->get('doctrine.orm.entity_manager'); | 712 | $em = $client->getContainer()->get('doctrine.orm.entity_manager'); |
713 | $user = $em | 713 | $user = $em |
@@ -767,11 +767,11 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
767 | // reset annotations | 767 | // reset annotations |
768 | $crawler = $client->request('GET', '/config#set3'); | 768 | $crawler = $client->request('GET', '/config#set3'); |
769 | 769 | ||
770 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 770 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
771 | 771 | ||
772 | $crawler = $client->click($crawler->selectLink('config.reset.annotations')->link()); | 772 | $crawler = $client->click($crawler->selectLink('config.reset.annotations')->link()); |
773 | 773 | ||
774 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 774 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
775 | $this->assertContains('flashes.config.notice.annotations_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); | 775 | $this->assertContains('flashes.config.notice.annotations_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); |
776 | 776 | ||
777 | $annotationsReset = $em | 777 | $annotationsReset = $em |
@@ -783,34 +783,34 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
783 | // reset tags | 783 | // reset tags |
784 | $crawler = $client->request('GET', '/config#set3'); | 784 | $crawler = $client->request('GET', '/config#set3'); |
785 | 785 | ||
786 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 786 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
787 | 787 | ||
788 | $crawler = $client->click($crawler->selectLink('config.reset.tags')->link()); | 788 | $crawler = $client->click($crawler->selectLink('config.reset.tags')->link()); |
789 | 789 | ||
790 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 790 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
791 | $this->assertContains('flashes.config.notice.tags_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); | 791 | $this->assertContains('flashes.config.notice.tags_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); |
792 | 792 | ||
793 | $tagReset = $em | 793 | $tagReset = $em |
794 | ->getRepository('WallabagCoreBundle:Tag') | 794 | ->getRepository('WallabagCoreBundle:Tag') |
795 | ->countAllTags($user->getId()); | 795 | ->countAllTags($user->getId()); |
796 | 796 | ||
797 | $this->assertEquals(0, $tagReset, 'Tags were reset'); | 797 | $this->assertSame(0, $tagReset, 'Tags were reset'); |
798 | 798 | ||
799 | // reset entries | 799 | // reset entries |
800 | $crawler = $client->request('GET', '/config#set3'); | 800 | $crawler = $client->request('GET', '/config#set3'); |
801 | 801 | ||
802 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 802 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
803 | 803 | ||
804 | $crawler = $client->click($crawler->selectLink('config.reset.entries')->link()); | 804 | $crawler = $client->click($crawler->selectLink('config.reset.entries')->link()); |
805 | 805 | ||
806 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 806 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
807 | $this->assertContains('flashes.config.notice.entries_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); | 807 | $this->assertContains('flashes.config.notice.entries_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); |
808 | 808 | ||
809 | $entryReset = $em | 809 | $entryReset = $em |
810 | ->getRepository('WallabagCoreBundle:Entry') | 810 | ->getRepository('WallabagCoreBundle:Entry') |
811 | ->countAllEntriesByUser($user->getId()); | 811 | ->countAllEntriesByUser($user->getId()); |
812 | 812 | ||
813 | $this->assertEquals(0, $entryReset, 'Entries were reset'); | 813 | $this->assertSame(0, $entryReset, 'Entries were reset'); |
814 | } | 814 | } |
815 | 815 | ||
816 | public function testResetArchivedEntries() | 816 | public function testResetArchivedEntries() |
@@ -863,24 +863,24 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
863 | 863 | ||
864 | $crawler = $client->request('GET', '/config#set3'); | 864 | $crawler = $client->request('GET', '/config#set3'); |
865 | 865 | ||
866 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 866 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
867 | 867 | ||
868 | $crawler = $client->click($crawler->selectLink('config.reset.archived')->link()); | 868 | $crawler = $client->click($crawler->selectLink('config.reset.archived')->link()); |
869 | 869 | ||
870 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 870 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
871 | $this->assertContains('flashes.config.notice.archived_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); | 871 | $this->assertContains('flashes.config.notice.archived_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); |
872 | 872 | ||
873 | $entryReset = $em | 873 | $entryReset = $em |
874 | ->getRepository('WallabagCoreBundle:Entry') | 874 | ->getRepository('WallabagCoreBundle:Entry') |
875 | ->countAllEntriesByUser($user->getId()); | 875 | ->countAllEntriesByUser($user->getId()); |
876 | 876 | ||
877 | $this->assertEquals(1, $entryReset, 'Entries were reset'); | 877 | $this->assertSame(1, $entryReset, 'Entries were reset'); |
878 | 878 | ||
879 | $tagReset = $em | 879 | $tagReset = $em |
880 | ->getRepository('WallabagCoreBundle:Tag') | 880 | ->getRepository('WallabagCoreBundle:Tag') |
881 | ->countAllTags($user->getId()); | 881 | ->countAllTags($user->getId()); |
882 | 882 | ||
883 | $this->assertEquals(1, $tagReset, 'Tags were reset'); | 883 | $this->assertSame(1, $tagReset, 'Tags were reset'); |
884 | 884 | ||
885 | $annotationsReset = $em | 885 | $annotationsReset = $em |
886 | ->getRepository('WallabagAnnotationBundle:Annotation') | 886 | ->getRepository('WallabagAnnotationBundle:Annotation') |
@@ -920,24 +920,24 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
920 | 920 | ||
921 | $crawler = $client->request('GET', '/config#set3'); | 921 | $crawler = $client->request('GET', '/config#set3'); |
922 | 922 | ||
923 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 923 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
924 | 924 | ||
925 | $crawler = $client->click($crawler->selectLink('config.reset.entries')->link()); | 925 | $crawler = $client->click($crawler->selectLink('config.reset.entries')->link()); |
926 | 926 | ||
927 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 927 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
928 | $this->assertContains('flashes.config.notice.entries_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); | 928 | $this->assertContains('flashes.config.notice.entries_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); |
929 | 929 | ||
930 | $entryReset = $em | 930 | $entryReset = $em |
931 | ->getRepository('WallabagCoreBundle:Entry') | 931 | ->getRepository('WallabagCoreBundle:Entry') |
932 | ->countAllEntriesByUser($user->getId()); | 932 | ->countAllEntriesByUser($user->getId()); |
933 | 933 | ||
934 | $this->assertEquals(0, $entryReset, 'Entries were reset'); | 934 | $this->assertSame(0, $entryReset, 'Entries were reset'); |
935 | 935 | ||
936 | $tagReset = $em | 936 | $tagReset = $em |
937 | ->getRepository('WallabagCoreBundle:Tag') | 937 | ->getRepository('WallabagCoreBundle:Tag') |
938 | ->countAllTags($user->getId()); | 938 | ->countAllTags($user->getId()); |
939 | 939 | ||
940 | $this->assertEquals(0, $tagReset, 'Tags were reset'); | 940 | $this->assertSame(0, $tagReset, 'Tags were reset'); |
941 | 941 | ||
942 | $annotationsReset = $em | 942 | $annotationsReset = $em |
943 | ->getRepository('WallabagAnnotationBundle:Annotation') | 943 | ->getRepository('WallabagAnnotationBundle:Annotation') |
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index 7cf28bfe..b1c6d53c 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php | |||
@@ -33,7 +33,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
33 | 33 | ||
34 | $client->request('GET', '/new'); | 34 | $client->request('GET', '/new'); |
35 | 35 | ||
36 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 36 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
37 | $this->assertContains('login', $client->getResponse()->headers->get('location')); | 37 | $this->assertContains('login', $client->getResponse()->headers->get('location')); |
38 | } | 38 | } |
39 | 39 | ||
@@ -43,16 +43,17 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
43 | $client = $this->getClient(); | 43 | $client = $this->getClient(); |
44 | 44 | ||
45 | $client->request('GET', '/unread/list'); | 45 | $client->request('GET', '/unread/list'); |
46 | $this->assertSame(302, $client->getResponse()->getStatusCode()); | ||
46 | $crawler = $client->followRedirect(); | 47 | $crawler = $client->followRedirect(); |
47 | 48 | ||
48 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 49 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
49 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); | 50 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); |
50 | $this->assertContains('quickstart.intro.title', $body[0]); | 51 | $this->assertContains('quickstart.intro.title', $body[0]); |
51 | 52 | ||
52 | // Test if quickstart is disabled when user has 1 entry | 53 | // Test if quickstart is disabled when user has 1 entry |
53 | $crawler = $client->request('GET', '/new'); | 54 | $crawler = $client->request('GET', '/new'); |
54 | 55 | ||
55 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 56 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
56 | 57 | ||
57 | $form = $crawler->filter('form[name=entry]')->form(); | 58 | $form = $crawler->filter('form[name=entry]')->form(); |
58 | 59 | ||
@@ -61,7 +62,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
61 | ]; | 62 | ]; |
62 | 63 | ||
63 | $client->submit($form, $data); | 64 | $client->submit($form, $data); |
64 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 65 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
65 | $client->followRedirect(); | 66 | $client->followRedirect(); |
66 | 67 | ||
67 | $crawler = $client->request('GET', '/unread/list'); | 68 | $crawler = $client->request('GET', '/unread/list'); |
@@ -77,7 +78,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
77 | 78 | ||
78 | $crawler = $client->request('GET', '/new'); | 79 | $crawler = $client->request('GET', '/new'); |
79 | 80 | ||
80 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 81 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
81 | 82 | ||
82 | $this->assertCount(1, $crawler->filter('input[type=url]')); | 83 | $this->assertCount(1, $crawler->filter('input[type=url]')); |
83 | $this->assertCount(1, $crawler->filter('form[name=entry]')); | 84 | $this->assertCount(1, $crawler->filter('form[name=entry]')); |
@@ -95,7 +96,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
95 | 96 | ||
96 | // Good URL | 97 | // Good URL |
97 | $client->request('GET', '/bookmarklet', ['url' => $this->url]); | 98 | $client->request('GET', '/bookmarklet', ['url' => $this->url]); |
98 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 99 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
99 | $client->followRedirect(); | 100 | $client->followRedirect(); |
100 | $crawler = $client->request('GET', '/'); | 101 | $crawler = $client->request('GET', '/'); |
101 | $this->assertCount(5, $crawler->filter('div[class=entry]')); | 102 | $this->assertCount(5, $crawler->filter('div[class=entry]')); |
@@ -116,15 +117,15 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
116 | 117 | ||
117 | $crawler = $client->request('GET', '/new'); | 118 | $crawler = $client->request('GET', '/new'); |
118 | 119 | ||
119 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 120 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
120 | 121 | ||
121 | $form = $crawler->filter('form[name=entry]')->form(); | 122 | $form = $crawler->filter('form[name=entry]')->form(); |
122 | 123 | ||
123 | $crawler = $client->submit($form); | 124 | $crawler = $client->submit($form); |
124 | 125 | ||
125 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 126 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
126 | $this->assertCount(1, $alert = $crawler->filter('form ul li')->extract(['_text'])); | 127 | $this->assertCount(1, $alert = $crawler->filter('form ul li')->extract(['_text'])); |
127 | $this->assertEquals('This value should not be blank.', $alert[0]); | 128 | $this->assertSame('This value should not be blank.', $alert[0]); |
128 | } | 129 | } |
129 | 130 | ||
130 | /** | 131 | /** |
@@ -137,7 +138,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
137 | 138 | ||
138 | $crawler = $client->request('GET', '/new'); | 139 | $crawler = $client->request('GET', '/new'); |
139 | 140 | ||
140 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 141 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
141 | 142 | ||
142 | $form = $crawler->filter('form[name=entry]')->form(); | 143 | $form = $crawler->filter('form[name=entry]')->form(); |
143 | 144 | ||
@@ -147,7 +148,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
147 | 148 | ||
148 | $client->submit($form, $data); | 149 | $client->submit($form, $data); |
149 | 150 | ||
150 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 151 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
151 | 152 | ||
152 | $content = $client->getContainer() | 153 | $content = $client->getContainer() |
153 | ->get('doctrine.orm.entity_manager') | 154 | ->get('doctrine.orm.entity_manager') |
@@ -157,11 +158,11 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
157 | $author = $content->getPublishedBy(); | 158 | $author = $content->getPublishedBy(); |
158 | 159 | ||
159 | $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content); | 160 | $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content); |
160 | $this->assertEquals($this->url, $content->getUrl()); | 161 | $this->assertSame($this->url, $content->getUrl()); |
161 | $this->assertContains('Google', $content->getTitle()); | 162 | $this->assertContains('Google', $content->getTitle()); |
162 | $this->assertEquals('fr', $content->getLanguage()); | 163 | $this->assertSame('fr', $content->getLanguage()); |
163 | $this->assertEquals('2015-03-28 15:37:39', $content->getPublishedAt()->format('Y-m-d H:i:s')); | 164 | $this->assertSame('2015-03-28 15:37:39', $content->getPublishedAt()->format('Y-m-d H:i:s')); |
164 | $this->assertEquals('Morgane Tual', $author[0]); | 165 | $this->assertSame('Morgane Tual', $author[0]); |
165 | $this->assertArrayHasKey('x-varnish1', $content->getHeaders()); | 166 | $this->assertArrayHasKey('x-varnish1', $content->getHeaders()); |
166 | } | 167 | } |
167 | 168 | ||
@@ -173,7 +174,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
173 | 174 | ||
174 | $crawler = $client->request('GET', '/new'); | 175 | $crawler = $client->request('GET', '/new'); |
175 | 176 | ||
176 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 177 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
177 | 178 | ||
178 | $form = $crawler->filter('form[name=entry]')->form(); | 179 | $form = $crawler->filter('form[name=entry]')->form(); |
179 | 180 | ||
@@ -183,7 +184,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
183 | 184 | ||
184 | $client->submit($form, $data); | 185 | $client->submit($form, $data); |
185 | 186 | ||
186 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 187 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
187 | 188 | ||
188 | $content = $client->getContainer() | 189 | $content = $client->getContainer() |
189 | ->get('doctrine.orm.entity_manager') | 190 | ->get('doctrine.orm.entity_manager') |
@@ -191,10 +192,10 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
191 | ->findByUrlAndUserId($url, $this->getLoggedInUserId()); | 192 | ->findByUrlAndUserId($url, $this->getLoggedInUserId()); |
192 | 193 | ||
193 | $authors = $content->getPublishedBy(); | 194 | $authors = $content->getPublishedBy(); |
194 | $this->assertEquals('2017-04-05 19:26:13', $content->getPublishedAt()->format('Y-m-d H:i:s')); | 195 | $this->assertSame('2017-04-05 19:26:13', $content->getPublishedAt()->format('Y-m-d H:i:s')); |
195 | $this->assertEquals('fr', $content->getLanguage()); | 196 | $this->assertSame('fr', $content->getLanguage()); |
196 | $this->assertEquals('Raphaël Balenieri, correspondant à Pékin', $authors[0]); | 197 | $this->assertSame('Raphaël Balenieri, correspondant à Pékin', $authors[0]); |
197 | $this->assertEquals('Frédéric Autran, correspondant à New York', $authors[1]); | 198 | $this->assertSame('Frédéric Autran, correspondant à New York', $authors[1]); |
198 | } | 199 | } |
199 | 200 | ||
200 | public function testPostNewOkUrlExist() | 201 | public function testPostNewOkUrlExist() |
@@ -210,7 +211,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
210 | 211 | ||
211 | $crawler = $client->request('GET', '/new'); | 212 | $crawler = $client->request('GET', '/new'); |
212 | 213 | ||
213 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 214 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
214 | 215 | ||
215 | $form = $crawler->filter('form[name=entry]')->form(); | 216 | $form = $crawler->filter('form[name=entry]')->form(); |
216 | 217 | ||
@@ -220,7 +221,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
220 | 221 | ||
221 | $client->submit($form, $data); | 222 | $client->submit($form, $data); |
222 | 223 | ||
223 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 224 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
224 | $this->assertContains('/view/', $client->getResponse()->getTargetUrl()); | 225 | $this->assertContains('/view/', $client->getResponse()->getTargetUrl()); |
225 | } | 226 | } |
226 | 227 | ||
@@ -233,7 +234,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
233 | 234 | ||
234 | $crawler = $client->request('GET', '/new'); | 235 | $crawler = $client->request('GET', '/new'); |
235 | 236 | ||
236 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 237 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
237 | 238 | ||
238 | $form = $crawler->filter('form[name=entry]')->form(); | 239 | $form = $crawler->filter('form[name=entry]')->form(); |
239 | 240 | ||
@@ -245,7 +246,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
245 | 246 | ||
246 | $crawler = $client->request('GET', '/new'); | 247 | $crawler = $client->request('GET', '/new'); |
247 | 248 | ||
248 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 249 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
249 | 250 | ||
250 | $form = $crawler->filter('form[name=entry]')->form(); | 251 | $form = $crawler->filter('form[name=entry]')->form(); |
251 | 252 | ||
@@ -255,7 +256,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
255 | 256 | ||
256 | $client->submit($form, $data); | 257 | $client->submit($form, $data); |
257 | 258 | ||
258 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 259 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
259 | $this->assertContains('/view/', $client->getResponse()->getTargetUrl()); | 260 | $this->assertContains('/view/', $client->getResponse()->getTargetUrl()); |
260 | } | 261 | } |
261 | 262 | ||
@@ -269,7 +270,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
269 | 270 | ||
270 | $crawler = $client->request('GET', '/new'); | 271 | $crawler = $client->request('GET', '/new'); |
271 | 272 | ||
272 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 273 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
273 | 274 | ||
274 | $form = $crawler->filter('form[name=entry]')->form(); | 275 | $form = $crawler->filter('form[name=entry]')->form(); |
275 | 276 | ||
@@ -279,7 +280,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
279 | 280 | ||
280 | $client->submit($form, $data); | 281 | $client->submit($form, $data); |
281 | 282 | ||
282 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 283 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
283 | $this->assertContains('/', $client->getResponse()->getTargetUrl()); | 284 | $this->assertContains('/', $client->getResponse()->getTargetUrl()); |
284 | 285 | ||
285 | $em = $client->getContainer() | 286 | $em = $client->getContainer() |
@@ -291,7 +292,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
291 | 292 | ||
292 | $this->assertCount(2, $tags); | 293 | $this->assertCount(2, $tags); |
293 | $this->assertContains('wallabag', $tags); | 294 | $this->assertContains('wallabag', $tags); |
294 | $this->assertEquals('en', $entry->getLanguage()); | 295 | $this->assertSame('en', $entry->getLanguage()); |
295 | 296 | ||
296 | $em->remove($entry); | 297 | $em->remove($entry); |
297 | $em->flush(); | 298 | $em->flush(); |
@@ -300,7 +301,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
300 | // related https://github.com/wallabag/wallabag/issues/2121 | 301 | // related https://github.com/wallabag/wallabag/issues/2121 |
301 | $crawler = $client->request('GET', '/new'); | 302 | $crawler = $client->request('GET', '/new'); |
302 | 303 | ||
303 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 304 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
304 | 305 | ||
305 | $form = $crawler->filter('form[name=entry]')->form(); | 306 | $form = $crawler->filter('form[name=entry]')->form(); |
306 | 307 | ||
@@ -310,7 +311,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
310 | 311 | ||
311 | $client->submit($form, $data); | 312 | $client->submit($form, $data); |
312 | 313 | ||
313 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 314 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
314 | $this->assertContains('/', $client->getResponse()->getTargetUrl()); | 315 | $this->assertContains('/', $client->getResponse()->getTargetUrl()); |
315 | 316 | ||
316 | $entry = $em | 317 | $entry = $em |
@@ -333,7 +334,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
333 | 334 | ||
334 | $client->request('GET', '/archive/list'); | 335 | $client->request('GET', '/archive/list'); |
335 | 336 | ||
336 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 337 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
337 | } | 338 | } |
338 | 339 | ||
339 | public function testUntagged() | 340 | public function testUntagged() |
@@ -343,7 +344,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
343 | 344 | ||
344 | $client->request('GET', '/untagged/list'); | 345 | $client->request('GET', '/untagged/list'); |
345 | 346 | ||
346 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 347 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
347 | } | 348 | } |
348 | 349 | ||
349 | public function testStarred() | 350 | public function testStarred() |
@@ -353,7 +354,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
353 | 354 | ||
354 | $client->request('GET', '/starred/list'); | 355 | $client->request('GET', '/starred/list'); |
355 | 356 | ||
356 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 357 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
357 | } | 358 | } |
358 | 359 | ||
359 | public function testRangeException() | 360 | public function testRangeException() |
@@ -363,8 +364,8 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
363 | 364 | ||
364 | $client->request('GET', '/all/list/900'); | 365 | $client->request('GET', '/all/list/900'); |
365 | 366 | ||
366 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 367 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
367 | $this->assertEquals('/all/list', $client->getResponse()->getTargetUrl()); | 368 | $this->assertSame('/all/list', $client->getResponse()->getTargetUrl()); |
368 | } | 369 | } |
369 | 370 | ||
370 | public function testView() | 371 | public function testView() |
@@ -379,9 +380,9 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
379 | $this->getEntityManager()->persist($entry); | 380 | $this->getEntityManager()->persist($entry); |
380 | $this->getEntityManager()->flush(); | 381 | $this->getEntityManager()->flush(); |
381 | 382 | ||
382 | $crawler = $client->request('GET', '/view/'.$entry->getId()); | 383 | $crawler = $client->request('GET', '/view/' . $entry->getId()); |
383 | 384 | ||
384 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 385 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
385 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); | 386 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); |
386 | $this->assertContains($entry->getTitle(), $body[0]); | 387 | $this->assertContains($entry->getTitle(), $body[0]); |
387 | } | 388 | } |
@@ -402,9 +403,9 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
402 | $this->getEntityManager()->flush(); | 403 | $this->getEntityManager()->flush(); |
403 | $this->getEntityManager()->clear(); | 404 | $this->getEntityManager()->clear(); |
404 | 405 | ||
405 | $client->request('GET', '/reload/'.$entry->getId()); | 406 | $client->request('GET', '/reload/' . $entry->getId()); |
406 | 407 | ||
407 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 408 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
408 | 409 | ||
409 | $entry = $this->getEntityManager() | 410 | $entry = $this->getEntityManager() |
410 | ->getRepository('WallabagCoreBundle:Entry') | 411 | ->getRepository('WallabagCoreBundle:Entry') |
@@ -423,9 +424,9 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
423 | $this->getEntityManager()->persist($entry); | 424 | $this->getEntityManager()->persist($entry); |
424 | $this->getEntityManager()->flush(); | 425 | $this->getEntityManager()->flush(); |
425 | 426 | ||
426 | $client->request('GET', '/reload/'.$entry->getId()); | 427 | $client->request('GET', '/reload/' . $entry->getId()); |
427 | 428 | ||
428 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 429 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
429 | 430 | ||
430 | // force EntityManager to clear previous entity | 431 | // force EntityManager to clear previous entity |
431 | // otherwise, retrieve the same entity will retrieve change from the previous request :0 | 432 | // otherwise, retrieve the same entity will retrieve change from the previous request :0 |
@@ -434,7 +435,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
434 | ->getRepository('WallabagCoreBundle:Entry') | 435 | ->getRepository('WallabagCoreBundle:Entry') |
435 | ->find($entry->getId()); | 436 | ->find($entry->getId()); |
436 | 437 | ||
437 | $this->assertNotEquals($client->getContainer()->getParameter('wallabag_core.fetching_error_message'), $newContent->getContent()); | 438 | $this->assertNotSame($client->getContainer()->getParameter('wallabag_core.fetching_error_message'), $newContent->getContent()); |
438 | } | 439 | } |
439 | 440 | ||
440 | public function testEdit() | 441 | public function testEdit() |
@@ -447,9 +448,9 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
447 | $this->getEntityManager()->persist($entry); | 448 | $this->getEntityManager()->persist($entry); |
448 | $this->getEntityManager()->flush(); | 449 | $this->getEntityManager()->flush(); |
449 | 450 | ||
450 | $crawler = $client->request('GET', '/edit/'.$entry->getId()); | 451 | $crawler = $client->request('GET', '/edit/' . $entry->getId()); |
451 | 452 | ||
452 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 453 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
453 | 454 | ||
454 | $this->assertCount(1, $crawler->filter('input[id=entry_title]')); | 455 | $this->assertCount(1, $crawler->filter('input[id=entry_title]')); |
455 | $this->assertCount(1, $crawler->filter('button[id=entry_save]')); | 456 | $this->assertCount(1, $crawler->filter('button[id=entry_save]')); |
@@ -465,9 +466,9 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
465 | $this->getEntityManager()->persist($entry); | 466 | $this->getEntityManager()->persist($entry); |
466 | $this->getEntityManager()->flush(); | 467 | $this->getEntityManager()->flush(); |
467 | 468 | ||
468 | $crawler = $client->request('GET', '/edit/'.$entry->getId()); | 469 | $crawler = $client->request('GET', '/edit/' . $entry->getId()); |
469 | 470 | ||
470 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 471 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
471 | 472 | ||
472 | $form = $crawler->filter('button[type=submit]')->form(); | 473 | $form = $crawler->filter('button[type=submit]')->form(); |
473 | 474 | ||
@@ -477,7 +478,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
477 | 478 | ||
478 | $client->submit($form, $data); | 479 | $client->submit($form, $data); |
479 | 480 | ||
480 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 481 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
481 | 482 | ||
482 | $crawler = $client->followRedirect(); | 483 | $crawler = $client->followRedirect(); |
483 | 484 | ||
@@ -496,16 +497,16 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
496 | $this->getEntityManager()->flush(); | 497 | $this->getEntityManager()->flush(); |
497 | $this->getEntityManager()->clear(); | 498 | $this->getEntityManager()->clear(); |
498 | 499 | ||
499 | $client->request('GET', '/archive/'.$entry->getId()); | 500 | $client->request('GET', '/archive/' . $entry->getId()); |
500 | 501 | ||
501 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 502 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
502 | 503 | ||
503 | $res = $client->getContainer() | 504 | $res = $client->getContainer() |
504 | ->get('doctrine.orm.entity_manager') | 505 | ->get('doctrine.orm.entity_manager') |
505 | ->getRepository('WallabagCoreBundle:Entry') | 506 | ->getRepository('WallabagCoreBundle:Entry') |
506 | ->find($entry->getId()); | 507 | ->find($entry->getId()); |
507 | 508 | ||
508 | $this->assertEquals($res->isArchived(), true); | 509 | $this->assertSame(1, $res->isArchived()); |
509 | } | 510 | } |
510 | 511 | ||
511 | public function testToggleStar() | 512 | public function testToggleStar() |
@@ -519,16 +520,16 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
519 | $this->getEntityManager()->flush(); | 520 | $this->getEntityManager()->flush(); |
520 | $this->getEntityManager()->clear(); | 521 | $this->getEntityManager()->clear(); |
521 | 522 | ||
522 | $client->request('GET', '/star/'.$entry->getId()); | 523 | $client->request('GET', '/star/' . $entry->getId()); |
523 | 524 | ||
524 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 525 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
525 | 526 | ||
526 | $res = $client->getContainer() | 527 | $res = $client->getContainer() |
527 | ->get('doctrine.orm.entity_manager') | 528 | ->get('doctrine.orm.entity_manager') |
528 | ->getRepository('WallabagCoreBundle:Entry') | 529 | ->getRepository('WallabagCoreBundle:Entry') |
529 | ->findOneById($entry->getId()); | 530 | ->findOneById($entry->getId()); |
530 | 531 | ||
531 | $this->assertEquals($res->isStarred(), true); | 532 | $this->assertSame(1, $res->isStarred()); |
532 | } | 533 | } |
533 | 534 | ||
534 | public function testDelete() | 535 | public function testDelete() |
@@ -541,13 +542,13 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
541 | $this->getEntityManager()->persist($entry); | 542 | $this->getEntityManager()->persist($entry); |
542 | $this->getEntityManager()->flush(); | 543 | $this->getEntityManager()->flush(); |
543 | 544 | ||
544 | $client->request('GET', '/delete/'.$entry->getId()); | 545 | $client->request('GET', '/delete/' . $entry->getId()); |
545 | 546 | ||
546 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 547 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
547 | 548 | ||
548 | $client->request('GET', '/delete/'.$entry->getId()); | 549 | $client->request('GET', '/delete/' . $entry->getId()); |
549 | 550 | ||
550 | $this->assertEquals(404, $client->getResponse()->getStatusCode()); | 551 | $this->assertSame(404, $client->getResponse()->getStatusCode()); |
551 | } | 552 | } |
552 | 553 | ||
553 | /** | 554 | /** |
@@ -583,14 +584,14 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
583 | $em->persist($content); | 584 | $em->persist($content); |
584 | $em->flush(); | 585 | $em->flush(); |
585 | 586 | ||
586 | $client->request('GET', '/view/'.$content->getId()); | 587 | $client->request('GET', '/view/' . $content->getId()); |
587 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 588 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
588 | 589 | ||
589 | $client->request('GET', '/delete/'.$content->getId()); | 590 | $client->request('GET', '/delete/' . $content->getId()); |
590 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 591 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
591 | 592 | ||
592 | $client->followRedirect(); | 593 | $client->followRedirect(); |
593 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 594 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
594 | } | 595 | } |
595 | 596 | ||
596 | public function testViewOtherUserEntry() | 597 | public function testViewOtherUserEntry() |
@@ -603,9 +604,9 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
603 | ->getRepository('WallabagCoreBundle:Entry') | 604 | ->getRepository('WallabagCoreBundle:Entry') |
604 | ->findOneByUsernameAndNotArchived('bob'); | 605 | ->findOneByUsernameAndNotArchived('bob'); |
605 | 606 | ||
606 | $client->request('GET', '/view/'.$content->getId()); | 607 | $client->request('GET', '/view/' . $content->getId()); |
607 | 608 | ||
608 | $this->assertEquals(403, $client->getResponse()->getStatusCode()); | 609 | $this->assertSame(403, $client->getResponse()->getStatusCode()); |
609 | } | 610 | } |
610 | 611 | ||
611 | public function testFilterOnReadingTime() | 612 | public function testFilterOnReadingTime() |
@@ -793,7 +794,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
793 | 794 | ||
794 | $parameters = '?entry_filter%5BreadingTime%5D%5Bleft_number%5D=&entry_filter%5BreadingTime%5D%5Bright_number%5D='; | 795 | $parameters = '?entry_filter%5BreadingTime%5D%5Bleft_number%5D=&entry_filter%5BreadingTime%5D%5Bright_number%5D='; |
795 | 796 | ||
796 | $client->request('GET', 'unread/list'.$parameters); | 797 | $client->request('GET', 'unread/list' . $parameters); |
797 | 798 | ||
798 | $this->assertContains($parameters, $client->getResponse()->getContent()); | 799 | $this->assertContains($parameters, $client->getResponse()->getContent()); |
799 | 800 | ||
@@ -934,16 +935,16 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
934 | $this->getEntityManager()->clear(); | 935 | $this->getEntityManager()->clear(); |
935 | 936 | ||
936 | // no uid | 937 | // no uid |
937 | $client->request('GET', '/share/'.$content->getUid()); | 938 | $client->request('GET', '/share/' . $content->getUid()); |
938 | $this->assertEquals(404, $client->getResponse()->getStatusCode()); | 939 | $this->assertSame(404, $client->getResponse()->getStatusCode()); |
939 | 940 | ||
940 | // generating the uid | 941 | // generating the uid |
941 | $client->request('GET', '/share/'.$content->getId()); | 942 | $client->request('GET', '/share/' . $content->getId()); |
942 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 943 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
943 | 944 | ||
944 | // follow link with uid | 945 | // follow link with uid |
945 | $crawler = $client->followRedirect(); | 946 | $crawler = $client->followRedirect(); |
946 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 947 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
947 | $this->assertContains('max-age=25200', $client->getResponse()->headers->get('cache-control')); | 948 | $this->assertContains('max-age=25200', $client->getResponse()->headers->get('cache-control')); |
948 | $this->assertContains('public', $client->getResponse()->headers->get('cache-control')); | 949 | $this->assertContains('public', $client->getResponse()->headers->get('cache-control')); |
949 | $this->assertContains('s-maxage=25200', $client->getResponse()->headers->get('cache-control')); | 950 | $this->assertContains('s-maxage=25200', $client->getResponse()->headers->get('cache-control')); |
@@ -955,19 +956,19 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
955 | 956 | ||
956 | // sharing is now disabled | 957 | // sharing is now disabled |
957 | $client->getContainer()->get('craue_config')->set('share_public', 0); | 958 | $client->getContainer()->get('craue_config')->set('share_public', 0); |
958 | $client->request('GET', '/share/'.$content->getUid()); | 959 | $client->request('GET', '/share/' . $content->getUid()); |
959 | $this->assertEquals(404, $client->getResponse()->getStatusCode()); | 960 | $this->assertSame(404, $client->getResponse()->getStatusCode()); |
960 | 961 | ||
961 | $client->request('GET', '/view/'.$content->getId()); | 962 | $client->request('GET', '/view/' . $content->getId()); |
962 | $this->assertContains('no-cache', $client->getResponse()->headers->get('cache-control')); | 963 | $this->assertContains('no-cache', $client->getResponse()->headers->get('cache-control')); |
963 | 964 | ||
964 | // removing the share | 965 | // removing the share |
965 | $client->request('GET', '/share/delete/'.$content->getId()); | 966 | $client->request('GET', '/share/delete/' . $content->getId()); |
966 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 967 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
967 | 968 | ||
968 | // share is now disable | 969 | // share is now disable |
969 | $client->request('GET', '/share/'.$content->getUid()); | 970 | $client->request('GET', '/share/' . $content->getUid()); |
970 | $this->assertEquals(404, $client->getResponse()->getStatusCode()); | 971 | $this->assertSame(404, $client->getResponse()->getStatusCode()); |
971 | } | 972 | } |
972 | 973 | ||
973 | public function testNewEntryWithDownloadImagesEnabled() | 974 | public function testNewEntryWithDownloadImagesEnabled() |
@@ -981,7 +982,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
981 | 982 | ||
982 | $crawler = $client->request('GET', '/new'); | 983 | $crawler = $client->request('GET', '/new'); |
983 | 984 | ||
984 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 985 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
985 | 986 | ||
986 | $form = $crawler->filter('form[name=entry]')->form(); | 987 | $form = $crawler->filter('form[name=entry]')->form(); |
987 | 988 | ||
@@ -991,7 +992,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
991 | 992 | ||
992 | $client->submit($form, $data); | 993 | $client->submit($form, $data); |
993 | 994 | ||
994 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 995 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
995 | 996 | ||
996 | $em = $client->getContainer() | 997 | $em = $client->getContainer() |
997 | ->get('doctrine.orm.entity_manager'); | 998 | ->get('doctrine.orm.entity_manager'); |
@@ -1001,10 +1002,10 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
1001 | ->findByUrlAndUserId($url, $this->getLoggedInUserId()); | 1002 | ->findByUrlAndUserId($url, $this->getLoggedInUserId()); |
1002 | 1003 | ||
1003 | $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $entry); | 1004 | $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $entry); |
1004 | $this->assertEquals($url, $entry->getUrl()); | 1005 | $this->assertSame($url, $entry->getUrl()); |
1005 | $this->assertContains('Perpignan', $entry->getTitle()); | 1006 | $this->assertContains('Perpignan', $entry->getTitle()); |
1006 | // instead of checking for the filename (which might change) check that the image is now local | 1007 | // instead of checking for the filename (which might change) check that the image is now local |
1007 | $this->assertContains('https://your-wallabag-url-instance.com/assets/images/', $entry->getContent()); | 1008 | $this->assertContains($client->getContainer()->getParameter('domain_name') . '/assets/images/', $entry->getContent()); |
1008 | 1009 | ||
1009 | $client->getContainer()->get('craue_config')->set('download_images_enabled', 0); | 1010 | $client->getContainer()->get('craue_config')->set('download_images_enabled', 0); |
1010 | } | 1011 | } |
@@ -1023,7 +1024,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
1023 | 1024 | ||
1024 | $crawler = $client->request('GET', '/new'); | 1025 | $crawler = $client->request('GET', '/new'); |
1025 | 1026 | ||
1026 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 1027 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
1027 | 1028 | ||
1028 | $form = $crawler->filter('form[name=entry]')->form(); | 1029 | $form = $crawler->filter('form[name=entry]')->form(); |
1029 | 1030 | ||
@@ -1033,16 +1034,16 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
1033 | 1034 | ||
1034 | $client->submit($form, $data); | 1035 | $client->submit($form, $data); |
1035 | 1036 | ||
1036 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 1037 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
1037 | 1038 | ||
1038 | $content = $client->getContainer() | 1039 | $content = $client->getContainer() |
1039 | ->get('doctrine.orm.entity_manager') | 1040 | ->get('doctrine.orm.entity_manager') |
1040 | ->getRepository('WallabagCoreBundle:Entry') | 1041 | ->getRepository('WallabagCoreBundle:Entry') |
1041 | ->findByUrlAndUserId($url, $this->getLoggedInUserId()); | 1042 | ->findByUrlAndUserId($url, $this->getLoggedInUserId()); |
1042 | 1043 | ||
1043 | $client->request('GET', '/delete/'.$content->getId()); | 1044 | $client->request('GET', '/delete/' . $content->getId()); |
1044 | 1045 | ||
1045 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 1046 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
1046 | 1047 | ||
1047 | $client->getContainer()->get('craue_config')->set('download_images_enabled', 0); | 1048 | $client->getContainer()->get('craue_config')->set('download_images_enabled', 0); |
1048 | } | 1049 | } |
@@ -1063,11 +1064,11 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
1063 | 1064 | ||
1064 | $this->getEntityManager()->flush(); | 1065 | $this->getEntityManager()->flush(); |
1065 | 1066 | ||
1066 | $client->request('GET', '/view/'.$entry->getId()); | 1067 | $client->request('GET', '/view/' . $entry->getId()); |
1067 | $client->request('GET', '/archive/'.$entry->getId()); | 1068 | $client->request('GET', '/archive/' . $entry->getId()); |
1068 | 1069 | ||
1069 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 1070 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
1070 | $this->assertEquals('/', $client->getResponse()->headers->get('location')); | 1071 | $this->assertSame('/', $client->getResponse()->headers->get('location')); |
1071 | } | 1072 | } |
1072 | 1073 | ||
1073 | public function testRedirectToCurrentPage() | 1074 | public function testRedirectToCurrentPage() |
@@ -1086,11 +1087,11 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
1086 | 1087 | ||
1087 | $this->getEntityManager()->flush(); | 1088 | $this->getEntityManager()->flush(); |
1088 | 1089 | ||
1089 | $client->request('GET', '/view/'.$entry->getId()); | 1090 | $client->request('GET', '/view/' . $entry->getId()); |
1090 | $client->request('GET', '/archive/'.$entry->getId()); | 1091 | $client->request('GET', '/archive/' . $entry->getId()); |
1091 | 1092 | ||
1092 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 1093 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
1093 | $this->assertContains('/view/'.$entry->getId(), $client->getResponse()->headers->get('location')); | 1094 | $this->assertContains('/view/' . $entry->getId(), $client->getResponse()->headers->get('location')); |
1094 | } | 1095 | } |
1095 | 1096 | ||
1096 | public function testFilterOnHttpStatus() | 1097 | public function testFilterOnHttpStatus() |
@@ -1213,7 +1214,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
1213 | $crawler = $client->submit($form, $data); | 1214 | $crawler = $client->submit($form, $data); |
1214 | 1215 | ||
1215 | $this->assertCount(1, $crawler->filter('div[class=entry]')); | 1216 | $this->assertCount(1, $crawler->filter('div[class=entry]')); |
1216 | $client->request('GET', '/delete/'.$entry->getId()); | 1217 | $client->request('GET', '/delete/' . $entry->getId()); |
1217 | 1218 | ||
1218 | // test on list of all articles | 1219 | // test on list of all articles |
1219 | $crawler = $client->request('GET', '/all/list'); | 1220 | $crawler = $client->request('GET', '/all/list'); |
@@ -1296,7 +1297,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
1296 | ], | 1297 | ], |
1297 | 'fucked_list_of_languages' => [ | 1298 | 'fucked_list_of_languages' => [ |
1298 | 'http://geocatalog.webservice-energy.org/geonetwork/srv/eng/main.home', | 1299 | 'http://geocatalog.webservice-energy.org/geonetwork/srv/eng/main.home', |
1299 | '', | 1300 | null, |
1300 | ], | 1301 | ], |
1301 | 'es-ES' => [ | 1302 | 'es-ES' => [ |
1302 | 'http://www.muylinux.com/2015/04/17/odf-reino-unido-microsoft-google', | 1303 | 'http://www.muylinux.com/2015/04/17/odf-reino-unido-microsoft-google', |
@@ -1315,7 +1316,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
1315 | 1316 | ||
1316 | $crawler = $client->request('GET', '/new'); | 1317 | $crawler = $client->request('GET', '/new'); |
1317 | 1318 | ||
1318 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 1319 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
1319 | 1320 | ||
1320 | $form = $crawler->filter('form[name=entry]')->form(); | 1321 | $form = $crawler->filter('form[name=entry]')->form(); |
1321 | 1322 | ||
@@ -1325,7 +1326,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
1325 | 1326 | ||
1326 | $client->submit($form, $data); | 1327 | $client->submit($form, $data); |
1327 | 1328 | ||
1328 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 1329 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
1329 | 1330 | ||
1330 | $content = $client->getContainer() | 1331 | $content = $client->getContainer() |
1331 | ->get('doctrine.orm.entity_manager') | 1332 | ->get('doctrine.orm.entity_manager') |
@@ -1333,8 +1334,8 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
1333 | ->findByUrlAndUserId($url, $this->getLoggedInUserId()); | 1334 | ->findByUrlAndUserId($url, $this->getLoggedInUserId()); |
1334 | 1335 | ||
1335 | $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content); | 1336 | $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content); |
1336 | $this->assertEquals($url, $content->getUrl()); | 1337 | $this->assertSame($url, $content->getUrl()); |
1337 | $this->assertEquals($expectedLanguage, $content->getLanguage()); | 1338 | $this->assertSame($expectedLanguage, $content->getLanguage()); |
1338 | } | 1339 | } |
1339 | 1340 | ||
1340 | /** | 1341 | /** |
@@ -1362,7 +1363,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
1362 | 1363 | ||
1363 | $crawler = $client->request('GET', '/new'); | 1364 | $crawler = $client->request('GET', '/new'); |
1364 | 1365 | ||
1365 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 1366 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
1366 | 1367 | ||
1367 | $form = $crawler->filter('form[name=entry]')->form(); | 1368 | $form = $crawler->filter('form[name=entry]')->form(); |
1368 | 1369 | ||
@@ -1372,11 +1373,11 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
1372 | 1373 | ||
1373 | $client->submit($form, $data); | 1374 | $client->submit($form, $data); |
1374 | 1375 | ||
1375 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 1376 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
1376 | 1377 | ||
1377 | $crawler = $client->followRedirect(); | 1378 | $crawler = $client->followRedirect(); |
1378 | 1379 | ||
1379 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 1380 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
1380 | $this->assertContains('flashes.entry.notice.entry_saved', $crawler->filter('body')->extract(['_text'])[0]); | 1381 | $this->assertContains('flashes.entry.notice.entry_saved', $crawler->filter('body')->extract(['_text'])[0]); |
1381 | 1382 | ||
1382 | $content = $em | 1383 | $content = $em |
diff --git a/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php index b38961d3..3e216381 100644 --- a/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php | |||
@@ -12,7 +12,7 @@ class ExportControllerTest extends WallabagCoreTestCase | |||
12 | 12 | ||
13 | $client->request('GET', '/export/unread.csv'); | 13 | $client->request('GET', '/export/unread.csv'); |
14 | 14 | ||
15 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 15 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
16 | $this->assertContains('login', $client->getResponse()->headers->get('location')); | 16 | $this->assertContains('login', $client->getResponse()->headers->get('location')); |
17 | } | 17 | } |
18 | 18 | ||
@@ -23,7 +23,7 @@ class ExportControllerTest extends WallabagCoreTestCase | |||
23 | 23 | ||
24 | $client->request('GET', '/export/awesomeness.epub'); | 24 | $client->request('GET', '/export/awesomeness.epub'); |
25 | 25 | ||
26 | $this->assertEquals(404, $client->getResponse()->getStatusCode()); | 26 | $this->assertSame(404, $client->getResponse()->getStatusCode()); |
27 | } | 27 | } |
28 | 28 | ||
29 | public function testUnknownFormatExport() | 29 | public function testUnknownFormatExport() |
@@ -33,7 +33,7 @@ class ExportControllerTest extends WallabagCoreTestCase | |||
33 | 33 | ||
34 | $client->request('GET', '/export/unread.xslx'); | 34 | $client->request('GET', '/export/unread.xslx'); |
35 | 35 | ||
36 | $this->assertEquals(404, $client->getResponse()->getStatusCode()); | 36 | $this->assertSame(404, $client->getResponse()->getStatusCode()); |
37 | } | 37 | } |
38 | 38 | ||
39 | public function testUnsupportedFormatExport() | 39 | public function testUnsupportedFormatExport() |
@@ -42,15 +42,15 @@ class ExportControllerTest extends WallabagCoreTestCase | |||
42 | $client = $this->getClient(); | 42 | $client = $this->getClient(); |
43 | 43 | ||
44 | $client->request('GET', '/export/unread.doc'); | 44 | $client->request('GET', '/export/unread.doc'); |
45 | $this->assertEquals(404, $client->getResponse()->getStatusCode()); | 45 | $this->assertSame(404, $client->getResponse()->getStatusCode()); |
46 | 46 | ||
47 | $content = $client->getContainer() | 47 | $content = $client->getContainer() |
48 | ->get('doctrine.orm.entity_manager') | 48 | ->get('doctrine.orm.entity_manager') |
49 | ->getRepository('WallabagCoreBundle:Entry') | 49 | ->getRepository('WallabagCoreBundle:Entry') |
50 | ->findOneByUsernameAndNotArchived('admin'); | 50 | ->findOneByUsernameAndNotArchived('admin'); |
51 | 51 | ||
52 | $client->request('GET', '/export/'.$content->getId().'.doc'); | 52 | $client->request('GET', '/export/' . $content->getId() . '.doc'); |
53 | $this->assertEquals(404, $client->getResponse()->getStatusCode()); | 53 | $this->assertSame(404, $client->getResponse()->getStatusCode()); |
54 | } | 54 | } |
55 | 55 | ||
56 | public function testBadEntryId() | 56 | public function testBadEntryId() |
@@ -60,7 +60,7 @@ class ExportControllerTest extends WallabagCoreTestCase | |||
60 | 60 | ||
61 | $client->request('GET', '/export/0.mobi'); | 61 | $client->request('GET', '/export/0.mobi'); |
62 | 62 | ||
63 | $this->assertEquals(404, $client->getResponse()->getStatusCode()); | 63 | $this->assertSame(404, $client->getResponse()->getStatusCode()); |
64 | } | 64 | } |
65 | 65 | ||
66 | public function testEpubExport() | 66 | public function testEpubExport() |
@@ -72,12 +72,12 @@ class ExportControllerTest extends WallabagCoreTestCase | |||
72 | $crawler = $client->request('GET', '/export/archive.epub'); | 72 | $crawler = $client->request('GET', '/export/archive.epub'); |
73 | ob_end_clean(); | 73 | ob_end_clean(); |
74 | 74 | ||
75 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 75 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
76 | 76 | ||
77 | $headers = $client->getResponse()->headers; | 77 | $headers = $client->getResponse()->headers; |
78 | $this->assertEquals('application/epub+zip', $headers->get('content-type')); | 78 | $this->assertSame('application/epub+zip', $headers->get('content-type')); |
79 | $this->assertEquals('attachment; filename="Archive articles.epub"', $headers->get('content-disposition')); | 79 | $this->assertSame('attachment; filename="Archive articles.epub"', $headers->get('content-disposition')); |
80 | $this->assertEquals('binary', $headers->get('content-transfer-encoding')); | 80 | $this->assertSame('binary', $headers->get('content-transfer-encoding')); |
81 | } | 81 | } |
82 | 82 | ||
83 | public function testMobiExport() | 83 | public function testMobiExport() |
@@ -91,15 +91,15 @@ class ExportControllerTest extends WallabagCoreTestCase | |||
91 | ->findOneByUsernameAndNotArchived('admin'); | 91 | ->findOneByUsernameAndNotArchived('admin'); |
92 | 92 | ||
93 | ob_start(); | 93 | ob_start(); |
94 | $crawler = $client->request('GET', '/export/'.$content->getId().'.mobi'); | 94 | $crawler = $client->request('GET', '/export/' . $content->getId() . '.mobi'); |
95 | ob_end_clean(); | 95 | ob_end_clean(); |
96 | 96 | ||
97 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 97 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
98 | 98 | ||
99 | $headers = $client->getResponse()->headers; | 99 | $headers = $client->getResponse()->headers; |
100 | $this->assertEquals('application/x-mobipocket-ebook', $headers->get('content-type')); | 100 | $this->assertSame('application/x-mobipocket-ebook', $headers->get('content-type')); |
101 | $this->assertEquals('attachment; filename="'.preg_replace('/[^A-Za-z0-9\-]/', '', $content->getTitle()).'.mobi"', $headers->get('content-disposition')); | 101 | $this->assertSame('attachment; filename="' . preg_replace('/[^A-Za-z0-9\-]/', '', $content->getTitle()) . '.mobi"', $headers->get('content-disposition')); |
102 | $this->assertEquals('binary', $headers->get('content-transfer-encoding')); | 102 | $this->assertSame('binary', $headers->get('content-transfer-encoding')); |
103 | } | 103 | } |
104 | 104 | ||
105 | public function testPdfExport() | 105 | public function testPdfExport() |
@@ -111,23 +111,23 @@ class ExportControllerTest extends WallabagCoreTestCase | |||
111 | $crawler = $client->request('GET', '/export/all.pdf'); | 111 | $crawler = $client->request('GET', '/export/all.pdf'); |
112 | ob_end_clean(); | 112 | ob_end_clean(); |
113 | 113 | ||
114 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 114 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
115 | 115 | ||
116 | $headers = $client->getResponse()->headers; | 116 | $headers = $client->getResponse()->headers; |
117 | $this->assertEquals('application/pdf', $headers->get('content-type')); | 117 | $this->assertSame('application/pdf', $headers->get('content-type')); |
118 | $this->assertEquals('attachment; filename="All articles.pdf"', $headers->get('content-disposition')); | 118 | $this->assertSame('attachment; filename="All articles.pdf"', $headers->get('content-disposition')); |
119 | $this->assertEquals('binary', $headers->get('content-transfer-encoding')); | 119 | $this->assertSame('binary', $headers->get('content-transfer-encoding')); |
120 | 120 | ||
121 | ob_start(); | 121 | ob_start(); |
122 | $crawler = $client->request('GET', '/export/tag_entries.pdf?tag=foo-bar'); | 122 | $crawler = $client->request('GET', '/export/tag_entries.pdf?tag=foo-bar'); |
123 | ob_end_clean(); | 123 | ob_end_clean(); |
124 | 124 | ||
125 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 125 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
126 | 126 | ||
127 | $headers = $client->getResponse()->headers; | 127 | $headers = $client->getResponse()->headers; |
128 | $this->assertEquals('application/pdf', $headers->get('content-type')); | 128 | $this->assertSame('application/pdf', $headers->get('content-type')); |
129 | $this->assertEquals('attachment; filename="Tag_entries articles.pdf"', $headers->get('content-disposition')); | 129 | $this->assertSame('attachment; filename="Tag_entries articles.pdf"', $headers->get('content-disposition')); |
130 | $this->assertEquals('binary', $headers->get('content-transfer-encoding')); | 130 | $this->assertSame('binary', $headers->get('content-transfer-encoding')); |
131 | } | 131 | } |
132 | 132 | ||
133 | public function testTxtExport() | 133 | public function testTxtExport() |
@@ -139,12 +139,12 @@ class ExportControllerTest extends WallabagCoreTestCase | |||
139 | $crawler = $client->request('GET', '/export/all.txt'); | 139 | $crawler = $client->request('GET', '/export/all.txt'); |
140 | ob_end_clean(); | 140 | ob_end_clean(); |
141 | 141 | ||
142 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 142 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
143 | 143 | ||
144 | $headers = $client->getResponse()->headers; | 144 | $headers = $client->getResponse()->headers; |
145 | $this->assertEquals('text/plain; charset=UTF-8', $headers->get('content-type')); | 145 | $this->assertSame('text/plain; charset=UTF-8', $headers->get('content-type')); |
146 | $this->assertEquals('attachment; filename="All articles.txt"', $headers->get('content-disposition')); | 146 | $this->assertSame('attachment; filename="All articles.txt"', $headers->get('content-disposition')); |
147 | $this->assertEquals('UTF-8', $headers->get('content-transfer-encoding')); | 147 | $this->assertSame('UTF-8', $headers->get('content-transfer-encoding')); |
148 | } | 148 | } |
149 | 149 | ||
150 | public function testCsvExport() | 150 | public function testCsvExport() |
@@ -169,19 +169,19 @@ class ExportControllerTest extends WallabagCoreTestCase | |||
169 | $crawler = $client->request('GET', '/export/archive.csv'); | 169 | $crawler = $client->request('GET', '/export/archive.csv'); |
170 | ob_end_clean(); | 170 | ob_end_clean(); |
171 | 171 | ||
172 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 172 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
173 | 173 | ||
174 | $headers = $client->getResponse()->headers; | 174 | $headers = $client->getResponse()->headers; |
175 | $this->assertEquals('application/csv', $headers->get('content-type')); | 175 | $this->assertSame('application/csv', $headers->get('content-type')); |
176 | $this->assertEquals('attachment; filename="Archive articles.csv"', $headers->get('content-disposition')); | 176 | $this->assertSame('attachment; filename="Archive articles.csv"', $headers->get('content-disposition')); |
177 | $this->assertEquals('UTF-8', $headers->get('content-transfer-encoding')); | 177 | $this->assertSame('UTF-8', $headers->get('content-transfer-encoding')); |
178 | 178 | ||
179 | $csv = str_getcsv($client->getResponse()->getContent(), "\n"); | 179 | $csv = str_getcsv($client->getResponse()->getContent(), "\n"); |
180 | 180 | ||
181 | $this->assertGreaterThan(1, $csv); | 181 | $this->assertGreaterThan(1, $csv); |
182 | // +1 for title line | 182 | // +1 for title line |
183 | $this->assertEquals(count($contentInDB) + 1, count($csv)); | 183 | $this->assertSame(count($contentInDB) + 1, count($csv)); |
184 | $this->assertEquals('Title;URL;Content;Tags;"MIME Type";Language;"Creation date"', $csv[0]); | 184 | $this->assertSame('Title;URL;Content;Tags;"MIME Type";Language;"Creation date"', $csv[0]); |
185 | $this->assertContains($contentInDB[0]['title'], $csv[1]); | 185 | $this->assertContains($contentInDB[0]['title'], $csv[1]); |
186 | $this->assertContains($contentInDB[0]['url'], $csv[1]); | 186 | $this->assertContains($contentInDB[0]['url'], $csv[1]); |
187 | $this->assertContains($contentInDB[0]['content'], $csv[1]); | 187 | $this->assertContains($contentInDB[0]['content'], $csv[1]); |
@@ -205,15 +205,15 @@ class ExportControllerTest extends WallabagCoreTestCase | |||
205 | ->findByUrlAndUserId('http://0.0.0.0/entry1', $this->getLoggedInUserId()); | 205 | ->findByUrlAndUserId('http://0.0.0.0/entry1', $this->getLoggedInUserId()); |
206 | 206 | ||
207 | ob_start(); | 207 | ob_start(); |
208 | $crawler = $client->request('GET', '/export/'.$contentInDB->getId().'.json'); | 208 | $crawler = $client->request('GET', '/export/' . $contentInDB->getId() . '.json'); |
209 | ob_end_clean(); | 209 | ob_end_clean(); |
210 | 210 | ||
211 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 211 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
212 | 212 | ||
213 | $headers = $client->getResponse()->headers; | 213 | $headers = $client->getResponse()->headers; |
214 | $this->assertEquals('application/json', $headers->get('content-type')); | 214 | $this->assertSame('application/json', $headers->get('content-type')); |
215 | $this->assertEquals('attachment; filename="'.$contentInDB->getTitle().'.json"', $headers->get('content-disposition')); | 215 | $this->assertSame('attachment; filename="' . $contentInDB->getTitle() . '.json"', $headers->get('content-disposition')); |
216 | $this->assertEquals('UTF-8', $headers->get('content-transfer-encoding')); | 216 | $this->assertSame('UTF-8', $headers->get('content-transfer-encoding')); |
217 | 217 | ||
218 | $content = json_decode($client->getResponse()->getContent(), true); | 218 | $content = json_decode($client->getResponse()->getContent(), true); |
219 | $this->assertArrayHasKey('id', $content[0]); | 219 | $this->assertArrayHasKey('id', $content[0]); |
@@ -230,16 +230,16 @@ class ExportControllerTest extends WallabagCoreTestCase | |||
230 | $this->assertArrayHasKey('created_at', $content[0]); | 230 | $this->assertArrayHasKey('created_at', $content[0]); |
231 | $this->assertArrayHasKey('updated_at', $content[0]); | 231 | $this->assertArrayHasKey('updated_at', $content[0]); |
232 | 232 | ||
233 | $this->assertEquals($contentInDB->isArchived(), $content[0]['is_archived']); | 233 | $this->assertSame((int) $contentInDB->isArchived(), $content[0]['is_archived']); |
234 | $this->assertEquals($contentInDB->isStarred(), $content[0]['is_starred']); | 234 | $this->assertSame((int) $contentInDB->isStarred(), $content[0]['is_starred']); |
235 | $this->assertEquals($contentInDB->getTitle(), $content[0]['title']); | 235 | $this->assertSame($contentInDB->getTitle(), $content[0]['title']); |
236 | $this->assertEquals($contentInDB->getUrl(), $content[0]['url']); | 236 | $this->assertSame($contentInDB->getUrl(), $content[0]['url']); |
237 | $this->assertEquals([['text' => 'This is my annotation /o/', 'quote' => 'content']], $content[0]['annotations']); | 237 | $this->assertSame([['text' => 'This is my annotation /o/', 'quote' => 'content']], $content[0]['annotations']); |
238 | $this->assertEquals($contentInDB->getMimetype(), $content[0]['mimetype']); | 238 | $this->assertSame($contentInDB->getMimetype(), $content[0]['mimetype']); |
239 | $this->assertEquals($contentInDB->getLanguage(), $content[0]['language']); | 239 | $this->assertSame($contentInDB->getLanguage(), $content[0]['language']); |
240 | $this->assertEquals($contentInDB->getReadingtime(), $content[0]['reading_time']); | 240 | $this->assertSame($contentInDB->getReadingtime(), $content[0]['reading_time']); |
241 | $this->assertEquals($contentInDB->getDomainname(), $content[0]['domain_name']); | 241 | $this->assertSame($contentInDB->getDomainname(), $content[0]['domain_name']); |
242 | $this->assertEquals(['foo bar', 'baz'], $content[0]['tags']); | 242 | $this->assertSame(['foo bar', 'baz'], $content[0]['tags']); |
243 | } | 243 | } |
244 | 244 | ||
245 | public function testXmlExport() | 245 | public function testXmlExport() |
@@ -262,16 +262,16 @@ class ExportControllerTest extends WallabagCoreTestCase | |||
262 | $crawler = $client->request('GET', '/export/unread.xml'); | 262 | $crawler = $client->request('GET', '/export/unread.xml'); |
263 | ob_end_clean(); | 263 | ob_end_clean(); |
264 | 264 | ||
265 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 265 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
266 | 266 | ||
267 | $headers = $client->getResponse()->headers; | 267 | $headers = $client->getResponse()->headers; |
268 | $this->assertEquals('application/xml', $headers->get('content-type')); | 268 | $this->assertSame('application/xml', $headers->get('content-type')); |
269 | $this->assertEquals('attachment; filename="Unread articles.xml"', $headers->get('content-disposition')); | 269 | $this->assertSame('attachment; filename="Unread articles.xml"', $headers->get('content-disposition')); |
270 | $this->assertEquals('UTF-8', $headers->get('content-transfer-encoding')); | 270 | $this->assertSame('UTF-8', $headers->get('content-transfer-encoding')); |
271 | 271 | ||
272 | $content = new \SimpleXMLElement($client->getResponse()->getContent()); | 272 | $content = new \SimpleXMLElement($client->getResponse()->getContent()); |
273 | $this->assertGreaterThan(0, $content->count()); | 273 | $this->assertGreaterThan(0, $content->count()); |
274 | $this->assertEquals(count($contentInDB), $content->count()); | 274 | $this->assertSame(count($contentInDB), $content->count()); |
275 | $this->assertNotEmpty('id', (string) $content->entry[0]->id); | 275 | $this->assertNotEmpty('id', (string) $content->entry[0]->id); |
276 | $this->assertNotEmpty('title', (string) $content->entry[0]->title); | 276 | $this->assertNotEmpty('title', (string) $content->entry[0]->title); |
277 | $this->assertNotEmpty('url', (string) $content->entry[0]->url); | 277 | $this->assertNotEmpty('url', (string) $content->entry[0]->url); |
diff --git a/tests/Wallabag/CoreBundle/Controller/RssControllerTest.php b/tests/Wallabag/CoreBundle/Controller/RssControllerTest.php index 530c8bbf..6167fe2d 100644 --- a/tests/Wallabag/CoreBundle/Controller/RssControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/RssControllerTest.php | |||
@@ -16,36 +16,36 @@ class RssControllerTest extends WallabagCoreTestCase | |||
16 | if (null === $nb) { | 16 | if (null === $nb) { |
17 | $this->assertGreaterThan(0, $xpath->query('//item')->length); | 17 | $this->assertGreaterThan(0, $xpath->query('//item')->length); |
18 | } else { | 18 | } else { |
19 | $this->assertEquals($nb, $xpath->query('//item')->length); | 19 | $this->assertSame($nb, $xpath->query('//item')->length); |
20 | } | 20 | } |
21 | 21 | ||
22 | $this->assertEquals(1, $xpath->query('/rss')->length); | 22 | $this->assertSame(1, $xpath->query('/rss')->length); |
23 | $this->assertEquals(1, $xpath->query('/rss/channel')->length); | 23 | $this->assertSame(1, $xpath->query('/rss/channel')->length); |
24 | 24 | ||
25 | $this->assertEquals(1, $xpath->query('/rss/channel/title')->length); | 25 | $this->assertSame(1, $xpath->query('/rss/channel/title')->length); |
26 | $this->assertEquals('wallabag - '.$type.' feed', $xpath->query('/rss/channel/title')->item(0)->nodeValue); | 26 | $this->assertSame('wallabag - ' . $type . ' feed', $xpath->query('/rss/channel/title')->item(0)->nodeValue); |
27 | 27 | ||
28 | $this->assertEquals(1, $xpath->query('/rss/channel/pubDate')->length); | 28 | $this->assertSame(1, $xpath->query('/rss/channel/pubDate')->length); |
29 | 29 | ||
30 | $this->assertEquals(1, $xpath->query('/rss/channel/generator')->length); | 30 | $this->assertSame(1, $xpath->query('/rss/channel/generator')->length); |
31 | $this->assertEquals('wallabag', $xpath->query('/rss/channel/generator')->item(0)->nodeValue); | 31 | $this->assertSame('wallabag', $xpath->query('/rss/channel/generator')->item(0)->nodeValue); |
32 | 32 | ||
33 | $this->assertEquals(1, $xpath->query('/rss/channel/description')->length); | 33 | $this->assertSame(1, $xpath->query('/rss/channel/description')->length); |
34 | $this->assertEquals('wallabag '.$type.' elements', $xpath->query('/rss/channel/description')->item(0)->nodeValue); | 34 | $this->assertSame('wallabag ' . $type . ' elements', $xpath->query('/rss/channel/description')->item(0)->nodeValue); |
35 | 35 | ||
36 | $this->assertEquals(1, $xpath->query('/rss/channel/link[@rel="self"]')->length); | 36 | $this->assertSame(1, $xpath->query('/rss/channel/link[@rel="self"]')->length); |
37 | $this->assertContains($urlPagination.'.xml', $xpath->query('/rss/channel/link[@rel="self"]')->item(0)->getAttribute('href')); | 37 | $this->assertContains($urlPagination . '.xml', $xpath->query('/rss/channel/link[@rel="self"]')->item(0)->getAttribute('href')); |
38 | 38 | ||
39 | $this->assertEquals(1, $xpath->query('/rss/channel/link[@rel="last"]')->length); | 39 | $this->assertSame(1, $xpath->query('/rss/channel/link[@rel="last"]')->length); |
40 | $this->assertContains($urlPagination.'.xml?page=', $xpath->query('/rss/channel/link[@rel="last"]')->item(0)->getAttribute('href')); | 40 | $this->assertContains($urlPagination . '.xml?page=', $xpath->query('/rss/channel/link[@rel="last"]')->item(0)->getAttribute('href')); |
41 | 41 | ||
42 | foreach ($xpath->query('//item') as $item) { | 42 | foreach ($xpath->query('//item') as $item) { |
43 | $this->assertEquals(1, $xpath->query('title', $item)->length); | 43 | $this->assertSame(1, $xpath->query('title', $item)->length); |
44 | $this->assertEquals(1, $xpath->query('source', $item)->length); | 44 | $this->assertSame(1, $xpath->query('source', $item)->length); |
45 | $this->assertEquals(1, $xpath->query('link', $item)->length); | 45 | $this->assertSame(1, $xpath->query('link', $item)->length); |
46 | $this->assertEquals(1, $xpath->query('guid', $item)->length); | 46 | $this->assertSame(1, $xpath->query('guid', $item)->length); |
47 | $this->assertEquals(1, $xpath->query('pubDate', $item)->length); | 47 | $this->assertSame(1, $xpath->query('pubDate', $item)->length); |
48 | $this->assertEquals(1, $xpath->query('description', $item)->length); | 48 | $this->assertSame(1, $xpath->query('description', $item)->length); |
49 | } | 49 | } |
50 | } | 50 | } |
51 | 51 | ||
@@ -73,7 +73,7 @@ class RssControllerTest extends WallabagCoreTestCase | |||
73 | 73 | ||
74 | $client->request('GET', $url); | 74 | $client->request('GET', $url); |
75 | 75 | ||
76 | $this->assertEquals(404, $client->getResponse()->getStatusCode()); | 76 | $this->assertSame(404, $client->getResponse()->getStatusCode()); |
77 | } | 77 | } |
78 | 78 | ||
79 | public function testUnread() | 79 | public function testUnread() |
@@ -92,7 +92,7 @@ class RssControllerTest extends WallabagCoreTestCase | |||
92 | 92 | ||
93 | $client->request('GET', '/admin/SUPERTOKEN/unread.xml'); | 93 | $client->request('GET', '/admin/SUPERTOKEN/unread.xml'); |
94 | 94 | ||
95 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 95 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
96 | 96 | ||
97 | $this->validateDom($client->getResponse()->getContent(), 'unread', 'unread', 2); | 97 | $this->validateDom($client->getResponse()->getContent(), 'unread', 'unread', 2); |
98 | } | 98 | } |
@@ -114,7 +114,7 @@ class RssControllerTest extends WallabagCoreTestCase | |||
114 | $client = $this->getClient(); | 114 | $client = $this->getClient(); |
115 | $client->request('GET', '/admin/SUPERTOKEN/starred.xml'); | 115 | $client->request('GET', '/admin/SUPERTOKEN/starred.xml'); |
116 | 116 | ||
117 | $this->assertEquals(200, $client->getResponse()->getStatusCode(), 1); | 117 | $this->assertSame(200, $client->getResponse()->getStatusCode(), 1); |
118 | 118 | ||
119 | $this->validateDom($client->getResponse()->getContent(), 'starred', 'starred'); | 119 | $this->validateDom($client->getResponse()->getContent(), 'starred', 'starred'); |
120 | } | 120 | } |
@@ -136,7 +136,7 @@ class RssControllerTest extends WallabagCoreTestCase | |||
136 | $client = $this->getClient(); | 136 | $client = $this->getClient(); |
137 | $client->request('GET', '/admin/SUPERTOKEN/archive.xml'); | 137 | $client->request('GET', '/admin/SUPERTOKEN/archive.xml'); |
138 | 138 | ||
139 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 139 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
140 | 140 | ||
141 | $this->validateDom($client->getResponse()->getContent(), 'archive', 'archive'); | 141 | $this->validateDom($client->getResponse()->getContent(), 'archive', 'archive'); |
142 | } | 142 | } |
@@ -158,15 +158,15 @@ class RssControllerTest extends WallabagCoreTestCase | |||
158 | $client = $this->getClient(); | 158 | $client = $this->getClient(); |
159 | 159 | ||
160 | $client->request('GET', '/admin/SUPERTOKEN/unread.xml'); | 160 | $client->request('GET', '/admin/SUPERTOKEN/unread.xml'); |
161 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 161 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
162 | $this->validateDom($client->getResponse()->getContent(), 'unread', 'unread'); | 162 | $this->validateDom($client->getResponse()->getContent(), 'unread', 'unread'); |
163 | 163 | ||
164 | $client->request('GET', '/admin/SUPERTOKEN/unread.xml?page=2'); | 164 | $client->request('GET', '/admin/SUPERTOKEN/unread.xml?page=2'); |
165 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 165 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
166 | $this->validateDom($client->getResponse()->getContent(), 'unread', 'unread'); | 166 | $this->validateDom($client->getResponse()->getContent(), 'unread', 'unread'); |
167 | 167 | ||
168 | $client->request('GET', '/admin/SUPERTOKEN/unread.xml?page=3000'); | 168 | $client->request('GET', '/admin/SUPERTOKEN/unread.xml?page=3000'); |
169 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 169 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
170 | } | 170 | } |
171 | 171 | ||
172 | public function testTags() | 172 | public function testTags() |
@@ -186,11 +186,11 @@ class RssControllerTest extends WallabagCoreTestCase | |||
186 | $client = $this->getClient(); | 186 | $client = $this->getClient(); |
187 | $client->request('GET', '/admin/SUPERTOKEN/tags/foo-bar.xml'); | 187 | $client->request('GET', '/admin/SUPERTOKEN/tags/foo-bar.xml'); |
188 | 188 | ||
189 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 189 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
190 | 190 | ||
191 | $this->validateDom($client->getResponse()->getContent(), 'tag (foo bar)', 'tags/foo-bar'); | 191 | $this->validateDom($client->getResponse()->getContent(), 'tag (foo bar)', 'tags/foo-bar'); |
192 | 192 | ||
193 | $client->request('GET', '/admin/SUPERTOKEN/tags/foo-bar.xml?page=3000'); | 193 | $client->request('GET', '/admin/SUPERTOKEN/tags/foo-bar.xml?page=3000'); |
194 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 194 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
195 | } | 195 | } |
196 | } | 196 | } |
diff --git a/tests/Wallabag/CoreBundle/Controller/SettingsControllerTest.php b/tests/Wallabag/CoreBundle/Controller/SettingsControllerTest.php index 9b8b5702..6005c0df 100644 --- a/tests/Wallabag/CoreBundle/Controller/SettingsControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/SettingsControllerTest.php | |||
@@ -17,7 +17,7 @@ class SettingsControllerTest extends WallabagCoreTestCase | |||
17 | 17 | ||
18 | $crawler = $client->request('GET', '/settings'); | 18 | $crawler = $client->request('GET', '/settings'); |
19 | 19 | ||
20 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 20 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
21 | } | 21 | } |
22 | 22 | ||
23 | public function testSettingsWithNormalUser() | 23 | public function testSettingsWithNormalUser() |
@@ -27,6 +27,6 @@ class SettingsControllerTest extends WallabagCoreTestCase | |||
27 | 27 | ||
28 | $crawler = $client->request('GET', '/settings'); | 28 | $crawler = $client->request('GET', '/settings'); |
29 | 29 | ||
30 | $this->assertEquals(403, $client->getResponse()->getStatusCode()); | 30 | $this->assertSame(403, $client->getResponse()->getStatusCode()); |
31 | } | 31 | } |
32 | } | 32 | } |
diff --git a/tests/Wallabag/CoreBundle/Controller/SiteCredentialControllerTest.php b/tests/Wallabag/CoreBundle/Controller/SiteCredentialControllerTest.php index e73a9743..87ea2867 100644 --- a/tests/Wallabag/CoreBundle/Controller/SiteCredentialControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/SiteCredentialControllerTest.php | |||
@@ -15,7 +15,7 @@ class SiteCredentialControllerTest extends WallabagCoreTestCase | |||
15 | 15 | ||
16 | $crawler = $client->request('GET', '/site-credentials/'); | 16 | $crawler = $client->request('GET', '/site-credentials/'); |
17 | 17 | ||
18 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 18 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
19 | 19 | ||
20 | $body = $crawler->filter('body')->extract(['_text'])[0]; | 20 | $body = $crawler->filter('body')->extract(['_text'])[0]; |
21 | 21 | ||
@@ -30,7 +30,7 @@ class SiteCredentialControllerTest extends WallabagCoreTestCase | |||
30 | 30 | ||
31 | $crawler = $client->request('GET', '/site-credentials/new'); | 31 | $crawler = $client->request('GET', '/site-credentials/new'); |
32 | 32 | ||
33 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 33 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
34 | 34 | ||
35 | $body = $crawler->filter('body')->extract(['_text'])[0]; | 35 | $body = $crawler->filter('body')->extract(['_text'])[0]; |
36 | 36 | ||
@@ -47,7 +47,7 @@ class SiteCredentialControllerTest extends WallabagCoreTestCase | |||
47 | 47 | ||
48 | $client->submit($form, $data); | 48 | $client->submit($form, $data); |
49 | 49 | ||
50 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 50 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
51 | 51 | ||
52 | $crawler = $client->followRedirect(); | 52 | $crawler = $client->followRedirect(); |
53 | 53 | ||
@@ -61,9 +61,9 @@ class SiteCredentialControllerTest extends WallabagCoreTestCase | |||
61 | 61 | ||
62 | $credential = $this->createSiteCredential($client); | 62 | $credential = $this->createSiteCredential($client); |
63 | 63 | ||
64 | $crawler = $client->request('GET', '/site-credentials/'.$credential->getId().'/edit'); | 64 | $crawler = $client->request('GET', '/site-credentials/' . $credential->getId() . '/edit'); |
65 | 65 | ||
66 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 66 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
67 | 67 | ||
68 | $body = $crawler->filter('body')->extract(['_text'])[0]; | 68 | $body = $crawler->filter('body')->extract(['_text'])[0]; |
69 | 69 | ||
@@ -80,7 +80,7 @@ class SiteCredentialControllerTest extends WallabagCoreTestCase | |||
80 | 80 | ||
81 | $client->submit($form, $data); | 81 | $client->submit($form, $data); |
82 | 82 | ||
83 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 83 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
84 | 84 | ||
85 | $crawler = $client->followRedirect(); | 85 | $crawler = $client->followRedirect(); |
86 | 86 | ||
@@ -96,9 +96,9 @@ class SiteCredentialControllerTest extends WallabagCoreTestCase | |||
96 | 96 | ||
97 | $this->logInAs('bob'); | 97 | $this->logInAs('bob'); |
98 | 98 | ||
99 | $client->request('GET', '/site-credentials/'.$credential->getId().'/edit'); | 99 | $client->request('GET', '/site-credentials/' . $credential->getId() . '/edit'); |
100 | 100 | ||
101 | $this->assertEquals(403, $client->getResponse()->getStatusCode()); | 101 | $this->assertSame(403, $client->getResponse()->getStatusCode()); |
102 | } | 102 | } |
103 | 103 | ||
104 | public function testDeleteSiteCredential() | 104 | public function testDeleteSiteCredential() |
@@ -108,15 +108,15 @@ class SiteCredentialControllerTest extends WallabagCoreTestCase | |||
108 | 108 | ||
109 | $credential = $this->createSiteCredential($client); | 109 | $credential = $this->createSiteCredential($client); |
110 | 110 | ||
111 | $crawler = $client->request('GET', '/site-credentials/'.$credential->getId().'/edit'); | 111 | $crawler = $client->request('GET', '/site-credentials/' . $credential->getId() . '/edit'); |
112 | 112 | ||
113 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 113 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
114 | 114 | ||
115 | $deleteForm = $crawler->filter('body')->selectButton('site_credential.form.delete')->form(); | 115 | $deleteForm = $crawler->filter('body')->selectButton('site_credential.form.delete')->form(); |
116 | 116 | ||
117 | $client->submit($deleteForm, []); | 117 | $client->submit($deleteForm, []); |
118 | 118 | ||
119 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 119 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
120 | 120 | ||
121 | $crawler = $client->followRedirect(); | 121 | $crawler = $client->followRedirect(); |
122 | 122 | ||
diff --git a/tests/Wallabag/CoreBundle/Controller/StaticControllerTest.php b/tests/Wallabag/CoreBundle/Controller/StaticControllerTest.php index 98a37b50..17847937 100644 --- a/tests/Wallabag/CoreBundle/Controller/StaticControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/StaticControllerTest.php | |||
@@ -13,7 +13,7 @@ class StaticControllerTest extends WallabagCoreTestCase | |||
13 | 13 | ||
14 | $client->request('GET', '/about'); | 14 | $client->request('GET', '/about'); |
15 | 15 | ||
16 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 16 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
17 | } | 17 | } |
18 | 18 | ||
19 | public function testHowto() | 19 | public function testHowto() |
@@ -23,6 +23,6 @@ class StaticControllerTest extends WallabagCoreTestCase | |||
23 | 23 | ||
24 | $client->request('GET', '/howto'); | 24 | $client->request('GET', '/howto'); |
25 | 25 | ||
26 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 26 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
27 | } | 27 | } |
28 | } | 28 | } |
diff --git a/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php b/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php index af1ad7af..be25a8b5 100644 --- a/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php | |||
@@ -17,7 +17,7 @@ class TagControllerTest extends WallabagCoreTestCase | |||
17 | 17 | ||
18 | $client->request('GET', '/tag/list'); | 18 | $client->request('GET', '/tag/list'); |
19 | 19 | ||
20 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 20 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
21 | } | 21 | } |
22 | 22 | ||
23 | public function testAddTagToEntry() | 23 | public function testAddTagToEntry() |
@@ -31,7 +31,7 @@ class TagControllerTest extends WallabagCoreTestCase | |||
31 | $this->getEntityManager()->flush(); | 31 | $this->getEntityManager()->flush(); |
32 | $this->getEntityManager()->clear(); | 32 | $this->getEntityManager()->clear(); |
33 | 33 | ||
34 | $crawler = $client->request('GET', '/view/'.$entry->getId()); | 34 | $crawler = $client->request('GET', '/view/' . $entry->getId()); |
35 | 35 | ||
36 | $form = $crawler->filter('form[name=tag]')->form(); | 36 | $form = $crawler->filter('form[name=tag]')->form(); |
37 | 37 | ||
@@ -40,7 +40,7 @@ class TagControllerTest extends WallabagCoreTestCase | |||
40 | ]; | 40 | ]; |
41 | 41 | ||
42 | $client->submit($form, $data); | 42 | $client->submit($form, $data); |
43 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 43 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
44 | 44 | ||
45 | // be sure to reload the entry | 45 | // be sure to reload the entry |
46 | $entry = $this->getEntityManager()->getRepository(Entry::class)->find($entry->getId()); | 46 | $entry = $this->getEntityManager()->getRepository(Entry::class)->find($entry->getId()); |
@@ -48,7 +48,7 @@ class TagControllerTest extends WallabagCoreTestCase | |||
48 | 48 | ||
49 | // tag already exists and already assigned | 49 | // tag already exists and already assigned |
50 | $client->submit($form, $data); | 50 | $client->submit($form, $data); |
51 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 51 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
52 | 52 | ||
53 | $entry = $this->getEntityManager()->getRepository(Entry::class)->find($entry->getId()); | 53 | $entry = $this->getEntityManager()->getRepository(Entry::class)->find($entry->getId()); |
54 | $this->assertCount(1, $entry->getTags()); | 54 | $this->assertCount(1, $entry->getTags()); |
@@ -59,7 +59,7 @@ class TagControllerTest extends WallabagCoreTestCase | |||
59 | ]; | 59 | ]; |
60 | 60 | ||
61 | $client->submit($form, $data); | 61 | $client->submit($form, $data); |
62 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 62 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
63 | 63 | ||
64 | $entry = $this->getEntityManager()->getRepository(Entry::class)->find($entry->getId()); | 64 | $entry = $this->getEntityManager()->getRepository(Entry::class)->find($entry->getId()); |
65 | $this->assertCount(2, $entry->getTags()); | 65 | $this->assertCount(2, $entry->getTags()); |
@@ -75,7 +75,7 @@ class TagControllerTest extends WallabagCoreTestCase | |||
75 | ->getRepository('WallabagCoreBundle:Entry') | 75 | ->getRepository('WallabagCoreBundle:Entry') |
76 | ->findByUrlAndUserId('http://0.0.0.0/entry2', $this->getLoggedInUserId()); | 76 | ->findByUrlAndUserId('http://0.0.0.0/entry2', $this->getLoggedInUserId()); |
77 | 77 | ||
78 | $crawler = $client->request('GET', '/view/'.$entry->getId()); | 78 | $crawler = $client->request('GET', '/view/' . $entry->getId()); |
79 | 79 | ||
80 | $form = $crawler->filter('form[name=tag]')->form(); | 80 | $form = $crawler->filter('form[name=tag]')->form(); |
81 | 81 | ||
@@ -84,7 +84,7 @@ class TagControllerTest extends WallabagCoreTestCase | |||
84 | ]; | 84 | ]; |
85 | 85 | ||
86 | $client->submit($form, $data); | 86 | $client->submit($form, $data); |
87 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 87 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
88 | 88 | ||
89 | $newEntry = $client->getContainer() | 89 | $newEntry = $client->getContainer() |
90 | ->get('doctrine.orm.entity_manager') | 90 | ->get('doctrine.orm.entity_manager') |
@@ -97,8 +97,8 @@ class TagControllerTest extends WallabagCoreTestCase | |||
97 | } | 97 | } |
98 | 98 | ||
99 | $this->assertGreaterThanOrEqual(2, count($tags)); | 99 | $this->assertGreaterThanOrEqual(2, count($tags)); |
100 | $this->assertNotFalse(array_search('foo2', $tags), 'Tag foo2 is assigned to the entry'); | 100 | $this->assertNotFalse(array_search('foo2', $tags, true), 'Tag foo2 is assigned to the entry'); |
101 | $this->assertNotFalse(array_search('bar2', $tags), 'Tag bar2 is assigned to the entry'); | 101 | $this->assertNotFalse(array_search('bar2', $tags, true), 'Tag bar2 is assigned to the entry'); |
102 | } | 102 | } |
103 | 103 | ||
104 | public function testRemoveTagFromEntry() | 104 | public function testRemoveTagFromEntry() |
@@ -116,27 +116,27 @@ class TagControllerTest extends WallabagCoreTestCase | |||
116 | $this->getEntityManager()->clear(); | 116 | $this->getEntityManager()->clear(); |
117 | 117 | ||
118 | // We make a first request to set an history and test redirection after tag deletion | 118 | // We make a first request to set an history and test redirection after tag deletion |
119 | $client->request('GET', '/view/'.$entry->getId()); | 119 | $client->request('GET', '/view/' . $entry->getId()); |
120 | $entryUri = $client->getRequest()->getUri(); | 120 | $entryUri = $client->getRequest()->getUri(); |
121 | $client->request('GET', '/remove-tag/'.$entry->getId().'/'.$tag->getId()); | 121 | $client->request('GET', '/remove-tag/' . $entry->getId() . '/' . $tag->getId()); |
122 | 122 | ||
123 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 123 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
124 | $this->assertEquals($entryUri, $client->getResponse()->getTargetUrl()); | 124 | $this->assertSame($entryUri, $client->getResponse()->getTargetUrl()); |
125 | 125 | ||
126 | // re-retrieve the entry to be sure to get fresh data from database (mostly for tags) | 126 | // re-retrieve the entry to be sure to get fresh data from database (mostly for tags) |
127 | $entry = $this->getEntityManager()->getRepository(Entry::class)->find($entry->getId()); | 127 | $entry = $this->getEntityManager()->getRepository(Entry::class)->find($entry->getId()); |
128 | $this->assertNotContains($this->tagName, $entry->getTags()); | 128 | $this->assertNotContains($this->tagName, $entry->getTags()); |
129 | 129 | ||
130 | $client->request('GET', '/remove-tag/'.$entry->getId().'/'.$tag->getId()); | 130 | $client->request('GET', '/remove-tag/' . $entry->getId() . '/' . $tag->getId()); |
131 | 131 | ||
132 | $this->assertEquals(404, $client->getResponse()->getStatusCode()); | 132 | $this->assertSame(404, $client->getResponse()->getStatusCode()); |
133 | 133 | ||
134 | $tag = $client->getContainer() | 134 | $tag = $client->getContainer() |
135 | ->get('doctrine.orm.entity_manager') | 135 | ->get('doctrine.orm.entity_manager') |
136 | ->getRepository('WallabagCoreBundle:Tag') | 136 | ->getRepository('WallabagCoreBundle:Tag') |
137 | ->findOneByLabel($this->tagName); | 137 | ->findOneByLabel($this->tagName); |
138 | 138 | ||
139 | $this->assertNull($tag, $this->tagName.' was removed because it begun an orphan tag'); | 139 | $this->assertNull($tag, $this->tagName . ' was removed because it begun an orphan tag'); |
140 | } | 140 | } |
141 | 141 | ||
142 | public function testShowEntriesForTagAction() | 142 | public function testShowEntriesForTagAction() |
@@ -165,9 +165,9 @@ class TagControllerTest extends WallabagCoreTestCase | |||
165 | ->getRepository('WallabagCoreBundle:Tag') | 165 | ->getRepository('WallabagCoreBundle:Tag') |
166 | ->findOneByEntryAndTagLabel($entry, $this->tagName); | 166 | ->findOneByEntryAndTagLabel($entry, $this->tagName); |
167 | 167 | ||
168 | $crawler = $client->request('GET', '/tag/list/'.$tag->getSlug()); | 168 | $crawler = $client->request('GET', '/tag/list/' . $tag->getSlug()); |
169 | 169 | ||
170 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 170 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
171 | $this->assertCount(1, $crawler->filter('[id*="entry-"]')); | 171 | $this->assertCount(1, $crawler->filter('[id*="entry-"]')); |
172 | 172 | ||
173 | $entry->removeTag($tag); | 173 | $entry->removeTag($tag); |
diff --git a/tests/Wallabag/CoreBundle/Event/Listener/LocaleListenerTest.php b/tests/Wallabag/CoreBundle/Event/Listener/LocaleListenerTest.php index 84a54d3a..0dbd9f70 100644 --- a/tests/Wallabag/CoreBundle/Event/Listener/LocaleListenerTest.php +++ b/tests/Wallabag/CoreBundle/Event/Listener/LocaleListenerTest.php | |||
@@ -13,15 +13,6 @@ use Wallabag\CoreBundle\Event\Listener\LocaleListener; | |||
13 | 13 | ||
14 | class LocaleListenerTest extends \PHPUnit_Framework_TestCase | 14 | class LocaleListenerTest extends \PHPUnit_Framework_TestCase |
15 | { | 15 | { |
16 | private function getEvent(Request $request) | ||
17 | { | ||
18 | $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface') | ||
19 | ->disableOriginalConstructor() | ||
20 | ->getMock(); | ||
21 | |||
22 | return new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST); | ||
23 | } | ||
24 | |||
25 | public function testWithoutSession() | 16 | public function testWithoutSession() |
26 | { | 17 | { |
27 | $request = Request::create('/'); | 18 | $request = Request::create('/'); |
@@ -30,7 +21,7 @@ class LocaleListenerTest extends \PHPUnit_Framework_TestCase | |||
30 | $event = $this->getEvent($request); | 21 | $event = $this->getEvent($request); |
31 | 22 | ||
32 | $listener->onKernelRequest($event); | 23 | $listener->onKernelRequest($event); |
33 | $this->assertEquals('en', $request->getLocale()); | 24 | $this->assertSame('en', $request->getLocale()); |
34 | } | 25 | } |
35 | 26 | ||
36 | public function testWithPreviousSession() | 27 | public function testWithPreviousSession() |
@@ -44,7 +35,7 @@ class LocaleListenerTest extends \PHPUnit_Framework_TestCase | |||
44 | $event = $this->getEvent($request); | 35 | $event = $this->getEvent($request); |
45 | 36 | ||
46 | $listener->onKernelRequest($event); | 37 | $listener->onKernelRequest($event); |
47 | $this->assertEquals('fr', $request->getLocale()); | 38 | $this->assertSame('fr', $request->getLocale()); |
48 | } | 39 | } |
49 | 40 | ||
50 | public function testLocaleFromRequestAttribute() | 41 | public function testLocaleFromRequestAttribute() |
@@ -59,8 +50,8 @@ class LocaleListenerTest extends \PHPUnit_Framework_TestCase | |||
59 | $event = $this->getEvent($request); | 50 | $event = $this->getEvent($request); |
60 | 51 | ||
61 | $listener->onKernelRequest($event); | 52 | $listener->onKernelRequest($event); |
62 | $this->assertEquals('en', $request->getLocale()); | 53 | $this->assertSame('en', $request->getLocale()); |
63 | $this->assertEquals('es', $request->getSession()->get('_locale')); | 54 | $this->assertSame('es', $request->getSession()->get('_locale')); |
64 | } | 55 | } |
65 | 56 | ||
66 | public function testSubscribedEvents() | 57 | public function testSubscribedEvents() |
@@ -81,6 +72,15 @@ class LocaleListenerTest extends \PHPUnit_Framework_TestCase | |||
81 | $event | 72 | $event |
82 | ); | 73 | ); |
83 | 74 | ||
84 | $this->assertEquals('fr', $request->getLocale()); | 75 | $this->assertSame('fr', $request->getLocale()); |
76 | } | ||
77 | |||
78 | private function getEvent(Request $request) | ||
79 | { | ||
80 | $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface') | ||
81 | ->disableOriginalConstructor() | ||
82 | ->getMock(); | ||
83 | |||
84 | return new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST); | ||
85 | } | 85 | } |
86 | } | 86 | } |
diff --git a/tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php b/tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php index 45aecc63..5ffe1ca6 100644 --- a/tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php +++ b/tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php | |||
@@ -32,7 +32,7 @@ class UserLocaleListenerTest extends \PHPUnit_Framework_TestCase | |||
32 | 32 | ||
33 | $listener->onInteractiveLogin($event); | 33 | $listener->onInteractiveLogin($event); |
34 | 34 | ||
35 | $this->assertEquals('fr', $session->get('_locale')); | 35 | $this->assertSame('fr', $session->get('_locale')); |
36 | } | 36 | } |
37 | 37 | ||
38 | public function testWithoutLanguage() | 38 | public function testWithoutLanguage() |
@@ -53,6 +53,6 @@ class UserLocaleListenerTest extends \PHPUnit_Framework_TestCase | |||
53 | 53 | ||
54 | $listener->onInteractiveLogin($event); | 54 | $listener->onInteractiveLogin($event); |
55 | 55 | ||
56 | $this->assertEquals('', $session->get('_locale')); | 56 | $this->assertNull($session->get('_locale')); |
57 | } | 57 | } |
58 | } | 58 | } |
diff --git a/tests/Wallabag/CoreBundle/Event/Subscriber/TablePrefixSubscriberTest.php b/tests/Wallabag/CoreBundle/Event/Subscriber/TablePrefixSubscriberTest.php index b8cd0fad..64e3c6d9 100644 --- a/tests/Wallabag/CoreBundle/Event/Subscriber/TablePrefixSubscriberTest.php +++ b/tests/Wallabag/CoreBundle/Event/Subscriber/TablePrefixSubscriberTest.php | |||
@@ -46,12 +46,12 @@ class TablePrefixSubscriberTest extends \PHPUnit_Framework_TestCase | |||
46 | 46 | ||
47 | $metaDataEvent = new LoadClassMetadataEventArgs($metaClass, $em); | 47 | $metaDataEvent = new LoadClassMetadataEventArgs($metaClass, $em); |
48 | 48 | ||
49 | $this->assertEquals($tableNameExpected, $metaDataEvent->getClassMetadata()->getTableName()); | 49 | $this->assertSame($tableNameExpected, $metaDataEvent->getClassMetadata()->getTableName()); |
50 | 50 | ||
51 | $subscriber->loadClassMetadata($metaDataEvent); | 51 | $subscriber->loadClassMetadata($metaDataEvent); |
52 | 52 | ||
53 | $this->assertEquals($finalTableName, $metaDataEvent->getClassMetadata()->getTableName()); | 53 | $this->assertSame($finalTableName, $metaDataEvent->getClassMetadata()->getTableName()); |
54 | $this->assertEquals($finalTableNameQuoted, $metaDataEvent->getClassMetadata()->getQuotedTableName($platform)); | 54 | $this->assertSame($finalTableNameQuoted, $metaDataEvent->getClassMetadata()->getQuotedTableName($platform)); |
55 | } | 55 | } |
56 | 56 | ||
57 | /** | 57 | /** |
@@ -75,8 +75,8 @@ class TablePrefixSubscriberTest extends \PHPUnit_Framework_TestCase | |||
75 | 75 | ||
76 | $evm->dispatchEvent('loadClassMetadata', $metaDataEvent); | 76 | $evm->dispatchEvent('loadClassMetadata', $metaDataEvent); |
77 | 77 | ||
78 | $this->assertEquals($finalTableName, $metaDataEvent->getClassMetadata()->getTableName()); | 78 | $this->assertSame($finalTableName, $metaDataEvent->getClassMetadata()->getTableName()); |
79 | $this->assertEquals($finalTableNameQuoted, $metaDataEvent->getClassMetadata()->getQuotedTableName($platform)); | 79 | $this->assertSame($finalTableNameQuoted, $metaDataEvent->getClassMetadata()->getQuotedTableName($platform)); |
80 | } | 80 | } |
81 | 81 | ||
82 | public function testPrefixManyToMany() | 82 | public function testPrefixManyToMany() |
@@ -103,12 +103,12 @@ class TablePrefixSubscriberTest extends \PHPUnit_Framework_TestCase | |||
103 | 103 | ||
104 | $metaDataEvent = new LoadClassMetadataEventArgs($metaClass, $em); | 104 | $metaDataEvent = new LoadClassMetadataEventArgs($metaClass, $em); |
105 | 105 | ||
106 | $this->assertEquals('entry', $metaDataEvent->getClassMetadata()->getTableName()); | 106 | $this->assertSame('entry', $metaDataEvent->getClassMetadata()->getTableName()); |
107 | 107 | ||
108 | $subscriber->loadClassMetadata($metaDataEvent); | 108 | $subscriber->loadClassMetadata($metaDataEvent); |
109 | 109 | ||
110 | $this->assertEquals('yo_entry', $metaDataEvent->getClassMetadata()->getTableName()); | 110 | $this->assertSame('yo_entry', $metaDataEvent->getClassMetadata()->getTableName()); |
111 | $this->assertEquals('yo_entry_tag', $metaDataEvent->getClassMetadata()->associationMappings['tags']['joinTable']['name']); | 111 | $this->assertSame('yo_entry_tag', $metaDataEvent->getClassMetadata()->associationMappings['tags']['joinTable']['name']); |
112 | $this->assertEquals('yo_entry', $metaDataEvent->getClassMetadata()->getQuotedTableName(new \Doctrine\DBAL\Platforms\MySqlPlatform())); | 112 | $this->assertSame('yo_entry', $metaDataEvent->getClassMetadata()->getQuotedTableName(new \Doctrine\DBAL\Platforms\MySqlPlatform())); |
113 | } | 113 | } |
114 | } | 114 | } |
diff --git a/tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php b/tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php index b0c81e7b..5d6a29fe 100644 --- a/tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php +++ b/tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php | |||
@@ -2,13 +2,12 @@ | |||
2 | 2 | ||
3 | namespace Tests\Wallabag\CoreBundle\GuzzleSiteAuthenticator; | 3 | namespace Tests\Wallabag\CoreBundle\GuzzleSiteAuthenticator; |
4 | 4 | ||
5 | use Graby\SiteConfig\SiteConfig as GrabySiteConfig; | ||
5 | use Monolog\Handler\TestHandler; | 6 | use Monolog\Handler\TestHandler; |
6 | use Monolog\Logger; | 7 | use Monolog\Logger; |
7 | use BD\GuzzleSiteAuthenticator\SiteConfig\SiteConfig; | ||
8 | use Graby\SiteConfig\SiteConfig as GrabySiteConfig; | ||
9 | use Wallabag\CoreBundle\GuzzleSiteAuthenticator\GrabySiteConfigBuilder; | ||
10 | use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; | ||
11 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; | 8 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; |
9 | use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; | ||
10 | use Wallabag\CoreBundle\GuzzleSiteAuthenticator\GrabySiteConfigBuilder; | ||
12 | 11 | ||
13 | class GrabySiteConfigBuilderTest extends \PHPUnit_Framework_TestCase | 12 | class GrabySiteConfigBuilderTest extends \PHPUnit_Framework_TestCase |
14 | { | 13 | { |
@@ -68,20 +67,15 @@ class GrabySiteConfigBuilderTest extends \PHPUnit_Framework_TestCase | |||
68 | 67 | ||
69 | $config = $this->builder->buildForHost('www.example.com'); | 68 | $config = $this->builder->buildForHost('www.example.com'); |
70 | 69 | ||
71 | $this->assertEquals( | 70 | $this->assertSame('example.com', $config->getHost()); |
72 | new SiteConfig([ | 71 | $this->assertSame(true, $config->requiresLogin()); |
73 | 'host' => 'example.com', | 72 | $this->assertSame('http://www.example.com/login', $config->getLoginUri()); |
74 | 'requiresLogin' => true, | 73 | $this->assertSame('login', $config->getUsernameField()); |
75 | 'loginUri' => 'http://www.example.com/login', | 74 | $this->assertSame('password', $config->getPasswordField()); |
76 | 'usernameField' => 'login', | 75 | $this->assertSame(['field' => 'value'], $config->getExtraFields()); |
77 | 'passwordField' => 'password', | 76 | $this->assertSame('//div[@class="need-login"]', $config->getNotLoggedInXpath()); |
78 | 'extraFields' => ['field' => 'value'], | 77 | $this->assertSame('foo', $config->getUsername()); |
79 | 'notLoggedInXpath' => '//div[@class="need-login"]', | 78 | $this->assertSame('bar', $config->getPassword()); |
80 | 'username' => 'foo', | ||
81 | 'password' => 'bar', | ||
82 | ]), | ||
83 | $config | ||
84 | ); | ||
85 | 79 | ||
86 | $records = $handler->getRecords(); | 80 | $records = $handler->getRecords(); |
87 | 81 | ||
diff --git a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php index dbddbc5c..c63671c4 100644 --- a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php +++ b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php | |||
@@ -2,18 +2,18 @@ | |||
2 | 2 | ||
3 | namespace Tests\Wallabag\CoreBundle\Helper; | 3 | namespace Tests\Wallabag\CoreBundle\Helper; |
4 | 4 | ||
5 | use Psr\Log\NullLogger; | 5 | use Graby\Graby; |
6 | use Monolog\Logger; | ||
7 | use Monolog\Handler\TestHandler; | 6 | use Monolog\Handler\TestHandler; |
8 | use Wallabag\CoreBundle\Helper\ContentProxy; | 7 | use Monolog\Logger; |
8 | use Psr\Log\NullLogger; | ||
9 | use Symfony\Component\Validator\ConstraintViolation; | ||
10 | use Symfony\Component\Validator\ConstraintViolationList; | ||
11 | use Symfony\Component\Validator\Validator\RecursiveValidator; | ||
9 | use Wallabag\CoreBundle\Entity\Entry; | 12 | use Wallabag\CoreBundle\Entity\Entry; |
10 | use Wallabag\CoreBundle\Entity\Tag; | 13 | use Wallabag\CoreBundle\Entity\Tag; |
11 | use Wallabag\UserBundle\Entity\User; | 14 | use Wallabag\CoreBundle\Helper\ContentProxy; |
12 | use Wallabag\CoreBundle\Helper\RuleBasedTagger; | 15 | use Wallabag\CoreBundle\Helper\RuleBasedTagger; |
13 | use Graby\Graby; | 16 | use Wallabag\UserBundle\Entity\User; |
14 | use Symfony\Component\Validator\Validator\RecursiveValidator; | ||
15 | use Symfony\Component\Validator\ConstraintViolationList; | ||
16 | use Symfony\Component\Validator\ConstraintViolation; | ||
17 | 17 | ||
18 | class ContentProxyTest extends \PHPUnit_Framework_TestCase | 18 | class ContentProxyTest extends \PHPUnit_Framework_TestCase |
19 | { | 19 | { |
@@ -44,14 +44,14 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
44 | $entry = new Entry(new User()); | 44 | $entry = new Entry(new User()); |
45 | $proxy->updateEntry($entry, 'http://user@:80'); | 45 | $proxy->updateEntry($entry, 'http://user@:80'); |
46 | 46 | ||
47 | $this->assertEquals('http://user@:80', $entry->getUrl()); | 47 | $this->assertSame('http://user@:80', $entry->getUrl()); |
48 | $this->assertEmpty($entry->getTitle()); | 48 | $this->assertEmpty($entry->getTitle()); |
49 | $this->assertEquals($this->fetchingErrorMessage, $entry->getContent()); | 49 | $this->assertSame($this->fetchingErrorMessage, $entry->getContent()); |
50 | $this->assertEmpty($entry->getPreviewPicture()); | 50 | $this->assertEmpty($entry->getPreviewPicture()); |
51 | $this->assertEmpty($entry->getMimetype()); | 51 | $this->assertEmpty($entry->getMimetype()); |
52 | $this->assertEmpty($entry->getLanguage()); | 52 | $this->assertEmpty($entry->getLanguage()); |
53 | $this->assertEquals(0.0, $entry->getReadingTime()); | 53 | $this->assertSame(0.0, $entry->getReadingTime()); |
54 | $this->assertEquals(false, $entry->getDomainName()); | 54 | $this->assertSame(null, $entry->getDomainName()); |
55 | } | 55 | } |
56 | 56 | ||
57 | public function testWithEmptyContent() | 57 | public function testWithEmptyContent() |
@@ -79,14 +79,14 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
79 | $entry = new Entry(new User()); | 79 | $entry = new Entry(new User()); |
80 | $proxy->updateEntry($entry, 'http://0.0.0.0'); | 80 | $proxy->updateEntry($entry, 'http://0.0.0.0'); |
81 | 81 | ||
82 | $this->assertEquals('http://0.0.0.0', $entry->getUrl()); | 82 | $this->assertSame('http://0.0.0.0', $entry->getUrl()); |
83 | $this->assertEmpty($entry->getTitle()); | 83 | $this->assertEmpty($entry->getTitle()); |
84 | $this->assertEquals($this->fetchingErrorMessage, $entry->getContent()); | 84 | $this->assertSame($this->fetchingErrorMessage, $entry->getContent()); |
85 | $this->assertEmpty($entry->getPreviewPicture()); | 85 | $this->assertEmpty($entry->getPreviewPicture()); |
86 | $this->assertEmpty($entry->getMimetype()); | 86 | $this->assertEmpty($entry->getMimetype()); |
87 | $this->assertEmpty($entry->getLanguage()); | 87 | $this->assertEmpty($entry->getLanguage()); |
88 | $this->assertEquals(0.0, $entry->getReadingTime()); | 88 | $this->assertSame(0.0, $entry->getReadingTime()); |
89 | $this->assertEquals('0.0.0.0', $entry->getDomainName()); | 89 | $this->assertSame('0.0.0.0', $entry->getDomainName()); |
90 | } | 90 | } |
91 | 91 | ||
92 | public function testWithEmptyContentButOG() | 92 | public function testWithEmptyContentButOG() |
@@ -119,15 +119,15 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
119 | $entry = new Entry(new User()); | 119 | $entry = new Entry(new User()); |
120 | $proxy->updateEntry($entry, 'http://domain.io'); | 120 | $proxy->updateEntry($entry, 'http://domain.io'); |
121 | 121 | ||
122 | $this->assertEquals('http://domain.io', $entry->getUrl()); | 122 | $this->assertSame('http://domain.io', $entry->getUrl()); |
123 | $this->assertEquals('my title', $entry->getTitle()); | 123 | $this->assertSame('my title', $entry->getTitle()); |
124 | $this->assertEquals($this->fetchingErrorMessage.'<p><i>But we found a short description: </i></p>desc', $entry->getContent()); | 124 | $this->assertSame($this->fetchingErrorMessage . '<p><i>But we found a short description: </i></p>desc', $entry->getContent()); |
125 | $this->assertEmpty($entry->getPreviewPicture()); | 125 | $this->assertEmpty($entry->getPreviewPicture()); |
126 | $this->assertEmpty($entry->getLanguage()); | 126 | $this->assertEmpty($entry->getLanguage()); |
127 | $this->assertEmpty($entry->getHttpStatus()); | 127 | $this->assertEmpty($entry->getHttpStatus()); |
128 | $this->assertEmpty($entry->getMimetype()); | 128 | $this->assertEmpty($entry->getMimetype()); |
129 | $this->assertEquals(0.0, $entry->getReadingTime()); | 129 | $this->assertSame(0.0, $entry->getReadingTime()); |
130 | $this->assertEquals('domain.io', $entry->getDomainName()); | 130 | $this->assertSame('domain.io', $entry->getDomainName()); |
131 | } | 131 | } |
132 | 132 | ||
133 | public function testWithContent() | 133 | public function testWithContent() |
@@ -161,15 +161,15 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
161 | $entry = new Entry(new User()); | 161 | $entry = new Entry(new User()); |
162 | $proxy->updateEntry($entry, 'http://0.0.0.0'); | 162 | $proxy->updateEntry($entry, 'http://0.0.0.0'); |
163 | 163 | ||
164 | $this->assertEquals('http://1.1.1.1', $entry->getUrl()); | 164 | $this->assertSame('http://1.1.1.1', $entry->getUrl()); |
165 | $this->assertEquals('this is my title', $entry->getTitle()); | 165 | $this->assertSame('this is my title', $entry->getTitle()); |
166 | $this->assertContains('this is my content', $entry->getContent()); | 166 | $this->assertContains('this is my content', $entry->getContent()); |
167 | $this->assertEquals('http://3.3.3.3/cover.jpg', $entry->getPreviewPicture()); | 167 | $this->assertSame('http://3.3.3.3/cover.jpg', $entry->getPreviewPicture()); |
168 | $this->assertEquals('text/html', $entry->getMimetype()); | 168 | $this->assertSame('text/html', $entry->getMimetype()); |
169 | $this->assertEquals('fr', $entry->getLanguage()); | 169 | $this->assertSame('fr', $entry->getLanguage()); |
170 | $this->assertEquals('200', $entry->getHttpStatus()); | 170 | $this->assertSame('200', $entry->getHttpStatus()); |
171 | $this->assertEquals(4.0, $entry->getReadingTime()); | 171 | $this->assertSame(4.0, $entry->getReadingTime()); |
172 | $this->assertEquals('1.1.1.1', $entry->getDomainName()); | 172 | $this->assertSame('1.1.1.1', $entry->getDomainName()); |
173 | } | 173 | } |
174 | 174 | ||
175 | public function testWithContentAndNoOgImage() | 175 | public function testWithContentAndNoOgImage() |
@@ -203,15 +203,15 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
203 | $entry = new Entry(new User()); | 203 | $entry = new Entry(new User()); |
204 | $proxy->updateEntry($entry, 'http://0.0.0.0'); | 204 | $proxy->updateEntry($entry, 'http://0.0.0.0'); |
205 | 205 | ||
206 | $this->assertEquals('http://1.1.1.1', $entry->getUrl()); | 206 | $this->assertSame('http://1.1.1.1', $entry->getUrl()); |
207 | $this->assertEquals('this is my title', $entry->getTitle()); | 207 | $this->assertSame('this is my title', $entry->getTitle()); |
208 | $this->assertContains('this is my content', $entry->getContent()); | 208 | $this->assertContains('this is my content', $entry->getContent()); |
209 | $this->assertNull($entry->getPreviewPicture()); | 209 | $this->assertNull($entry->getPreviewPicture()); |
210 | $this->assertEquals('text/html', $entry->getMimetype()); | 210 | $this->assertSame('text/html', $entry->getMimetype()); |
211 | $this->assertEquals('fr', $entry->getLanguage()); | 211 | $this->assertSame('fr', $entry->getLanguage()); |
212 | $this->assertEquals('200', $entry->getHttpStatus()); | 212 | $this->assertSame('200', $entry->getHttpStatus()); |
213 | $this->assertEquals(4.0, $entry->getReadingTime()); | 213 | $this->assertSame(4.0, $entry->getReadingTime()); |
214 | $this->assertEquals('1.1.1.1', $entry->getDomainName()); | 214 | $this->assertSame('1.1.1.1', $entry->getDomainName()); |
215 | } | 215 | } |
216 | 216 | ||
217 | public function testWithContentAndBadLanguage() | 217 | public function testWithContentAndBadLanguage() |
@@ -248,14 +248,14 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
248 | $entry = new Entry(new User()); | 248 | $entry = new Entry(new User()); |
249 | $proxy->updateEntry($entry, 'http://0.0.0.0'); | 249 | $proxy->updateEntry($entry, 'http://0.0.0.0'); |
250 | 250 | ||
251 | $this->assertEquals('http://1.1.1.1', $entry->getUrl()); | 251 | $this->assertSame('http://1.1.1.1', $entry->getUrl()); |
252 | $this->assertEquals('this is my title', $entry->getTitle()); | 252 | $this->assertSame('this is my title', $entry->getTitle()); |
253 | $this->assertContains('this is my content', $entry->getContent()); | 253 | $this->assertContains('this is my content', $entry->getContent()); |
254 | $this->assertEquals('text/html', $entry->getMimetype()); | 254 | $this->assertSame('text/html', $entry->getMimetype()); |
255 | $this->assertNull($entry->getLanguage()); | 255 | $this->assertNull($entry->getLanguage()); |
256 | $this->assertEquals('200', $entry->getHttpStatus()); | 256 | $this->assertSame('200', $entry->getHttpStatus()); |
257 | $this->assertEquals(4.0, $entry->getReadingTime()); | 257 | $this->assertSame(4.0, $entry->getReadingTime()); |
258 | $this->assertEquals('1.1.1.1', $entry->getDomainName()); | 258 | $this->assertSame('1.1.1.1', $entry->getDomainName()); |
259 | } | 259 | } |
260 | 260 | ||
261 | public function testWithContentAndBadOgImage() | 261 | public function testWithContentAndBadOgImage() |
@@ -297,15 +297,15 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
297 | $entry = new Entry(new User()); | 297 | $entry = new Entry(new User()); |
298 | $proxy->updateEntry($entry, 'http://0.0.0.0'); | 298 | $proxy->updateEntry($entry, 'http://0.0.0.0'); |
299 | 299 | ||
300 | $this->assertEquals('http://1.1.1.1', $entry->getUrl()); | 300 | $this->assertSame('http://1.1.1.1', $entry->getUrl()); |
301 | $this->assertEquals('this is my title', $entry->getTitle()); | 301 | $this->assertSame('this is my title', $entry->getTitle()); |
302 | $this->assertContains('this is my content', $entry->getContent()); | 302 | $this->assertContains('this is my content', $entry->getContent()); |
303 | $this->assertNull($entry->getPreviewPicture()); | 303 | $this->assertNull($entry->getPreviewPicture()); |
304 | $this->assertEquals('text/html', $entry->getMimetype()); | 304 | $this->assertSame('text/html', $entry->getMimetype()); |
305 | $this->assertEquals('fr', $entry->getLanguage()); | 305 | $this->assertSame('fr', $entry->getLanguage()); |
306 | $this->assertEquals('200', $entry->getHttpStatus()); | 306 | $this->assertSame('200', $entry->getHttpStatus()); |
307 | $this->assertEquals(4.0, $entry->getReadingTime()); | 307 | $this->assertSame(4.0, $entry->getReadingTime()); |
308 | $this->assertEquals('1.1.1.1', $entry->getDomainName()); | 308 | $this->assertSame('1.1.1.1', $entry->getDomainName()); |
309 | } | 309 | } |
310 | 310 | ||
311 | public function testWithForcedContent() | 311 | public function testWithForcedContent() |
@@ -333,14 +333,14 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
333 | ] | 333 | ] |
334 | ); | 334 | ); |
335 | 335 | ||
336 | $this->assertEquals('http://1.1.1.1', $entry->getUrl()); | 336 | $this->assertSame('http://1.1.1.1', $entry->getUrl()); |
337 | $this->assertEquals('this is my title', $entry->getTitle()); | 337 | $this->assertSame('this is my title', $entry->getTitle()); |
338 | $this->assertContains('this is my content', $entry->getContent()); | 338 | $this->assertContains('this is my content', $entry->getContent()); |
339 | $this->assertEquals('text/html', $entry->getMimetype()); | 339 | $this->assertSame('text/html', $entry->getMimetype()); |
340 | $this->assertEquals('fr', $entry->getLanguage()); | 340 | $this->assertSame('fr', $entry->getLanguage()); |
341 | $this->assertEquals(4.0, $entry->getReadingTime()); | 341 | $this->assertSame(4.0, $entry->getReadingTime()); |
342 | $this->assertEquals('1.1.1.1', $entry->getDomainName()); | 342 | $this->assertSame('1.1.1.1', $entry->getDomainName()); |
343 | $this->assertEquals('24/03/2014', $entry->getPublishedAt()->format('d/m/Y')); | 343 | $this->assertSame('24/03/2014', $entry->getPublishedAt()->format('d/m/Y')); |
344 | $this->assertContains('Jeremy', $entry->getPublishedBy()); | 344 | $this->assertContains('Jeremy', $entry->getPublishedBy()); |
345 | $this->assertContains('Nico', $entry->getPublishedBy()); | 345 | $this->assertContains('Nico', $entry->getPublishedBy()); |
346 | $this->assertContains('Thomas', $entry->getPublishedBy()); | 346 | $this->assertContains('Thomas', $entry->getPublishedBy()); |
@@ -371,14 +371,14 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
371 | ] | 371 | ] |
372 | ); | 372 | ); |
373 | 373 | ||
374 | $this->assertEquals('http://1.1.1.1', $entry->getUrl()); | 374 | $this->assertSame('http://1.1.1.1', $entry->getUrl()); |
375 | $this->assertEquals('this is my title', $entry->getTitle()); | 375 | $this->assertSame('this is my title', $entry->getTitle()); |
376 | $this->assertContains('this is my content', $entry->getContent()); | 376 | $this->assertContains('this is my content', $entry->getContent()); |
377 | $this->assertEquals('text/html', $entry->getMimetype()); | 377 | $this->assertSame('text/html', $entry->getMimetype()); |
378 | $this->assertEquals('fr', $entry->getLanguage()); | 378 | $this->assertSame('fr', $entry->getLanguage()); |
379 | $this->assertEquals(4.0, $entry->getReadingTime()); | 379 | $this->assertSame(4.0, $entry->getReadingTime()); |
380 | $this->assertEquals('1.1.1.1', $entry->getDomainName()); | 380 | $this->assertSame('1.1.1.1', $entry->getDomainName()); |
381 | $this->assertEquals('08/09/2016', $entry->getPublishedAt()->format('d/m/Y')); | 381 | $this->assertSame('08/09/2016', $entry->getPublishedAt()->format('d/m/Y')); |
382 | } | 382 | } |
383 | 383 | ||
384 | public function testWithForcedContentAndBadDate() | 384 | public function testWithForcedContentAndBadDate() |
@@ -406,13 +406,13 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
406 | ] | 406 | ] |
407 | ); | 407 | ); |
408 | 408 | ||
409 | $this->assertEquals('http://1.1.1.1', $entry->getUrl()); | 409 | $this->assertSame('http://1.1.1.1', $entry->getUrl()); |
410 | $this->assertEquals('this is my title', $entry->getTitle()); | 410 | $this->assertSame('this is my title', $entry->getTitle()); |
411 | $this->assertContains('this is my content', $entry->getContent()); | 411 | $this->assertContains('this is my content', $entry->getContent()); |
412 | $this->assertEquals('text/html', $entry->getMimetype()); | 412 | $this->assertSame('text/html', $entry->getMimetype()); |
413 | $this->assertEquals('fr', $entry->getLanguage()); | 413 | $this->assertSame('fr', $entry->getLanguage()); |
414 | $this->assertEquals(4.0, $entry->getReadingTime()); | 414 | $this->assertSame(4.0, $entry->getReadingTime()); |
415 | $this->assertEquals('1.1.1.1', $entry->getDomainName()); | 415 | $this->assertSame('1.1.1.1', $entry->getDomainName()); |
416 | $this->assertNull($entry->getPublishedAt()); | 416 | $this->assertNull($entry->getPublishedAt()); |
417 | 417 | ||
418 | $records = $handler->getRecords(); | 418 | $records = $handler->getRecords(); |
@@ -488,14 +488,14 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
488 | ] | 488 | ] |
489 | ); | 489 | ); |
490 | 490 | ||
491 | $this->assertEquals('http://1.1.1.1', $entry->getUrl()); | 491 | $this->assertSame('http://1.1.1.1', $entry->getUrl()); |
492 | $this->assertEquals('this is my title', $entry->getTitle()); | 492 | $this->assertSame('this is my title', $entry->getTitle()); |
493 | $this->assertNotContains($escapedString, $entry->getContent()); | 493 | $this->assertNotContains($escapedString, $entry->getContent()); |
494 | $this->assertEquals('http://3.3.3.3/cover.jpg', $entry->getPreviewPicture()); | 494 | $this->assertSame('http://3.3.3.3/cover.jpg', $entry->getPreviewPicture()); |
495 | $this->assertEquals('text/html', $entry->getMimetype()); | 495 | $this->assertSame('text/html', $entry->getMimetype()); |
496 | $this->assertEquals('fr', $entry->getLanguage()); | 496 | $this->assertSame('fr', $entry->getLanguage()); |
497 | $this->assertEquals('200', $entry->getHttpStatus()); | 497 | $this->assertSame('200', $entry->getHttpStatus()); |
498 | $this->assertEquals('1.1.1.1', $entry->getDomainName()); | 498 | $this->assertSame('1.1.1.1', $entry->getDomainName()); |
499 | } | 499 | } |
500 | 500 | ||
501 | private function getTaggerMock() | 501 | private function getTaggerMock() |
diff --git a/tests/Wallabag/CoreBundle/Helper/CryptoProxyTest.php b/tests/Wallabag/CoreBundle/Helper/CryptoProxyTest.php index cede8696..782c29c3 100644 --- a/tests/Wallabag/CoreBundle/Helper/CryptoProxyTest.php +++ b/tests/Wallabag/CoreBundle/Helper/CryptoProxyTest.php | |||
@@ -2,9 +2,9 @@ | |||
2 | 2 | ||
3 | namespace Tests\Wallabag\CoreBundle\Helper; | 3 | namespace Tests\Wallabag\CoreBundle\Helper; |
4 | 4 | ||
5 | use Psr\Log\NullLogger; | ||
6 | use Monolog\Logger; | ||
7 | use Monolog\Handler\TestHandler; | 5 | use Monolog\Handler\TestHandler; |
6 | use Monolog\Logger; | ||
7 | use Psr\Log\NullLogger; | ||
8 | use Wallabag\CoreBundle\Helper\CryptoProxy; | 8 | use Wallabag\CoreBundle\Helper\CryptoProxy; |
9 | 9 | ||
10 | class CryptoProxyTest extends \PHPUnit_Framework_TestCase | 10 | class CryptoProxyTest extends \PHPUnit_Framework_TestCase |
@@ -14,7 +14,7 @@ class CryptoProxyTest extends \PHPUnit_Framework_TestCase | |||
14 | $logHandler = new TestHandler(); | 14 | $logHandler = new TestHandler(); |
15 | $logger = new Logger('test', [$logHandler]); | 15 | $logger = new Logger('test', [$logHandler]); |
16 | 16 | ||
17 | $crypto = new CryptoProxy(sys_get_temp_dir().'/'.uniqid('', true).'.txt', $logger); | 17 | $crypto = new CryptoProxy(sys_get_temp_dir() . '/' . uniqid('', true) . '.txt', $logger); |
18 | $crypted = $crypto->crypt('test'); | 18 | $crypted = $crypto->crypt('test'); |
19 | $decrypted = $crypto->decrypt($crypted); | 19 | $decrypted = $crypto->decrypt($crypted); |
20 | 20 | ||
@@ -27,14 +27,14 @@ class CryptoProxyTest extends \PHPUnit_Framework_TestCase | |||
27 | } | 27 | } |
28 | 28 | ||
29 | /** | 29 | /** |
30 | * @expectedException RuntimeException | 30 | * @expectedException \RuntimeException |
31 | * @expectedExceptionMessage Decrypt fail | 31 | * @expectedExceptionMessage Decrypt fail |
32 | * | 32 | * |
33 | * @return [type] [description] | 33 | * @return [type] [description] |
34 | */ | 34 | */ |
35 | public function testDecryptBadValue() | 35 | public function testDecryptBadValue() |
36 | { | 36 | { |
37 | $crypto = new CryptoProxy(sys_get_temp_dir().'/'.uniqid('', true).'.txt', new NullLogger()); | 37 | $crypto = new CryptoProxy(sys_get_temp_dir() . '/' . uniqid('', true) . '.txt', new NullLogger()); |
38 | $crypto->decrypt('badvalue'); | 38 | $crypto->decrypt('badvalue'); |
39 | } | 39 | } |
40 | } | 40 | } |
diff --git a/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php b/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php index c02f9658..c61f65d0 100644 --- a/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php +++ b/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php | |||
@@ -2,13 +2,13 @@ | |||
2 | 2 | ||
3 | namespace Tests\Wallabag\CoreBundle\Helper; | 3 | namespace Tests\Wallabag\CoreBundle\Helper; |
4 | 4 | ||
5 | use Wallabag\CoreBundle\Helper\DownloadImages; | ||
6 | use Monolog\Logger; | ||
7 | use Monolog\Handler\TestHandler; | ||
8 | use GuzzleHttp\Client; | 5 | use GuzzleHttp\Client; |
9 | use GuzzleHttp\Subscriber\Mock; | ||
10 | use GuzzleHttp\Message\Response; | 6 | use GuzzleHttp\Message\Response; |
11 | use GuzzleHttp\Stream\Stream; | 7 | use GuzzleHttp\Stream\Stream; |
8 | use GuzzleHttp\Subscriber\Mock; | ||
9 | use Monolog\Handler\TestHandler; | ||
10 | use Monolog\Logger; | ||
11 | use Wallabag\CoreBundle\Helper\DownloadImages; | ||
12 | 12 | ||
13 | class DownloadImagesTest extends \PHPUnit_Framework_TestCase | 13 | class DownloadImagesTest extends \PHPUnit_Framework_TestCase |
14 | { | 14 | { |
@@ -34,15 +34,15 @@ class DownloadImagesTest extends \PHPUnit_Framework_TestCase | |||
34 | $client = new Client(); | 34 | $client = new Client(); |
35 | 35 | ||
36 | $mock = new Mock([ | 36 | $mock = new Mock([ |
37 | new Response(200, ['content-type' => 'image/png'], Stream::factory(file_get_contents(__DIR__.'/../fixtures/unnamed.png'))), | 37 | new Response(200, ['content-type' => 'image/png'], Stream::factory(file_get_contents(__DIR__ . '/../fixtures/unnamed.png'))), |
38 | ]); | 38 | ]); |
39 | 39 | ||
40 | $client->getEmitter()->attach($mock); | 40 | $client->getEmitter()->attach($mock); |
41 | 41 | ||
42 | $logHandler = new TestHandler(); | 42 | $logHandler = new TestHandler(); |
43 | $logger = new Logger('test', array($logHandler)); | 43 | $logger = new Logger('test', [$logHandler]); |
44 | 44 | ||
45 | $download = new DownloadImages($client, sys_get_temp_dir().'/wallabag_test', 'http://wallabag.io/', $logger); | 45 | $download = new DownloadImages($client, sys_get_temp_dir() . '/wallabag_test', 'http://wallabag.io/', $logger); |
46 | 46 | ||
47 | $res = $download->processHtml(123, $html, $url); | 47 | $res = $download->processHtml(123, $html, $url); |
48 | 48 | ||
@@ -61,9 +61,9 @@ class DownloadImagesTest extends \PHPUnit_Framework_TestCase | |||
61 | $client->getEmitter()->attach($mock); | 61 | $client->getEmitter()->attach($mock); |
62 | 62 | ||
63 | $logHandler = new TestHandler(); | 63 | $logHandler = new TestHandler(); |
64 | $logger = new Logger('test', array($logHandler)); | 64 | $logger = new Logger('test', [$logHandler]); |
65 | 65 | ||
66 | $download = new DownloadImages($client, sys_get_temp_dir().'/wallabag_test', 'http://wallabag.io/', $logger); | 66 | $download = new DownloadImages($client, sys_get_temp_dir() . '/wallabag_test', 'http://wallabag.io/', $logger); |
67 | $res = $download->processHtml(123, '<div><img src="http://i.imgur.com/T9qgcHc.jpg" /></div>', 'http://imgur.com/gallery/WxtWY'); | 67 | $res = $download->processHtml(123, '<div><img src="http://i.imgur.com/T9qgcHc.jpg" /></div>', 'http://imgur.com/gallery/WxtWY'); |
68 | 68 | ||
69 | $this->assertContains('http://i.imgur.com/T9qgcHc.jpg', $res, 'Image were not replace because of content-type'); | 69 | $this->assertContains('http://i.imgur.com/T9qgcHc.jpg', $res, 'Image were not replace because of content-type'); |
@@ -87,18 +87,18 @@ class DownloadImagesTest extends \PHPUnit_Framework_TestCase | |||
87 | $client = new Client(); | 87 | $client = new Client(); |
88 | 88 | ||
89 | $mock = new Mock([ | 89 | $mock = new Mock([ |
90 | new Response(200, ['content-type' => $header], Stream::factory(file_get_contents(__DIR__.'/../fixtures/unnamed.png'))), | 90 | new Response(200, ['content-type' => $header], Stream::factory(file_get_contents(__DIR__ . '/../fixtures/unnamed.png'))), |
91 | ]); | 91 | ]); |
92 | 92 | ||
93 | $client->getEmitter()->attach($mock); | 93 | $client->getEmitter()->attach($mock); |
94 | 94 | ||
95 | $logHandler = new TestHandler(); | 95 | $logHandler = new TestHandler(); |
96 | $logger = new Logger('test', array($logHandler)); | 96 | $logger = new Logger('test', [$logHandler]); |
97 | 97 | ||
98 | $download = new DownloadImages($client, sys_get_temp_dir().'/wallabag_test', 'http://wallabag.io/', $logger); | 98 | $download = new DownloadImages($client, sys_get_temp_dir() . '/wallabag_test', 'http://wallabag.io/', $logger); |
99 | $res = $download->processSingleImage(123, 'T9qgcHc.jpg', 'http://imgur.com/gallery/WxtWY'); | 99 | $res = $download->processSingleImage(123, 'T9qgcHc.jpg', 'http://imgur.com/gallery/WxtWY'); |
100 | 100 | ||
101 | $this->assertContains('/assets/images/9/b/9b0ead26/ebe60399.'.$extension, $res); | 101 | $this->assertContains('/assets/images/9/b/9b0ead26/ebe60399.' . $extension, $res); |
102 | } | 102 | } |
103 | 103 | ||
104 | public function testProcessSingleImageWithBadUrl() | 104 | public function testProcessSingleImageWithBadUrl() |
@@ -112,9 +112,9 @@ class DownloadImagesTest extends \PHPUnit_Framework_TestCase | |||
112 | $client->getEmitter()->attach($mock); | 112 | $client->getEmitter()->attach($mock); |
113 | 113 | ||
114 | $logHandler = new TestHandler(); | 114 | $logHandler = new TestHandler(); |
115 | $logger = new Logger('test', array($logHandler)); | 115 | $logger = new Logger('test', [$logHandler]); |
116 | 116 | ||
117 | $download = new DownloadImages($client, sys_get_temp_dir().'/wallabag_test', 'http://wallabag.io/', $logger); | 117 | $download = new DownloadImages($client, sys_get_temp_dir() . '/wallabag_test', 'http://wallabag.io/', $logger); |
118 | $res = $download->processSingleImage(123, 'T9qgcHc.jpg', 'http://imgur.com/gallery/WxtWY'); | 118 | $res = $download->processSingleImage(123, 'T9qgcHc.jpg', 'http://imgur.com/gallery/WxtWY'); |
119 | 119 | ||
120 | $this->assertFalse($res, 'Image can not be found, so it will not be replaced'); | 120 | $this->assertFalse($res, 'Image can not be found, so it will not be replaced'); |
@@ -131,9 +131,9 @@ class DownloadImagesTest extends \PHPUnit_Framework_TestCase | |||
131 | $client->getEmitter()->attach($mock); | 131 | $client->getEmitter()->attach($mock); |
132 | 132 | ||
133 | $logHandler = new TestHandler(); | 133 | $logHandler = new TestHandler(); |
134 | $logger = new Logger('test', array($logHandler)); | 134 | $logger = new Logger('test', [$logHandler]); |
135 | 135 | ||
136 | $download = new DownloadImages($client, sys_get_temp_dir().'/wallabag_test', 'http://wallabag.io/', $logger); | 136 | $download = new DownloadImages($client, sys_get_temp_dir() . '/wallabag_test', 'http://wallabag.io/', $logger); |
137 | $res = $download->processSingleImage(123, 'http://i.imgur.com/T9qgcHc.jpg', 'http://imgur.com/gallery/WxtWY'); | 137 | $res = $download->processSingleImage(123, 'http://i.imgur.com/T9qgcHc.jpg', 'http://imgur.com/gallery/WxtWY'); |
138 | 138 | ||
139 | $this->assertFalse($res, 'Image can not be loaded, so it will not be replaced'); | 139 | $this->assertFalse($res, 'Image can not be loaded, so it will not be replaced'); |
@@ -144,15 +144,15 @@ class DownloadImagesTest extends \PHPUnit_Framework_TestCase | |||
144 | $client = new Client(); | 144 | $client = new Client(); |
145 | 145 | ||
146 | $mock = new Mock([ | 146 | $mock = new Mock([ |
147 | new Response(200, ['content-type' => 'image/png'], Stream::factory(file_get_contents(__DIR__.'/../fixtures/unnamed.png'))), | 147 | new Response(200, ['content-type' => 'image/png'], Stream::factory(file_get_contents(__DIR__ . '/../fixtures/unnamed.png'))), |
148 | ]); | 148 | ]); |
149 | 149 | ||
150 | $client->getEmitter()->attach($mock); | 150 | $client->getEmitter()->attach($mock); |
151 | 151 | ||
152 | $logHandler = new TestHandler(); | 152 | $logHandler = new TestHandler(); |
153 | $logger = new Logger('test', array($logHandler)); | 153 | $logger = new Logger('test', [$logHandler]); |
154 | 154 | ||
155 | $download = new DownloadImages($client, sys_get_temp_dir().'/wallabag_test', 'http://wallabag.io/', $logger); | 155 | $download = new DownloadImages($client, sys_get_temp_dir() . '/wallabag_test', 'http://wallabag.io/', $logger); |
156 | $res = $download->processSingleImage(123, '/i.imgur.com/T9qgcHc.jpg', 'imgur.com/gallery/WxtWY'); | 156 | $res = $download->processSingleImage(123, '/i.imgur.com/T9qgcHc.jpg', 'imgur.com/gallery/WxtWY'); |
157 | 157 | ||
158 | $this->assertFalse($res, 'Absolute image can not be determined, so it will not be replaced'); | 158 | $this->assertFalse($res, 'Absolute image can not be determined, so it will not be replaced'); |
@@ -163,15 +163,15 @@ class DownloadImagesTest extends \PHPUnit_Framework_TestCase | |||
163 | $client = new Client(); | 163 | $client = new Client(); |
164 | 164 | ||
165 | $mock = new Mock([ | 165 | $mock = new Mock([ |
166 | new Response(200, ['content-type' => null], Stream::factory(file_get_contents(__DIR__.'/../fixtures/image-no-content-type.jpg'))), | 166 | new Response(200, ['content-type' => null], Stream::factory(file_get_contents(__DIR__ . '/../fixtures/image-no-content-type.jpg'))), |
167 | ]); | 167 | ]); |
168 | 168 | ||
169 | $client->getEmitter()->attach($mock); | 169 | $client->getEmitter()->attach($mock); |
170 | 170 | ||
171 | $logHandler = new TestHandler(); | 171 | $logHandler = new TestHandler(); |
172 | $logger = new Logger('test', array($logHandler)); | 172 | $logger = new Logger('test', [$logHandler]); |
173 | 173 | ||
174 | $download = new DownloadImages($client, sys_get_temp_dir().'/wallabag_test', 'http://wallabag.io/', $logger); | 174 | $download = new DownloadImages($client, sys_get_temp_dir() . '/wallabag_test', 'http://wallabag.io/', $logger); |
175 | 175 | ||
176 | $res = $download->processSingleImage( | 176 | $res = $download->processSingleImage( |
177 | 123, | 177 | 123, |
diff --git a/tests/Wallabag/CoreBundle/Helper/RedirectTest.php b/tests/Wallabag/CoreBundle/Helper/RedirectTest.php index f420d06a..7fd2ea2b 100644 --- a/tests/Wallabag/CoreBundle/Helper/RedirectTest.php +++ b/tests/Wallabag/CoreBundle/Helper/RedirectTest.php | |||
@@ -2,11 +2,11 @@ | |||
2 | 2 | ||
3 | namespace Tests\Wallabag\CoreBundle\Helper; | 3 | namespace Tests\Wallabag\CoreBundle\Helper; |
4 | 4 | ||
5 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; | ||
6 | use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; | ||
5 | use Wallabag\CoreBundle\Entity\Config; | 7 | use Wallabag\CoreBundle\Entity\Config; |
6 | use Wallabag\UserBundle\Entity\User; | ||
7 | use Wallabag\CoreBundle\Helper\Redirect; | 8 | use Wallabag\CoreBundle\Helper\Redirect; |
8 | use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; | 9 | use Wallabag\UserBundle\Entity\User; |
9 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; | ||
10 | 10 | ||
11 | class RedirectTest extends \PHPUnit_Framework_TestCase | 11 | class RedirectTest extends \PHPUnit_Framework_TestCase |
12 | { | 12 | { |
@@ -56,21 +56,21 @@ class RedirectTest extends \PHPUnit_Framework_TestCase | |||
56 | { | 56 | { |
57 | $redirectUrl = $this->redirect->to(null, 'fallback'); | 57 | $redirectUrl = $this->redirect->to(null, 'fallback'); |
58 | 58 | ||
59 | $this->assertEquals('fallback', $redirectUrl); | 59 | $this->assertSame('fallback', $redirectUrl); |
60 | } | 60 | } |
61 | 61 | ||
62 | public function testRedirectToNullWithoutFallback() | 62 | public function testRedirectToNullWithoutFallback() |
63 | { | 63 | { |
64 | $redirectUrl = $this->redirect->to(null); | 64 | $redirectUrl = $this->redirect->to(null); |
65 | 65 | ||
66 | $this->assertEquals($this->routerMock->generate('homepage'), $redirectUrl); | 66 | $this->assertSame($this->routerMock->generate('homepage'), $redirectUrl); |
67 | } | 67 | } |
68 | 68 | ||
69 | public function testRedirectToValidUrl() | 69 | public function testRedirectToValidUrl() |
70 | { | 70 | { |
71 | $redirectUrl = $this->redirect->to('/unread/list'); | 71 | $redirectUrl = $this->redirect->to('/unread/list'); |
72 | 72 | ||
73 | $this->assertEquals('/unread/list', $redirectUrl); | 73 | $this->assertSame('/unread/list', $redirectUrl); |
74 | } | 74 | } |
75 | 75 | ||
76 | public function testWithNotLoggedUser() | 76 | public function testWithNotLoggedUser() |
@@ -78,7 +78,7 @@ class RedirectTest extends \PHPUnit_Framework_TestCase | |||
78 | $redirect = new Redirect($this->routerMock, new TokenStorage()); | 78 | $redirect = new Redirect($this->routerMock, new TokenStorage()); |
79 | $redirectUrl = $redirect->to('/unread/list'); | 79 | $redirectUrl = $redirect->to('/unread/list'); |
80 | 80 | ||
81 | $this->assertEquals('/unread/list', $redirectUrl); | 81 | $this->assertSame('/unread/list', $redirectUrl); |
82 | } | 82 | } |
83 | 83 | ||
84 | public function testUserForRedirectToHomepage() | 84 | public function testUserForRedirectToHomepage() |
@@ -87,7 +87,7 @@ class RedirectTest extends \PHPUnit_Framework_TestCase | |||
87 | 87 | ||
88 | $redirectUrl = $this->redirect->to('/unread/list'); | 88 | $redirectUrl = $this->redirect->to('/unread/list'); |
89 | 89 | ||
90 | $this->assertEquals($this->routerMock->generate('homepage'), $redirectUrl); | 90 | $this->assertSame($this->routerMock->generate('homepage'), $redirectUrl); |
91 | } | 91 | } |
92 | 92 | ||
93 | public function testUserForRedirectWithIgnoreActionMarkAsRead() | 93 | public function testUserForRedirectWithIgnoreActionMarkAsRead() |
@@ -96,7 +96,7 @@ class RedirectTest extends \PHPUnit_Framework_TestCase | |||
96 | 96 | ||
97 | $redirectUrl = $this->redirect->to('/unread/list', '', true); | 97 | $redirectUrl = $this->redirect->to('/unread/list', '', true); |
98 | 98 | ||
99 | $this->assertEquals('/unread/list', $redirectUrl); | 99 | $this->assertSame('/unread/list', $redirectUrl); |
100 | } | 100 | } |
101 | 101 | ||
102 | public function testUserForRedirectNullWithFallbackWithIgnoreActionMarkAsRead() | 102 | public function testUserForRedirectNullWithFallbackWithIgnoreActionMarkAsRead() |
@@ -105,6 +105,6 @@ class RedirectTest extends \PHPUnit_Framework_TestCase | |||
105 | 105 | ||
106 | $redirectUrl = $this->redirect->to(null, 'fallback', true); | 106 | $redirectUrl = $this->redirect->to(null, 'fallback', true); |
107 | 107 | ||
108 | $this->assertEquals('fallback', $redirectUrl); | 108 | $this->assertSame('fallback', $redirectUrl); |
109 | } | 109 | } |
110 | } | 110 | } |
diff --git a/tests/Wallabag/CoreBundle/Helper/RuleBasedTaggerTest.php b/tests/Wallabag/CoreBundle/Helper/RuleBasedTaggerTest.php index 1e21f400..c31af680 100644 --- a/tests/Wallabag/CoreBundle/Helper/RuleBasedTaggerTest.php +++ b/tests/Wallabag/CoreBundle/Helper/RuleBasedTaggerTest.php | |||
@@ -182,7 +182,7 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase | |||
182 | $tags = $entry->getTags(); | 182 | $tags = $entry->getTags(); |
183 | 183 | ||
184 | $this->assertCount(1, $tags); | 184 | $this->assertCount(1, $tags); |
185 | $this->assertEquals('hey', $tags[0]->getLabel()); | 185 | $this->assertSame('hey', $tags[0]->getLabel()); |
186 | } | 186 | } |
187 | } | 187 | } |
188 | 188 | ||
diff --git a/tests/Wallabag/CoreBundle/Helper/TagsAssignerTest.php b/tests/Wallabag/CoreBundle/Helper/TagsAssignerTest.php index 6d6d6484..475cd349 100644 --- a/tests/Wallabag/CoreBundle/Helper/TagsAssignerTest.php +++ b/tests/Wallabag/CoreBundle/Helper/TagsAssignerTest.php | |||
@@ -5,8 +5,8 @@ namespace Tests\Wallabag\CoreBundle\Helper; | |||
5 | use Wallabag\CoreBundle\Entity\Entry; | 5 | use Wallabag\CoreBundle\Entity\Entry; |
6 | use Wallabag\CoreBundle\Entity\Tag; | 6 | use Wallabag\CoreBundle\Entity\Tag; |
7 | use Wallabag\CoreBundle\Helper\TagsAssigner; | 7 | use Wallabag\CoreBundle\Helper\TagsAssigner; |
8 | use Wallabag\UserBundle\Entity\User; | ||
9 | use Wallabag\CoreBundle\Repository\TagRepository; | 8 | use Wallabag\CoreBundle\Repository\TagRepository; |
9 | use Wallabag\UserBundle\Entity\User; | ||
10 | 10 | ||
11 | class TagsAssignerTest extends \PHPUnit_Framework_TestCase | 11 | class TagsAssignerTest extends \PHPUnit_Framework_TestCase |
12 | { | 12 | { |
@@ -20,8 +20,8 @@ class TagsAssignerTest extends \PHPUnit_Framework_TestCase | |||
20 | $tagsAssigner->assignTagsToEntry($entry, [' tag1', 'tag2 ']); | 20 | $tagsAssigner->assignTagsToEntry($entry, [' tag1', 'tag2 ']); |
21 | 21 | ||
22 | $this->assertCount(2, $entry->getTags()); | 22 | $this->assertCount(2, $entry->getTags()); |
23 | $this->assertEquals('tag1', $entry->getTags()[0]->getLabel()); | 23 | $this->assertSame('tag1', $entry->getTags()[0]->getLabel()); |
24 | $this->assertEquals('tag2', $entry->getTags()[1]->getLabel()); | 24 | $this->assertSame('tag2', $entry->getTags()[1]->getLabel()); |
25 | } | 25 | } |
26 | 26 | ||
27 | public function testAssignTagsWithString() | 27 | public function testAssignTagsWithString() |
@@ -34,8 +34,8 @@ class TagsAssignerTest extends \PHPUnit_Framework_TestCase | |||
34 | $tagsAssigner->assignTagsToEntry($entry, 'tag1, tag2'); | 34 | $tagsAssigner->assignTagsToEntry($entry, 'tag1, tag2'); |
35 | 35 | ||
36 | $this->assertCount(2, $entry->getTags()); | 36 | $this->assertCount(2, $entry->getTags()); |
37 | $this->assertEquals('tag1', $entry->getTags()[0]->getLabel()); | 37 | $this->assertSame('tag1', $entry->getTags()[0]->getLabel()); |
38 | $this->assertEquals('tag2', $entry->getTags()[1]->getLabel()); | 38 | $this->assertSame('tag2', $entry->getTags()[1]->getLabel()); |
39 | } | 39 | } |
40 | 40 | ||
41 | public function testAssignTagsWithEmptyArray() | 41 | public function testAssignTagsWithEmptyArray() |
@@ -76,8 +76,8 @@ class TagsAssignerTest extends \PHPUnit_Framework_TestCase | |||
76 | $tagsAssigner->assignTagsToEntry($entry, 'tag1, tag2'); | 76 | $tagsAssigner->assignTagsToEntry($entry, 'tag1, tag2'); |
77 | 77 | ||
78 | $this->assertCount(2, $entry->getTags()); | 78 | $this->assertCount(2, $entry->getTags()); |
79 | $this->assertEquals('tag1', $entry->getTags()[0]->getLabel()); | 79 | $this->assertSame('tag1', $entry->getTags()[0]->getLabel()); |
80 | $this->assertEquals('tag2', $entry->getTags()[1]->getLabel()); | 80 | $this->assertSame('tag2', $entry->getTags()[1]->getLabel()); |
81 | } | 81 | } |
82 | 82 | ||
83 | public function testAssignTagsNotFlushed() | 83 | public function testAssignTagsNotFlushed() |
@@ -96,7 +96,7 @@ class TagsAssignerTest extends \PHPUnit_Framework_TestCase | |||
96 | $tagsAssigner->assignTagsToEntry($entry, 'tag1', [$tagEntity]); | 96 | $tagsAssigner->assignTagsToEntry($entry, 'tag1', [$tagEntity]); |
97 | 97 | ||
98 | $this->assertCount(1, $entry->getTags()); | 98 | $this->assertCount(1, $entry->getTags()); |
99 | $this->assertEquals('tag1', $entry->getTags()[0]->getLabel()); | 99 | $this->assertSame('tag1', $entry->getTags()[0]->getLabel()); |
100 | } | 100 | } |
101 | 101 | ||
102 | private function getTagRepositoryMock() | 102 | private function getTagRepositoryMock() |
diff --git a/tests/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverterTest.php b/tests/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverterTest.php index ca8e0d50..74c645ef 100644 --- a/tests/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverterTest.php +++ b/tests/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverterTest.php | |||
@@ -212,6 +212,6 @@ class UsernameRssTokenConverterTest extends \PHPUnit_Framework_TestCase | |||
212 | 212 | ||
213 | $converter->apply($request, $params); | 213 | $converter->apply($request, $params); |
214 | 214 | ||
215 | $this->assertEquals($user, $request->attributes->get('user')); | 215 | $this->assertSame($user, $request->attributes->get('user')); |
216 | } | 216 | } |
217 | } | 217 | } |
diff --git a/tests/Wallabag/CoreBundle/Tools/UtilsTest.php b/tests/Wallabag/CoreBundle/Tools/UtilsTest.php index 435c25ca..4521e485 100644 --- a/tests/Wallabag/CoreBundle/Tools/UtilsTest.php +++ b/tests/Wallabag/CoreBundle/Tools/UtilsTest.php | |||
@@ -18,7 +18,7 @@ class UtilsTest extends \PHPUnit_Framework_TestCase | |||
18 | public function examples() | 18 | public function examples() |
19 | { | 19 | { |
20 | $examples = []; | 20 | $examples = []; |
21 | $finder = (new Finder())->in(__DIR__.'/samples'); | 21 | $finder = (new Finder())->in(__DIR__ . '/samples'); |
22 | foreach ($finder->getIterator() as $file) { | 22 | foreach ($finder->getIterator() as $file) { |
23 | $examples[] = [$file->getContents(), 1]; | 23 | $examples[] = [$file->getContents(), 1]; |
24 | } | 24 | } |
diff --git a/tests/Wallabag/CoreBundle/Twig/WallabagExtensionTest.php b/tests/Wallabag/CoreBundle/Twig/WallabagExtensionTest.php index b1c8c946..ceec4b37 100644 --- a/tests/Wallabag/CoreBundle/Twig/WallabagExtensionTest.php +++ b/tests/Wallabag/CoreBundle/Twig/WallabagExtensionTest.php | |||
@@ -26,8 +26,8 @@ class WallabagExtensionTest extends \PHPUnit_Framework_TestCase | |||
26 | 26 | ||
27 | $extension = new WallabagExtension($entryRepository, $tagRepository, $tokenStorage, 0, $translator); | 27 | $extension = new WallabagExtension($entryRepository, $tagRepository, $tokenStorage, 0, $translator); |
28 | 28 | ||
29 | $this->assertEquals('lemonde.fr', $extension->removeWww('www.lemonde.fr')); | 29 | $this->assertSame('lemonde.fr', $extension->removeWww('www.lemonde.fr')); |
30 | $this->assertEquals('lemonde.fr', $extension->removeWww('lemonde.fr')); | 30 | $this->assertSame('lemonde.fr', $extension->removeWww('lemonde.fr')); |
31 | $this->assertEquals('gist.github.com', $extension->removeWww('gist.github.com')); | 31 | $this->assertSame('gist.github.com', $extension->removeWww('gist.github.com')); |
32 | } | 32 | } |
33 | } | 33 | } |
diff --git a/tests/Wallabag/CoreBundle/WallabagCoreTestCase.php b/tests/Wallabag/CoreBundle/WallabagCoreTestCase.php index eec6939d..1eda5199 100644 --- a/tests/Wallabag/CoreBundle/WallabagCoreTestCase.php +++ b/tests/Wallabag/CoreBundle/WallabagCoreTestCase.php | |||
@@ -18,11 +18,6 @@ abstract class WallabagCoreTestCase extends WebTestCase | |||
18 | */ | 18 | */ |
19 | private $client = null; | 19 | private $client = null; |
20 | 20 | ||
21 | public function getClient() | ||
22 | { | ||
23 | return $this->client; | ||
24 | } | ||
25 | |||
26 | public function setUp() | 21 | public function setUp() |
27 | { | 22 | { |
28 | parent::setUp(); | 23 | parent::setUp(); |
@@ -30,6 +25,11 @@ abstract class WallabagCoreTestCase extends WebTestCase | |||
30 | $this->client = static::createClient(); | 25 | $this->client = static::createClient(); |
31 | } | 26 | } |
32 | 27 | ||
28 | public function getClient() | ||
29 | { | ||
30 | return $this->client; | ||
31 | } | ||
32 | |||
33 | public function resetDatabase(Client $client) | 33 | public function resetDatabase(Client $client) |
34 | { | 34 | { |
35 | $application = new Application($client->getKernel()); | 35 | $application = new Application($client->getKernel()); |
@@ -83,10 +83,10 @@ abstract class WallabagCoreTestCase extends WebTestCase | |||
83 | $loginManager = $container->get('fos_user.security.login_manager'); | 83 | $loginManager = $container->get('fos_user.security.login_manager'); |
84 | $firewallName = $container->getParameter('fos_user.firewall_name'); | 84 | $firewallName = $container->getParameter('fos_user.firewall_name'); |
85 | 85 | ||
86 | $user = $userManager->findUserBy(array('username' => $username)); | 86 | $user = $userManager->findUserBy(['username' => $username]); |
87 | $loginManager->logInUser($firewallName, $user); | 87 | $loginManager->logInUser($firewallName, $user); |
88 | 88 | ||
89 | $session->set('_security_'.$firewallName, serialize($container->get('security.token_storage')->getToken())); | 89 | $session->set('_security_' . $firewallName, serialize($container->get('security.token_storage')->getToken())); |
90 | $session->save(); | 90 | $session->save(); |
91 | 91 | ||
92 | $cookie = new Cookie($session->getName(), $session->getId()); | 92 | $cookie = new Cookie($session->getName(), $session->getId()); |