aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2017-07-01 09:52:38 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2017-07-01 09:52:38 +0200
commitf808b01692a835673f328d7221ba8c212caa9b61 (patch)
tree0c3b1fc5b1ddbd7af72227303503177689e1d403 /tests/Wallabag
parent822c877949aff8ae57677671115f8f4fc69588d5 (diff)
downloadwallabag-f808b01692a835673f328d7221ba8c212caa9b61.tar.gz
wallabag-f808b01692a835673f328d7221ba8c212caa9b61.tar.zst
wallabag-f808b01692a835673f328d7221ba8c212caa9b61.zip
Add a real configuration for CS-Fixer
Diffstat (limited to 'tests/Wallabag')
-rw-r--r--tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php44
-rw-r--r--tests/Wallabag/AnnotationBundle/WallabagAnnotationTestCase.php2
-rw-r--r--tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php24
-rw-r--r--tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php296
-rw-r--r--tests/Wallabag/ApiBundle/Controller/TagRestControllerTest.php38
-rw-r--r--tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php54
-rw-r--r--tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php4
-rw-r--r--tests/Wallabag/ApiBundle/WallabagApiTestCase.php2
-rw-r--r--tests/Wallabag/CoreBundle/Command/CleanDuplicatesCommandTest.php2
-rw-r--r--tests/Wallabag/CoreBundle/Command/ExportCommandTest.php2
-rw-r--r--tests/Wallabag/CoreBundle/Command/InstallCommandTest.php20
-rw-r--r--tests/Wallabag/CoreBundle/Command/TagAllCommandTest.php2
-rw-r--r--tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php116
-rw-r--r--tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php202
-rw-r--r--tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php108
-rw-r--r--tests/Wallabag/CoreBundle/Controller/RssControllerTest.php58
-rw-r--r--tests/Wallabag/CoreBundle/Controller/SettingsControllerTest.php4
-rw-r--r--tests/Wallabag/CoreBundle/Controller/SiteCredentialControllerTest.php22
-rw-r--r--tests/Wallabag/CoreBundle/Controller/StaticControllerTest.php4
-rw-r--r--tests/Wallabag/CoreBundle/Controller/TagControllerTest.php36
-rw-r--r--tests/Wallabag/CoreBundle/Event/Listener/LocaleListenerTest.php28
-rw-r--r--tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php4
-rw-r--r--tests/Wallabag/CoreBundle/Event/Subscriber/TablePrefixSubscriberTest.php18
-rw-r--r--tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php10
-rw-r--r--tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php152
-rw-r--r--tests/Wallabag/CoreBundle/Helper/CryptoProxyTest.php10
-rw-r--r--tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php46
-rw-r--r--tests/Wallabag/CoreBundle/Helper/RedirectTest.php20
-rw-r--r--tests/Wallabag/CoreBundle/Helper/RuleBasedTaggerTest.php2
-rw-r--r--tests/Wallabag/CoreBundle/Helper/TagsAssignerTest.php16
-rw-r--r--tests/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverterTest.php2
-rw-r--r--tests/Wallabag/CoreBundle/Tools/UtilsTest.php2
-rw-r--r--tests/Wallabag/CoreBundle/Twig/WallabagExtensionTest.php6
-rw-r--r--tests/Wallabag/CoreBundle/WallabagCoreTestCase.php14
-rw-r--r--tests/Wallabag/ImportBundle/Command/ImportCommandTest.php6
-rw-r--r--tests/Wallabag/ImportBundle/Command/RedisWorkerCommandTest.php4
-rw-r--r--tests/Wallabag/ImportBundle/Consumer/AMQPEntryConsumerTest.php4
-rw-r--r--tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php2
-rw-r--r--tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php40
-rw-r--r--tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php40
-rw-r--r--tests/Wallabag/ImportBundle/Controller/ImportControllerTest.php6
-rw-r--r--tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php42
-rw-r--r--tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php42
-rw-r--r--tests/Wallabag/ImportBundle/Controller/PocketControllerTest.php24
-rw-r--r--tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php42
-rw-r--r--tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php40
-rw-r--r--tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php40
-rw-r--r--tests/Wallabag/ImportBundle/Import/ChromeImportTest.php114
-rw-r--r--tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php114
-rw-r--r--tests/Wallabag/ImportBundle/Import/ImportChainTest.php2
-rw-r--r--tests/Wallabag/ImportBundle/Import/ImportCompilerPassTest.php2
-rw-r--r--tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php142
-rw-r--r--tests/Wallabag/ImportBundle/Import/PocketImportTest.php150
-rw-r--r--tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php114
-rw-r--r--tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php156
-rw-r--r--tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php150
-rw-r--r--tests/Wallabag/UserBundle/Controller/ManageControllerTest.php16
-rw-r--r--tests/Wallabag/UserBundle/EventListener/AuthenticationFailureListenerTest.php6
-rw-r--r--tests/Wallabag/UserBundle/EventListener/CreateConfigListenerTest.php2
-rw-r--r--tests/Wallabag/UserBundle/Mailer/AuthCodeMailerTest.php4
60 files changed, 1337 insertions, 1337 deletions
diff --git a/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php b/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php
index 3c94382c..96474468 100644
--- a/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php
+++ b/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php
@@ -49,12 +49,12 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
49 $this->logInAs('admin'); 49 $this->logInAs('admin');
50 } 50 }
51 51
52 $this->client->request('GET', $prefixUrl.'/'.$entry->getId().'.json'); 52 $this->client->request('GET', $prefixUrl . '/' . $entry->getId() . '.json');
53 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 53 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
54 54
55 $content = json_decode($this->client->getResponse()->getContent(), true); 55 $content = json_decode($this->client->getResponse()->getContent(), true);
56 $this->assertGreaterThanOrEqual(1, $content['total']); 56 $this->assertGreaterThanOrEqual(1, $content['total']);
57 $this->assertEquals($annotation->getText(), $content['rows'][0]['text']); 57 $this->assertSame($annotation->getText(), $content['rows'][0]['text']);
58 58
59 // we need to re-fetch the annotation becase after the flush, it has been "detached" from the entity manager 59 // we need to re-fetch the annotation becase after the flush, it has been "detached" from the entity manager
60 $annotation = $em->getRepository('WallabagAnnotationBundle:Annotation')->findAnnotationById($annotation->getId()); 60 $annotation = $em->getRepository('WallabagAnnotationBundle:Annotation')->findAnnotationById($annotation->getId());
@@ -88,16 +88,16 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
88 ['start' => '', 'startOffset' => 24, 'end' => '', 'endOffset' => 31], 88 ['start' => '', 'startOffset' => 24, 'end' => '', 'endOffset' => 31],
89 ], 89 ],
90 ]); 90 ]);
91 $this->client->request('POST', $prefixUrl.'/'.$entry->getId().'.json', [], [], $headers, $content); 91 $this->client->request('POST', $prefixUrl . '/' . $entry->getId() . '.json', [], [], $headers, $content);
92 92
93 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 93 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
94 94
95 $content = json_decode($this->client->getResponse()->getContent(), true); 95 $content = json_decode($this->client->getResponse()->getContent(), true);
96 96
97 $this->assertEquals('Big boss', $content['user']); 97 $this->assertSame('Big boss', $content['user']);
98 $this->assertEquals('v1.0', $content['annotator_schema_version']); 98 $this->assertSame('v1.0', $content['annotator_schema_version']);
99 $this->assertEquals('my annotation', $content['text']); 99 $this->assertSame('my annotation', $content['text']);
100 $this->assertEquals('my quote', $content['quote']); 100 $this->assertSame('my quote', $content['quote']);
101 101
102 /** @var Annotation $annotation */ 102 /** @var Annotation $annotation */
103 $annotation = $this->client->getContainer() 103 $annotation = $this->client->getContainer()
@@ -105,7 +105,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
105 ->getRepository('WallabagAnnotationBundle:Annotation') 105 ->getRepository('WallabagAnnotationBundle:Annotation')
106 ->findLastAnnotationByPageId($entry->getId(), 1); 106 ->findLastAnnotationByPageId($entry->getId(), 1);
107 107
108 $this->assertEquals('my annotation', $annotation->getText()); 108 $this->assertSame('my annotation', $annotation->getText());
109 } 109 }
110 110
111 /** 111 /**
@@ -133,9 +133,9 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
133 ['start' => '', 'startOffset' => 24, 'end' => '', 'endOffset' => 31], 133 ['start' => '', 'startOffset' => 24, 'end' => '', 'endOffset' => 31],
134 ], 134 ],
135 ]); 135 ]);
136 $this->client->request('POST', $prefixUrl.'/'.$entry->getId().'.json', [], [], $headers, $content); 136 $this->client->request('POST', $prefixUrl . '/' . $entry->getId() . '.json', [], [], $headers, $content);
137 137
138 $this->assertEquals(400, $this->client->getResponse()->getStatusCode()); 138 $this->assertSame(400, $this->client->getResponse()->getStatusCode());
139 } 139 }
140 140
141 /** 141 /**
@@ -166,21 +166,21 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
166 $content = json_encode([ 166 $content = json_encode([
167 'text' => 'a modified annotation', 167 'text' => 'a modified annotation',
168 ]); 168 ]);
169 $this->client->request('PUT', $prefixUrl.'/'.$annotation->getId().'.json', [], [], $headers, $content); 169 $this->client->request('PUT', $prefixUrl . '/' . $annotation->getId() . '.json', [], [], $headers, $content);
170 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 170 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
171 171
172 $content = json_decode($this->client->getResponse()->getContent(), true); 172 $content = json_decode($this->client->getResponse()->getContent(), true);
173 173
174 $this->assertEquals('Big boss', $content['user']); 174 $this->assertSame('Big boss', $content['user']);
175 $this->assertEquals('v1.0', $content['annotator_schema_version']); 175 $this->assertSame('v1.0', $content['annotator_schema_version']);
176 $this->assertEquals('a modified annotation', $content['text']); 176 $this->assertSame('a modified annotation', $content['text']);
177 $this->assertEquals('my quote', $content['quote']); 177 $this->assertSame('my quote', $content['quote']);
178 178
179 /** @var Annotation $annotationUpdated */ 179 /** @var Annotation $annotationUpdated */
180 $annotationUpdated = $em 180 $annotationUpdated = $em
181 ->getRepository('WallabagAnnotationBundle:Annotation') 181 ->getRepository('WallabagAnnotationBundle:Annotation')
182 ->findOneById($annotation->getId()); 182 ->findOneById($annotation->getId());
183 $this->assertEquals('a modified annotation', $annotationUpdated->getText()); 183 $this->assertSame('a modified annotation', $annotationUpdated->getText());
184 184
185 $em->remove($annotationUpdated); 185 $em->remove($annotationUpdated);
186 $em->flush(); 186 $em->flush();
@@ -218,12 +218,12 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
218 $content = json_encode([ 218 $content = json_encode([
219 'text' => 'a modified annotation', 219 'text' => 'a modified annotation',
220 ]); 220 ]);
221 $this->client->request('DELETE', $prefixUrl.'/'.$annotation->getId().'.json', [], [], $headers, $content); 221 $this->client->request('DELETE', $prefixUrl . '/' . $annotation->getId() . '.json', [], [], $headers, $content);
222 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 222 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
223 223
224 $content = json_decode($this->client->getResponse()->getContent(), true); 224 $content = json_decode($this->client->getResponse()->getContent(), true);
225 225
226 $this->assertEquals('This is my annotation /o/', $content['text']); 226 $this->assertSame('This is my annotation /o/', $content['text']);
227 227
228 $annotationDeleted = $em 228 $annotationDeleted = $em
229 ->getRepository('WallabagAnnotationBundle:Annotation') 229 ->getRepository('WallabagAnnotationBundle:Annotation')
diff --git a/tests/Wallabag/AnnotationBundle/WallabagAnnotationTestCase.php b/tests/Wallabag/AnnotationBundle/WallabagAnnotationTestCase.php
index ef3f1324..105e8add 100644
--- a/tests/Wallabag/AnnotationBundle/WallabagAnnotationTestCase.php
+++ b/tests/Wallabag/AnnotationBundle/WallabagAnnotationTestCase.php
@@ -52,7 +52,7 @@ abstract class WallabagAnnotationTestCase extends WebTestCase
52 $loginManager->logInUser($firewallName, $this->user); 52 $loginManager->logInUser($firewallName, $this->user);
53 53
54 // save the login token into the session and put it in a cookie 54 // save the login token into the session and put it in a cookie
55 $container->get('session')->set('_security_'.$firewallName, serialize($container->get('security.token_storage')->getToken())); 55 $container->get('session')->set('_security_' . $firewallName, serialize($container->get('security.token_storage')->getToken()));
56 $container->get('session')->save(); 56 $container->get('session')->save();
57 57
58 $session = $container->get('session'); 58 $session = $container->get('session');
diff --git a/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php b/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php
index 53aed12b..2caeccf5 100644
--- a/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php
+++ b/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php
@@ -15,7 +15,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase
15 $nbClients = $em->getRepository('WallabagApiBundle:Client')->findAll(); 15 $nbClients = $em->getRepository('WallabagApiBundle:Client')->findAll();
16 16
17 $crawler = $client->request('GET', '/developer/client/create'); 17 $crawler = $client->request('GET', '/developer/client/create');
18 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 18 $this->assertSame(200, $client->getResponse()->getStatusCode());
19 19
20 $form = $crawler->filter('button[type=submit]')->form(); 20 $form = $crawler->filter('button[type=submit]')->form();
21 21
@@ -25,7 +25,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase
25 25
26 $crawler = $client->submit($form, $data); 26 $crawler = $client->submit($form, $data);
27 27
28 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 28 $this->assertSame(200, $client->getResponse()->getStatusCode());
29 29
30 $newNbClients = $em->getRepository('WallabagApiBundle:Client')->findAll(); 30 $newNbClients = $em->getRepository('WallabagApiBundle:Client')->findAll();
31 $this->assertGreaterThan(count($nbClients), count($newNbClients)); 31 $this->assertGreaterThan(count($nbClients), count($newNbClients));
@@ -47,7 +47,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase
47 'password' => 'mypassword', 47 'password' => 'mypassword',
48 ]); 48 ]);
49 49
50 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 50 $this->assertSame(200, $client->getResponse()->getStatusCode());
51 51
52 $data = json_decode($client->getResponse()->getContent(), true); 52 $data = json_decode($client->getResponse()->getContent(), true);
53 $this->assertArrayHasKey('access_token', $data); 53 $this->assertArrayHasKey('access_token', $data);
@@ -67,7 +67,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase
67 'client_secret' => $apiClient->getSecret(), 67 'client_secret' => $apiClient->getSecret(),
68 ]); 68 ]);
69 69
70 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 70 $this->assertSame(200, $client->getResponse()->getStatusCode());
71 71
72 $data = json_decode($client->getResponse()->getContent(), true); 72 $data = json_decode($client->getResponse()->getContent(), true);
73 $this->assertArrayHasKey('access_token', $data); 73 $this->assertArrayHasKey('access_token', $data);
@@ -84,8 +84,8 @@ class DeveloperControllerTest extends WallabagCoreTestCase
84 $nbClients = $em->getRepository('WallabagApiBundle:Client')->findAll(); 84 $nbClients = $em->getRepository('WallabagApiBundle:Client')->findAll();
85 85
86 $crawler = $client->request('GET', '/developer'); 86 $crawler = $client->request('GET', '/developer');
87 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 87 $this->assertSame(200, $client->getResponse()->getStatusCode());
88 $this->assertEquals(count($nbClients), $crawler->filter('ul[class=collapsible] li')->count()); 88 $this->assertSame(count($nbClients), $crawler->filter('ul[class=collapsible] li')->count());
89 } 89 }
90 90
91 public function testDeveloperHowto() 91 public function testDeveloperHowto()
@@ -94,7 +94,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase
94 $client = $this->getClient(); 94 $client = $this->getClient();
95 95
96 $crawler = $client->request('GET', '/developer/howto/first-app'); 96 $crawler = $client->request('GET', '/developer/howto/first-app');
97 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 97 $this->assertSame(200, $client->getResponse()->getStatusCode());
98 } 98 }
99 99
100 public function testRemoveClient() 100 public function testRemoveClient()
@@ -109,8 +109,8 @@ class DeveloperControllerTest extends WallabagCoreTestCase
109 $this->assertContains('no_client', $client->getResponse()->getContent()); 109 $this->assertContains('no_client', $client->getResponse()->getContent());
110 110
111 $this->logInAs('bob'); 111 $this->logInAs('bob');
112 $client->request('GET', '/developer/client/delete/'.$adminApiClient->getId()); 112 $client->request('GET', '/developer/client/delete/' . $adminApiClient->getId());
113 $this->assertEquals(403, $client->getResponse()->getStatusCode()); 113 $this->assertSame(403, $client->getResponse()->getStatusCode());
114 114
115 // Try to remove the admin's client with the good user 115 // Try to remove the admin's client with the good user
116 $this->logInAs('admin'); 116 $this->logInAs('admin');
@@ -123,7 +123,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase
123 ; 123 ;
124 124
125 $client->click($link); 125 $client->click($link);
126 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 126 $this->assertSame(302, $client->getResponse()->getStatusCode());
127 127
128 $this->assertNull( 128 $this->assertNull(
129 $em->getRepository('WallabagApiBundle:Client')->find($adminApiClient->getId()), 129 $em->getRepository('WallabagApiBundle:Client')->find($adminApiClient->getId()),
@@ -133,8 +133,8 @@ class DeveloperControllerTest extends WallabagCoreTestCase
133 133
134 /** 134 /**
135 * @param string $username 135 * @param string $username
136 * @param array $grantTypes
136 * 137 *
137 * @param array $grantTypes
138 * @return Client 138 * @return Client
139 */ 139 */
140 private function createApiClientForUser($username, $grantTypes = ['password']) 140 private function createApiClientForUser($username, $grantTypes = ['password'])
@@ -142,7 +142,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase
142 $client = $this->getClient(); 142 $client = $this->getClient();
143 $em = $client->getContainer()->get('doctrine.orm.entity_manager'); 143 $em = $client->getContainer()->get('doctrine.orm.entity_manager');
144 $userManager = $client->getContainer()->get('fos_user.user_manager'); 144 $userManager = $client->getContainer()->get('fos_user.user_manager');
145 $user = $userManager->findUserBy(array('username' => $username)); 145 $user = $userManager->findUserBy(['username' => $username]);
146 $apiClient = new Client($user); 146 $apiClient = new Client($user);
147 $apiClient->setName('My app'); 147 $apiClient->setName('My app');
148 $apiClient->setAllowedGrantTypes($grantTypes); 148 $apiClient->setAllowedGrantTypes($grantTypes);
diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
index c0391d87..2a333a0d 100644
--- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
+++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
@@ -21,19 +21,19 @@ class EntryRestControllerTest extends WallabagApiTestCase
21 $this->markTestSkipped('No content found in db.'); 21 $this->markTestSkipped('No content found in db.');
22 } 22 }
23 23
24 $this->client->request('GET', '/api/entries/'.$entry->getId().'.json'); 24 $this->client->request('GET', '/api/entries/' . $entry->getId() . '.json');
25 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 25 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
26 26
27 $content = json_decode($this->client->getResponse()->getContent(), true); 27 $content = json_decode($this->client->getResponse()->getContent(), true);
28 28
29 $this->assertEquals($entry->getTitle(), $content['title']); 29 $this->assertSame($entry->getTitle(), $content['title']);
30 $this->assertEquals($entry->getUrl(), $content['url']); 30 $this->assertSame($entry->getUrl(), $content['url']);
31 $this->assertCount(count($entry->getTags()), $content['tags']); 31 $this->assertCount(count($entry->getTags()), $content['tags']);
32 $this->assertEquals($entry->getUserName(), $content['user_name']); 32 $this->assertSame($entry->getUserName(), $content['user_name']);
33 $this->assertEquals($entry->getUserEmail(), $content['user_email']); 33 $this->assertSame($entry->getUserEmail(), $content['user_email']);
34 $this->assertEquals($entry->getUserId(), $content['user_id']); 34 $this->assertSame($entry->getUserId(), $content['user_id']);
35 35
36 $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); 36 $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type'));
37 } 37 }
38 38
39 public function testExportEntry() 39 public function testExportEntry()
@@ -47,39 +47,39 @@ class EntryRestControllerTest extends WallabagApiTestCase
47 $this->markTestSkipped('No content found in db.'); 47 $this->markTestSkipped('No content found in db.');
48 } 48 }
49 49
50 $this->client->request('GET', '/api/entries/'.$entry->getId().'/export.epub'); 50 $this->client->request('GET', '/api/entries/' . $entry->getId() . '/export.epub');
51 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 51 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
52 52
53 // epub format got the content type in the content 53 // epub format got the content type in the content
54 $this->assertContains('application/epub', $this->client->getResponse()->getContent()); 54 $this->assertContains('application/epub', $this->client->getResponse()->getContent());
55 $this->assertEquals('application/epub+zip', $this->client->getResponse()->headers->get('Content-Type')); 55 $this->assertSame('application/epub+zip', $this->client->getResponse()->headers->get('Content-Type'));
56 56
57 // re-auth client for mobi 57 // re-auth client for mobi
58 $client = $this->createAuthorizedClient(); 58 $client = $this->createAuthorizedClient();
59 $client->request('GET', '/api/entries/'.$entry->getId().'/export.mobi'); 59 $client->request('GET', '/api/entries/' . $entry->getId() . '/export.mobi');
60 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 60 $this->assertSame(200, $client->getResponse()->getStatusCode());
61 61
62 $this->assertEquals('application/x-mobipocket-ebook', $client->getResponse()->headers->get('Content-Type')); 62 $this->assertSame('application/x-mobipocket-ebook', $client->getResponse()->headers->get('Content-Type'));
63 63
64 // re-auth client for pdf 64 // re-auth client for pdf
65 $client = $this->createAuthorizedClient(); 65 $client = $this->createAuthorizedClient();
66 $client->request('GET', '/api/entries/'.$entry->getId().'/export.pdf'); 66 $client->request('GET', '/api/entries/' . $entry->getId() . '/export.pdf');
67 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 67 $this->assertSame(200, $client->getResponse()->getStatusCode());
68 68
69 $this->assertContains('PDF-', $client->getResponse()->getContent()); 69 $this->assertContains('PDF-', $client->getResponse()->getContent());
70 $this->assertEquals('application/pdf', $client->getResponse()->headers->get('Content-Type')); 70 $this->assertSame('application/pdf', $client->getResponse()->headers->get('Content-Type'));
71 71
72 // re-auth client for pdf 72 // re-auth client for pdf
73 $client = $this->createAuthorizedClient(); 73 $client = $this->createAuthorizedClient();
74 $client->request('GET', '/api/entries/'.$entry->getId().'/export.txt'); 74 $client->request('GET', '/api/entries/' . $entry->getId() . '/export.txt');
75 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 75 $this->assertSame(200, $client->getResponse()->getStatusCode());
76 76
77 $this->assertContains('text/plain', $client->getResponse()->headers->get('Content-Type')); 77 $this->assertContains('text/plain', $client->getResponse()->headers->get('Content-Type'));
78 78
79 // re-auth client for pdf 79 // re-auth client for pdf
80 $client = $this->createAuthorizedClient(); 80 $client = $this->createAuthorizedClient();
81 $client->request('GET', '/api/entries/'.$entry->getId().'/export.csv'); 81 $client->request('GET', '/api/entries/' . $entry->getId() . '/export.csv');
82 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 82 $this->assertSame(200, $client->getResponse()->getStatusCode());
83 83
84 $this->assertContains('application/csv', $client->getResponse()->headers->get('Content-Type')); 84 $this->assertContains('application/csv', $client->getResponse()->headers->get('Content-Type'));
85 } 85 }
@@ -95,26 +95,26 @@ class EntryRestControllerTest extends WallabagApiTestCase
95 $this->markTestSkipped('No content found in db.'); 95 $this->markTestSkipped('No content found in db.');
96 } 96 }
97 97
98 $this->client->request('GET', '/api/entries/'.$entry->getId().'.json'); 98 $this->client->request('GET', '/api/entries/' . $entry->getId() . '.json');
99 99
100 $this->assertEquals(403, $this->client->getResponse()->getStatusCode()); 100 $this->assertSame(403, $this->client->getResponse()->getStatusCode());
101 } 101 }
102 102
103 public function testGetEntries() 103 public function testGetEntries()
104 { 104 {
105 $this->client->request('GET', '/api/entries'); 105 $this->client->request('GET', '/api/entries');
106 106
107 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 107 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
108 108
109 $content = json_decode($this->client->getResponse()->getContent(), true); 109 $content = json_decode($this->client->getResponse()->getContent(), true);
110 110
111 $this->assertGreaterThanOrEqual(1, count($content)); 111 $this->assertGreaterThanOrEqual(1, count($content));
112 $this->assertNotEmpty($content['_embedded']['items']); 112 $this->assertNotEmpty($content['_embedded']['items']);
113 $this->assertGreaterThanOrEqual(1, $content['total']); 113 $this->assertGreaterThanOrEqual(1, $content['total']);
114 $this->assertEquals(1, $content['page']); 114 $this->assertSame(1, $content['page']);
115 $this->assertGreaterThanOrEqual(1, $content['pages']); 115 $this->assertGreaterThanOrEqual(1, $content['pages']);
116 116
117 $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); 117 $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type'));
118 } 118 }
119 119
120 public function testGetEntriesWithFullOptions() 120 public function testGetEntriesWithFullOptions()
@@ -131,15 +131,15 @@ class EntryRestControllerTest extends WallabagApiTestCase
131 'public' => 0, 131 'public' => 0,
132 ]); 132 ]);
133 133
134 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 134 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
135 135
136 $content = json_decode($this->client->getResponse()->getContent(), true); 136 $content = json_decode($this->client->getResponse()->getContent(), true);
137 137
138 $this->assertGreaterThanOrEqual(1, count($content)); 138 $this->assertGreaterThanOrEqual(1, count($content));
139 $this->assertArrayHasKey('items', $content['_embedded']); 139 $this->assertArrayHasKey('items', $content['_embedded']);
140 $this->assertGreaterThanOrEqual(0, $content['total']); 140 $this->assertGreaterThanOrEqual(0, $content['total']);
141 $this->assertEquals(1, $content['page']); 141 $this->assertSame(1, $content['page']);
142 $this->assertEquals(2, $content['limit']); 142 $this->assertSame(2, $content['limit']);
143 $this->assertGreaterThanOrEqual(1, $content['pages']); 143 $this->assertGreaterThanOrEqual(1, $content['pages']);
144 144
145 $this->assertArrayHasKey('_links', $content); 145 $this->assertArrayHasKey('_links', $content);
@@ -158,7 +158,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
158 $this->assertContains('public=0', $content['_links'][$link]['href']); 158 $this->assertContains('public=0', $content['_links'][$link]['href']);
159 } 159 }
160 160
161 $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); 161 $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type'));
162 } 162 }
163 163
164 public function testGetEntriesPublicOnly() 164 public function testGetEntriesPublicOnly()
@@ -183,15 +183,15 @@ class EntryRestControllerTest extends WallabagApiTestCase
183 'public' => 1, 183 'public' => 1,
184 ]); 184 ]);
185 185
186 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 186 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
187 187
188 $content = json_decode($this->client->getResponse()->getContent(), true); 188 $content = json_decode($this->client->getResponse()->getContent(), true);
189 189
190 $this->assertGreaterThanOrEqual(1, count($content)); 190 $this->assertGreaterThanOrEqual(1, count($content));
191 $this->assertArrayHasKey('items', $content['_embedded']); 191 $this->assertArrayHasKey('items', $content['_embedded']);
192 $this->assertGreaterThanOrEqual(1, $content['total']); 192 $this->assertGreaterThanOrEqual(1, $content['total']);
193 $this->assertEquals(1, $content['page']); 193 $this->assertSame(1, $content['page']);
194 $this->assertEquals(30, $content['limit']); 194 $this->assertSame(30, $content['limit']);
195 $this->assertGreaterThanOrEqual(1, $content['pages']); 195 $this->assertGreaterThanOrEqual(1, $content['pages']);
196 196
197 $this->assertArrayHasKey('_links', $content); 197 $this->assertArrayHasKey('_links', $content);
@@ -204,7 +204,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
204 $this->assertContains('public=1', $content['_links'][$link]['href']); 204 $this->assertContains('public=1', $content['_links'][$link]['href']);
205 } 205 }
206 206
207 $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); 207 $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type'));
208 } 208 }
209 209
210 public function testGetEntriesOnPageTwo() 210 public function testGetEntriesOnPageTwo()
@@ -214,27 +214,27 @@ class EntryRestControllerTest extends WallabagApiTestCase
214 'perPage' => 2, 214 'perPage' => 2,
215 ]); 215 ]);
216 216
217 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 217 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
218 218
219 $content = json_decode($this->client->getResponse()->getContent(), true); 219 $content = json_decode($this->client->getResponse()->getContent(), true);
220 220
221 $this->assertGreaterThanOrEqual(0, $content['total']); 221 $this->assertGreaterThanOrEqual(0, $content['total']);
222 $this->assertEquals(2, $content['page']); 222 $this->assertSame(2, $content['page']);
223 $this->assertEquals(2, $content['limit']); 223 $this->assertSame(2, $content['limit']);
224 } 224 }
225 225
226 public function testGetStarredEntries() 226 public function testGetStarredEntries()
227 { 227 {
228 $this->client->request('GET', '/api/entries', ['starred' => 1, 'sort' => 'updated']); 228 $this->client->request('GET', '/api/entries', ['starred' => 1, 'sort' => 'updated']);
229 229
230 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 230 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
231 231
232 $content = json_decode($this->client->getResponse()->getContent(), true); 232 $content = json_decode($this->client->getResponse()->getContent(), true);
233 233
234 $this->assertGreaterThanOrEqual(1, count($content)); 234 $this->assertGreaterThanOrEqual(1, count($content));
235 $this->assertNotEmpty($content['_embedded']['items']); 235 $this->assertNotEmpty($content['_embedded']['items']);
236 $this->assertGreaterThanOrEqual(1, $content['total']); 236 $this->assertGreaterThanOrEqual(1, $content['total']);
237 $this->assertEquals(1, $content['page']); 237 $this->assertSame(1, $content['page']);
238 $this->assertGreaterThanOrEqual(1, $content['pages']); 238 $this->assertGreaterThanOrEqual(1, $content['pages']);
239 239
240 $this->assertArrayHasKey('_links', $content); 240 $this->assertArrayHasKey('_links', $content);
@@ -248,21 +248,21 @@ class EntryRestControllerTest extends WallabagApiTestCase
248 $this->assertContains('sort=updated', $content['_links'][$link]['href']); 248 $this->assertContains('sort=updated', $content['_links'][$link]['href']);
249 } 249 }
250 250
251 $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); 251 $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type'));
252 } 252 }
253 253
254 public function testGetArchiveEntries() 254 public function testGetArchiveEntries()
255 { 255 {
256 $this->client->request('GET', '/api/entries', ['archive' => 1]); 256 $this->client->request('GET', '/api/entries', ['archive' => 1]);
257 257
258 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 258 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
259 259
260 $content = json_decode($this->client->getResponse()->getContent(), true); 260 $content = json_decode($this->client->getResponse()->getContent(), true);
261 261
262 $this->assertGreaterThanOrEqual(1, count($content)); 262 $this->assertGreaterThanOrEqual(1, count($content));
263 $this->assertNotEmpty($content['_embedded']['items']); 263 $this->assertNotEmpty($content['_embedded']['items']);
264 $this->assertGreaterThanOrEqual(1, $content['total']); 264 $this->assertGreaterThanOrEqual(1, $content['total']);
265 $this->assertEquals(1, $content['page']); 265 $this->assertSame(1, $content['page']);
266 $this->assertGreaterThanOrEqual(1, $content['pages']); 266 $this->assertGreaterThanOrEqual(1, $content['pages']);
267 267
268 $this->assertArrayHasKey('_links', $content); 268 $this->assertArrayHasKey('_links', $content);
@@ -275,21 +275,21 @@ class EntryRestControllerTest extends WallabagApiTestCase
275 $this->assertContains('archive=1', $content['_links'][$link]['href']); 275 $this->assertContains('archive=1', $content['_links'][$link]['href']);
276 } 276 }
277 277
278 $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); 278 $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type'));
279 } 279 }
280 280
281 public function testGetTaggedEntries() 281 public function testGetTaggedEntries()
282 { 282 {
283 $this->client->request('GET', '/api/entries', ['tags' => 'foo,bar']); 283 $this->client->request('GET', '/api/entries', ['tags' => 'foo,bar']);
284 284
285 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 285 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
286 286
287 $content = json_decode($this->client->getResponse()->getContent(), true); 287 $content = json_decode($this->client->getResponse()->getContent(), true);
288 288
289 $this->assertGreaterThanOrEqual(1, count($content)); 289 $this->assertGreaterThanOrEqual(1, count($content));
290 $this->assertNotEmpty($content['_embedded']['items']); 290 $this->assertNotEmpty($content['_embedded']['items']);
291 $this->assertGreaterThanOrEqual(1, $content['total']); 291 $this->assertGreaterThanOrEqual(1, $content['total']);
292 $this->assertEquals(1, $content['page']); 292 $this->assertSame(1, $content['page']);
293 $this->assertGreaterThanOrEqual(1, $content['pages']); 293 $this->assertGreaterThanOrEqual(1, $content['pages']);
294 294
295 $this->assertArrayHasKey('_links', $content); 295 $this->assertArrayHasKey('_links', $content);
@@ -299,24 +299,24 @@ class EntryRestControllerTest extends WallabagApiTestCase
299 299
300 foreach (['self', 'first', 'last'] as $link) { 300 foreach (['self', 'first', 'last'] as $link) {
301 $this->assertArrayHasKey('href', $content['_links'][$link]); 301 $this->assertArrayHasKey('href', $content['_links'][$link]);
302 $this->assertContains('tags='.urlencode('foo,bar'), $content['_links'][$link]['href']); 302 $this->assertContains('tags=' . urlencode('foo,bar'), $content['_links'][$link]['href']);
303 } 303 }
304 304
305 $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); 305 $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type'));
306 } 306 }
307 307
308 public function testGetDatedEntries() 308 public function testGetDatedEntries()
309 { 309 {
310 $this->client->request('GET', '/api/entries', ['since' => 1443274283]); 310 $this->client->request('GET', '/api/entries', ['since' => 1443274283]);
311 311
312 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 312 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
313 313
314 $content = json_decode($this->client->getResponse()->getContent(), true); 314 $content = json_decode($this->client->getResponse()->getContent(), true);
315 315
316 $this->assertGreaterThanOrEqual(1, count($content)); 316 $this->assertGreaterThanOrEqual(1, count($content));
317 $this->assertNotEmpty($content['_embedded']['items']); 317 $this->assertNotEmpty($content['_embedded']['items']);
318 $this->assertGreaterThanOrEqual(1, $content['total']); 318 $this->assertGreaterThanOrEqual(1, $content['total']);
319 $this->assertEquals(1, $content['page']); 319 $this->assertSame(1, $content['page']);
320 $this->assertGreaterThanOrEqual(1, $content['pages']); 320 $this->assertGreaterThanOrEqual(1, $content['pages']);
321 321
322 $this->assertArrayHasKey('_links', $content); 322 $this->assertArrayHasKey('_links', $content);
@@ -329,7 +329,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
329 $this->assertContains('since=1443274283', $content['_links'][$link]['href']); 329 $this->assertContains('since=1443274283', $content['_links'][$link]['href']);
330 } 330 }
331 331
332 $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); 332 $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type'));
333 } 333 }
334 334
335 public function testGetDatedSupEntries() 335 public function testGetDatedSupEntries()
@@ -337,15 +337,15 @@ class EntryRestControllerTest extends WallabagApiTestCase
337 $future = new \DateTime(date('Y-m-d H:i:s')); 337 $future = new \DateTime(date('Y-m-d H:i:s'));
338 $this->client->request('GET', '/api/entries', ['since' => $future->getTimestamp() + 1000]); 338 $this->client->request('GET', '/api/entries', ['since' => $future->getTimestamp() + 1000]);
339 339
340 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 340 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
341 341
342 $content = json_decode($this->client->getResponse()->getContent(), true); 342 $content = json_decode($this->client->getResponse()->getContent(), true);
343 343
344 $this->assertGreaterThanOrEqual(1, count($content)); 344 $this->assertGreaterThanOrEqual(1, count($content));
345 $this->assertEmpty($content['_embedded']['items']); 345 $this->assertEmpty($content['_embedded']['items']);
346 $this->assertEquals(0, $content['total']); 346 $this->assertSame(0, $content['total']);
347 $this->assertEquals(1, $content['page']); 347 $this->assertSame(1, $content['page']);
348 $this->assertEquals(1, $content['pages']); 348 $this->assertSame(1, $content['pages']);
349 349
350 $this->assertArrayHasKey('_links', $content); 350 $this->assertArrayHasKey('_links', $content);
351 $this->assertArrayHasKey('self', $content['_links']); 351 $this->assertArrayHasKey('self', $content['_links']);
@@ -354,10 +354,10 @@ class EntryRestControllerTest extends WallabagApiTestCase
354 354
355 foreach (['self', 'first', 'last'] as $link) { 355 foreach (['self', 'first', 'last'] as $link) {
356 $this->assertArrayHasKey('href', $content['_links'][$link]); 356 $this->assertArrayHasKey('href', $content['_links'][$link]);
357 $this->assertContains('since='.($future->getTimestamp() + 1000), $content['_links'][$link]['href']); 357 $this->assertContains('since=' . ($future->getTimestamp() + 1000), $content['_links'][$link]['href']);
358 } 358 }
359 359
360 $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); 360 $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type'));
361 } 361 }
362 362
363 public function testDeleteEntry() 363 public function testDeleteEntry()
@@ -371,19 +371,19 @@ class EntryRestControllerTest extends WallabagApiTestCase
371 $this->markTestSkipped('No content found in db.'); 371 $this->markTestSkipped('No content found in db.');
372 } 372 }
373 373
374 $this->client->request('DELETE', '/api/entries/'.$entry->getId().'.json'); 374 $this->client->request('DELETE', '/api/entries/' . $entry->getId() . '.json');
375 375
376 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 376 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
377 377
378 $content = json_decode($this->client->getResponse()->getContent(), true); 378 $content = json_decode($this->client->getResponse()->getContent(), true);
379 379
380 $this->assertEquals($entry->getTitle(), $content['title']); 380 $this->assertSame($entry->getTitle(), $content['title']);
381 $this->assertEquals($entry->getUrl(), $content['url']); 381 $this->assertSame($entry->getUrl(), $content['url']);
382 382
383 // We'll try to delete this entry again 383 // We'll try to delete this entry again
384 $this->client->request('DELETE', '/api/entries/'.$entry->getId().'.json'); 384 $this->client->request('DELETE', '/api/entries/' . $entry->getId() . '.json');
385 385
386 $this->assertEquals(404, $this->client->getResponse()->getStatusCode()); 386 $this->assertSame(404, $this->client->getResponse()->getStatusCode());
387 } 387 }
388 388
389 public function testPostEntry() 389 public function testPostEntry()
@@ -399,16 +399,16 @@ class EntryRestControllerTest extends WallabagApiTestCase
399 'public' => 1, 399 'public' => 1,
400 ]); 400 ]);
401 401
402 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 402 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
403 403
404 $content = json_decode($this->client->getResponse()->getContent(), true); 404 $content = json_decode($this->client->getResponse()->getContent(), true);
405 405
406 $this->assertGreaterThan(0, $content['id']); 406 $this->assertGreaterThan(0, $content['id']);
407 $this->assertEquals('http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']); 407 $this->assertSame('http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']);
408 $this->assertEquals(false, $content['is_archived']); 408 $this->assertSame(false, $content['is_archived']);
409 $this->assertEquals(false, $content['is_starred']); 409 $this->assertSame(false, $content['is_starred']);
410 $this->assertEquals('New title for my article', $content['title']); 410 $this->assertSame('New title for my article', $content['title']);
411 $this->assertEquals(1, $content['user_id']); 411 $this->assertSame(1, $content['user_id']);
412 $this->assertCount(2, $content['tags']); 412 $this->assertCount(2, $content['tags']);
413 $this->assertSame('my content', $content['content']); 413 $this->assertSame('my content', $content['content']);
414 $this->assertSame('de', $content['language']); 414 $this->assertSame('de', $content['language']);
@@ -427,14 +427,14 @@ class EntryRestControllerTest extends WallabagApiTestCase
427 'tags' => 'google, apple', 427 'tags' => 'google, apple',
428 ]); 428 ]);
429 429
430 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 430 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
431 431
432 $content = json_decode($this->client->getResponse()->getContent(), true); 432 $content = json_decode($this->client->getResponse()->getContent(), true);
433 433
434 $this->assertGreaterThan(0, $content['id']); 434 $this->assertGreaterThan(0, $content['id']);
435 $this->assertEquals('http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']); 435 $this->assertSame('http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']);
436 $this->assertEquals(true, $content['is_archived']); 436 $this->assertSame(true, $content['is_archived']);
437 $this->assertEquals(false, $content['is_starred']); 437 $this->assertSame(false, $content['is_starred']);
438 $this->assertCount(3, $content['tags']); 438 $this->assertCount(3, $content['tags']);
439 } 439 }
440 440
@@ -456,10 +456,10 @@ class EntryRestControllerTest extends WallabagApiTestCase
456 'url' => 'http://www.example.com/', 456 'url' => 'http://www.example.com/',
457 ]); 457 ]);
458 458
459 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 459 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
460 $content = json_decode($this->client->getResponse()->getContent(), true); 460 $content = json_decode($this->client->getResponse()->getContent(), true);
461 $this->assertGreaterThan(0, $content['id']); 461 $this->assertGreaterThan(0, $content['id']);
462 $this->assertEquals('http://www.example.com/', $content['url']); 462 $this->assertSame('http://www.example.com/', $content['url']);
463 } finally { 463 } finally {
464 // Remove the created entry to avoid side effects on other tests 464 // Remove the created entry to avoid side effects on other tests
465 if (isset($content['id'])) { 465 if (isset($content['id'])) {
@@ -479,15 +479,15 @@ class EntryRestControllerTest extends WallabagApiTestCase
479 'starred' => '1', 479 'starred' => '1',
480 ]); 480 ]);
481 481
482 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 482 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
483 483
484 $content = json_decode($this->client->getResponse()->getContent(), true); 484 $content = json_decode($this->client->getResponse()->getContent(), true);
485 485
486 $this->assertGreaterThan(0, $content['id']); 486 $this->assertGreaterThan(0, $content['id']);
487 $this->assertEquals('http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', $content['url']); 487 $this->assertSame('http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', $content['url']);
488 $this->assertEquals(true, $content['is_archived']); 488 $this->assertSame(true, $content['is_archived']);
489 $this->assertEquals(true, $content['is_starred']); 489 $this->assertSame(true, $content['is_starred']);
490 $this->assertEquals(1, $content['user_id']); 490 $this->assertSame(1, $content['user_id']);
491 } 491 }
492 492
493 public function testPostArchivedAndStarredEntryWithoutQuotes() 493 public function testPostArchivedAndStarredEntryWithoutQuotes()
@@ -498,14 +498,14 @@ class EntryRestControllerTest extends WallabagApiTestCase
498 'starred' => 1, 498 'starred' => 1,
499 ]); 499 ]);
500 500
501 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 501 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
502 502
503 $content = json_decode($this->client->getResponse()->getContent(), true); 503 $content = json_decode($this->client->getResponse()->getContent(), true);
504 504
505 $this->assertGreaterThan(0, $content['id']); 505 $this->assertGreaterThan(0, $content['id']);
506 $this->assertEquals('http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', $content['url']); 506 $this->assertSame('http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', $content['url']);
507 $this->assertEquals(false, $content['is_archived']); 507 $this->assertSame(false, $content['is_archived']);
508 $this->assertEquals(true, $content['is_starred']); 508 $this->assertSame(true, $content['is_starred']);
509 } 509 }
510 510
511 public function testPatchEntry() 511 public function testPatchEntry()
@@ -522,9 +522,9 @@ class EntryRestControllerTest extends WallabagApiTestCase
522 // hydrate the tags relations 522 // hydrate the tags relations
523 $nbTags = count($entry->getTags()); 523 $nbTags = count($entry->getTags());
524 524
525 $this->client->request('PATCH', '/api/entries/'.$entry->getId().'.json', [ 525 $this->client->request('PATCH', '/api/entries/' . $entry->getId() . '.json', [
526 'title' => 'New awesome title', 526 'title' => 'New awesome title',
527 'tags' => 'new tag '.uniqid(), 527 'tags' => 'new tag ' . uniqid(),
528 'starred' => '1', 528 'starred' => '1',
529 'archive' => '0', 529 'archive' => '0',
530 'language' => 'de_AT', 530 'language' => 'de_AT',
@@ -534,20 +534,20 @@ class EntryRestControllerTest extends WallabagApiTestCase
534 'public' => 0, 534 'public' => 0,
535 ]); 535 ]);
536 536
537 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 537 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
538 538
539 $content = json_decode($this->client->getResponse()->getContent(), true); 539 $content = json_decode($this->client->getResponse()->getContent(), true);
540 540
541 $this->assertEquals($entry->getId(), $content['id']); 541 $this->assertSame($entry->getId(), $content['id']);
542 $this->assertEquals($entry->getUrl(), $content['url']); 542 $this->assertSame($entry->getUrl(), $content['url']);
543 $this->assertEquals('New awesome title', $content['title']); 543 $this->assertSame('New awesome title', $content['title']);
544 $this->assertGreaterThan($nbTags, count($content['tags'])); 544 $this->assertGreaterThan($nbTags, count($content['tags']));
545 $this->assertEquals(1, $content['user_id']); 545 $this->assertSame(1, $content['user_id']);
546 $this->assertEquals('de_AT', $content['language']); 546 $this->assertSame('de_AT', $content['language']);
547 $this->assertEquals('http://preview.io/picture.jpg', $content['preview_picture']); 547 $this->assertSame('http://preview.io/picture.jpg', $content['preview_picture']);
548 $this->assertContains('sponge', $content['published_by']); 548 $this->assertContains('sponge', $content['published_by']);
549 $this->assertContains('bob', $content['published_by']); 549 $this->assertContains('bob', $content['published_by']);
550 $this->assertEquals('awesome', $content['content']); 550 $this->assertSame('awesome', $content['content']);
551 $this->assertFalse($content['is_public'], 'Entry is no more shared'); 551 $this->assertFalse($content['is_public'], 'Entry is no more shared');
552 } 552 }
553 553
@@ -565,23 +565,23 @@ class EntryRestControllerTest extends WallabagApiTestCase
565 // hydrate the tags relations 565 // hydrate the tags relations
566 $nbTags = count($entry->getTags()); 566 $nbTags = count($entry->getTags());
567 567
568 $this->client->request('PATCH', '/api/entries/'.$entry->getId().'.json', [ 568 $this->client->request('PATCH', '/api/entries/' . $entry->getId() . '.json', [
569 'title' => 'New awesome title', 569 'title' => 'New awesome title',
570 'tags' => 'new tag '.uniqid(), 570 'tags' => 'new tag ' . uniqid(),
571 'starred' => 1, 571 'starred' => 1,
572 'archive' => 0, 572 'archive' => 0,
573 'authors' => ['bob', 'sponge'], 573 'authors' => ['bob', 'sponge'],
574 ]); 574 ]);
575 575
576 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 576 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
577 577
578 $content = json_decode($this->client->getResponse()->getContent(), true); 578 $content = json_decode($this->client->getResponse()->getContent(), true);
579 579
580 $this->assertEquals($entry->getId(), $content['id']); 580 $this->assertSame($entry->getId(), $content['id']);
581 $this->assertEquals($entry->getUrl(), $content['url']); 581 $this->assertSame($entry->getUrl(), $content['url']);
582 $this->assertEquals('New awesome title', $content['title']); 582 $this->assertSame('New awesome title', $content['title']);
583 $this->assertGreaterThan($nbTags, count($content['tags'])); 583 $this->assertGreaterThan($nbTags, count($content['tags']));
584 $this->assertTrue(empty($content['published_by']), 'Authors were not saved because of an array instead of a string'); 584 $this->assertEmpty($content['published_by'], 'Authors were not saved because of an array instead of a string');
585 } 585 }
586 586
587 public function testGetTagsEntry() 587 public function testGetTagsEntry()
@@ -602,9 +602,9 @@ class EntryRestControllerTest extends WallabagApiTestCase
602 $tags[] = ['id' => $tag->getId(), 'label' => $tag->getLabel(), 'slug' => $tag->getSlug()]; 602 $tags[] = ['id' => $tag->getId(), 'label' => $tag->getLabel(), 'slug' => $tag->getSlug()];
603 } 603 }
604 604
605 $this->client->request('GET', '/api/entries/'.$entry->getId().'/tags'); 605 $this->client->request('GET', '/api/entries/' . $entry->getId() . '/tags');
606 606
607 $this->assertEquals(json_encode($tags, JSON_HEX_QUOT), $this->client->getResponse()->getContent()); 607 $this->assertSame(json_encode($tags, JSON_HEX_QUOT), $this->client->getResponse()->getContent());
608 } 608 }
609 609
610 public function testPostTagsOnEntry() 610 public function testPostTagsOnEntry()
@@ -622,14 +622,14 @@ class EntryRestControllerTest extends WallabagApiTestCase
622 622
623 $newTags = 'tag1,tag2,tag3'; 623 $newTags = 'tag1,tag2,tag3';
624 624
625 $this->client->request('POST', '/api/entries/'.$entry->getId().'/tags', ['tags' => $newTags]); 625 $this->client->request('POST', '/api/entries/' . $entry->getId() . '/tags', ['tags' => $newTags]);
626 626
627 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 627 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
628 628
629 $content = json_decode($this->client->getResponse()->getContent(), true); 629 $content = json_decode($this->client->getResponse()->getContent(), true);
630 630
631 $this->assertArrayHasKey('tags', $content); 631 $this->assertArrayHasKey('tags', $content);
632 $this->assertEquals($nbTags + 3, count($content['tags'])); 632 $this->assertSame($nbTags + 3, count($content['tags']));
633 633
634 $entryDB = $this->client->getContainer() 634 $entryDB = $this->client->getContainer()
635 ->get('doctrine.orm.entity_manager') 635 ->get('doctrine.orm.entity_manager')
@@ -662,14 +662,14 @@ class EntryRestControllerTest extends WallabagApiTestCase
662 $nbTags = count($entry->getTags()); 662 $nbTags = count($entry->getTags());
663 $tag = $entry->getTags()[0]; 663 $tag = $entry->getTags()[0];
664 664
665 $this->client->request('DELETE', '/api/entries/'.$entry->getId().'/tags/'.$tag->getId().'.json'); 665 $this->client->request('DELETE', '/api/entries/' . $entry->getId() . '/tags/' . $tag->getId() . '.json');
666 666
667 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 667 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
668 668
669 $content = json_decode($this->client->getResponse()->getContent(), true); 669 $content = json_decode($this->client->getResponse()->getContent(), true);
670 670
671 $this->assertArrayHasKey('tags', $content); 671 $this->assertArrayHasKey('tags', $content);
672 $this->assertEquals($nbTags - 1, count($content['tags'])); 672 $this->assertSame($nbTags - 1, count($content['tags']));
673 } 673 }
674 674
675 public function testSaveIsArchivedAfterPost() 675 public function testSaveIsArchivedAfterPost()
@@ -687,11 +687,11 @@ class EntryRestControllerTest extends WallabagApiTestCase
687 'url' => $entry->getUrl(), 687 'url' => $entry->getUrl(),
688 ]); 688 ]);
689 689
690 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 690 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
691 691
692 $content = json_decode($this->client->getResponse()->getContent(), true); 692 $content = json_decode($this->client->getResponse()->getContent(), true);
693 693
694 $this->assertEquals(true, $content['is_archived']); 694 $this->assertSame(true, $content['is_archived']);
695 } 695 }
696 696
697 public function testSaveIsStarredAfterPost() 697 public function testSaveIsStarredAfterPost()
@@ -709,11 +709,11 @@ class EntryRestControllerTest extends WallabagApiTestCase
709 'url' => $entry->getUrl(), 709 'url' => $entry->getUrl(),
710 ]); 710 ]);
711 711
712 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 712 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
713 713
714 $content = json_decode($this->client->getResponse()->getContent(), true); 714 $content = json_decode($this->client->getResponse()->getContent(), true);
715 715
716 $this->assertEquals(true, $content['is_starred']); 716 $this->assertSame(true, $content['is_starred']);
717 } 717 }
718 718
719 public function testSaveIsArchivedAfterPatch() 719 public function testSaveIsArchivedAfterPatch()
@@ -727,15 +727,15 @@ class EntryRestControllerTest extends WallabagApiTestCase
727 $this->markTestSkipped('No content found in db.'); 727 $this->markTestSkipped('No content found in db.');
728 } 728 }
729 729
730 $this->client->request('PATCH', '/api/entries/'.$entry->getId().'.json', [ 730 $this->client->request('PATCH', '/api/entries/' . $entry->getId() . '.json', [
731 'title' => $entry->getTitle().'++', 731 'title' => $entry->getTitle() . '++',
732 ]); 732 ]);
733 733
734 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 734 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
735 735
736 $content = json_decode($this->client->getResponse()->getContent(), true); 736 $content = json_decode($this->client->getResponse()->getContent(), true);
737 737
738 $this->assertEquals(true, $content['is_archived']); 738 $this->assertSame(true, $content['is_archived']);
739 } 739 }
740 740
741 public function testSaveIsStarredAfterPatch() 741 public function testSaveIsStarredAfterPatch()
@@ -748,15 +748,15 @@ class EntryRestControllerTest extends WallabagApiTestCase
748 if (!$entry) { 748 if (!$entry) {
749 $this->markTestSkipped('No content found in db.'); 749 $this->markTestSkipped('No content found in db.');
750 } 750 }
751 $this->client->request('PATCH', '/api/entries/'.$entry->getId().'.json', [ 751 $this->client->request('PATCH', '/api/entries/' . $entry->getId() . '.json', [
752 'title' => $entry->getTitle().'++', 752 'title' => $entry->getTitle() . '++',
753 ]); 753 ]);
754 754
755 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 755 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
756 756
757 $content = json_decode($this->client->getResponse()->getContent(), true); 757 $content = json_decode($this->client->getResponse()->getContent(), true);
758 758
759 $this->assertEquals(true, $content['is_starred']); 759 $this->assertSame(true, $content['is_starred']);
760 } 760 }
761 761
762 public function dataForEntriesExistWithUrl() 762 public function dataForEntriesExistWithUrl()
@@ -780,7 +780,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
780 { 780 {
781 $this->client->request('GET', $url); 781 $this->client->request('GET', $url);
782 782
783 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 783 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
784 784
785 $content = json_decode($this->client->getResponse()->getContent(), true); 785 $content = json_decode($this->client->getResponse()->getContent(), true);
786 786
@@ -791,9 +791,9 @@ class EntryRestControllerTest extends WallabagApiTestCase
791 { 791 {
792 $url1 = 'http://0.0.0.0/entry2'; 792 $url1 = 'http://0.0.0.0/entry2';
793 $url2 = 'http://0.0.0.0/entry10'; 793 $url2 = 'http://0.0.0.0/entry10';
794 $this->client->request('GET', '/api/entries/exists?urls[]='.$url1.'&urls[]='.$url2.'&return_id=1'); 794 $this->client->request('GET', '/api/entries/exists?urls[]=' . $url1 . '&urls[]=' . $url2 . '&return_id=1');
795 795
796 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 796 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
797 797
798 $content = json_decode($this->client->getResponse()->getContent(), true); 798 $content = json_decode($this->client->getResponse()->getContent(), true);
799 799
@@ -807,9 +807,9 @@ class EntryRestControllerTest extends WallabagApiTestCase
807 { 807 {
808 $url1 = 'http://0.0.0.0/entry2'; 808 $url1 = 'http://0.0.0.0/entry2';
809 $url2 = 'http://0.0.0.0/entry10'; 809 $url2 = 'http://0.0.0.0/entry10';
810 $this->client->request('GET', '/api/entries/exists?urls[]='.$url1.'&urls[]='.$url2); 810 $this->client->request('GET', '/api/entries/exists?urls[]=' . $url1 . '&urls[]=' . $url2);
811 811
812 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 812 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
813 813
814 $content = json_decode($this->client->getResponse()->getContent(), true); 814 $content = json_decode($this->client->getResponse()->getContent(), true);
815 815
@@ -823,18 +823,18 @@ class EntryRestControllerTest extends WallabagApiTestCase
823 { 823 {
824 $this->client->request('GET', '/api/entries/exists?url=http://google.com/entry2'); 824 $this->client->request('GET', '/api/entries/exists?url=http://google.com/entry2');
825 825
826 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 826 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
827 827
828 $content = json_decode($this->client->getResponse()->getContent(), true); 828 $content = json_decode($this->client->getResponse()->getContent(), true);
829 829
830 $this->assertEquals(false, $content['exists']); 830 $this->assertSame(false, $content['exists']);
831 } 831 }
832 832
833 public function testGetEntriesExistsWithNoUrl() 833 public function testGetEntriesExistsWithNoUrl()
834 { 834 {
835 $this->client->request('GET', '/api/entries/exists?url='); 835 $this->client->request('GET', '/api/entries/exists?url=');
836 836
837 $this->assertEquals(403, $this->client->getResponse()->getStatusCode()); 837 $this->assertSame(403, $this->client->getResponse()->getStatusCode());
838 } 838 }
839 839
840 public function testReloadEntryErrorWhileFetching() 840 public function testReloadEntryErrorWhileFetching()
@@ -847,8 +847,8 @@ class EntryRestControllerTest extends WallabagApiTestCase
847 $this->markTestSkipped('No content found in db.'); 847 $this->markTestSkipped('No content found in db.');
848 } 848 }
849 849
850 $this->client->request('PATCH', '/api/entries/'.$entry->getId().'/reload.json'); 850 $this->client->request('PATCH', '/api/entries/' . $entry->getId() . '/reload.json');
851 $this->assertEquals(304, $this->client->getResponse()->getStatusCode()); 851 $this->assertSame(304, $this->client->getResponse()->getStatusCode());
852 } 852 }
853 853
854 public function testReloadEntry() 854 public function testReloadEntry()
@@ -863,14 +863,14 @@ class EntryRestControllerTest extends WallabagApiTestCase
863 863
864 $this->setUp(); 864 $this->setUp();
865 865
866 $this->client->request('PATCH', '/api/entries/'.$json['id'].'/reload.json'); 866 $this->client->request('PATCH', '/api/entries/' . $json['id'] . '/reload.json');
867 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 867 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
868 868
869 $content = json_decode($this->client->getResponse()->getContent(), true); 869 $content = json_decode($this->client->getResponse()->getContent(), true);
870 870
871 $this->assertNotEmpty($content['title']); 871 $this->assertNotEmpty($content['title']);
872 872
873 $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); 873 $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type'));
874 } 874 }
875 875
876 public function testPostEntriesTagsListAction() 876 public function testPostEntriesTagsListAction()
@@ -890,14 +890,14 @@ class EntryRestControllerTest extends WallabagApiTestCase
890 ], 890 ],
891 ]; 891 ];
892 892
893 $this->client->request('POST', '/api/entries/tags/lists?list='.json_encode($list)); 893 $this->client->request('POST', '/api/entries/tags/lists?list=' . json_encode($list));
894 894
895 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 895 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
896 896
897 $content = json_decode($this->client->getResponse()->getContent(), true); 897 $content = json_decode($this->client->getResponse()->getContent(), true);
898 898
899 $this->assertInternalType('int', $content[0]['entry']); 899 $this->assertInternalType('int', $content[0]['entry']);
900 $this->assertEquals('http://0.0.0.0/entry4', $content[0]['url']); 900 $this->assertSame('http://0.0.0.0/entry4', $content[0]['url']);
901 901
902 $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager') 902 $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager')
903 ->getRepository('WallabagCoreBundle:Entry') 903 ->getRepository('WallabagCoreBundle:Entry')
@@ -926,8 +926,8 @@ class EntryRestControllerTest extends WallabagApiTestCase
926 ], 926 ],
927 ]; 927 ];
928 928
929 $this->client->request('DELETE', '/api/entries/tags/list?list='.json_encode($list)); 929 $this->client->request('DELETE', '/api/entries/tags/list?list=' . json_encode($list));
930 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 930 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
931 931
932 $entry = $em->getRepository('WallabagCoreBundle:Entry')->find($entry->getId()); 932 $entry = $em->getRepository('WallabagCoreBundle:Entry')->find($entry->getId());
933 $this->assertCount(0, $entry->getTags()); 933 $this->assertCount(0, $entry->getTags());
@@ -940,17 +940,17 @@ class EntryRestControllerTest extends WallabagApiTestCase
940 'http://0.0.0.0/entry2', 940 'http://0.0.0.0/entry2',
941 ]; 941 ];
942 942
943 $this->client->request('POST', '/api/entries/lists?urls='.json_encode($list)); 943 $this->client->request('POST', '/api/entries/lists?urls=' . json_encode($list));
944 944
945 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 945 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
946 946
947 $content = json_decode($this->client->getResponse()->getContent(), true); 947 $content = json_decode($this->client->getResponse()->getContent(), true);
948 948
949 $this->assertInternalType('int', $content[0]['entry']); 949 $this->assertInternalType('int', $content[0]['entry']);
950 $this->assertEquals('http://www.lemonde.fr/musiques/article/2017/04/23/loin-de-la-politique-le-printemps-de-bourges-retombe-en-enfance_5115862_1654986.html', $content[0]['url']); 950 $this->assertSame('http://www.lemonde.fr/musiques/article/2017/04/23/loin-de-la-politique-le-printemps-de-bourges-retombe-en-enfance_5115862_1654986.html', $content[0]['url']);
951 951
952 $this->assertInternalType('int', $content[1]['entry']); 952 $this->assertInternalType('int', $content[1]['entry']);
953 $this->assertEquals('http://0.0.0.0/entry2', $content[1]['url']); 953 $this->assertSame('http://0.0.0.0/entry2', $content[1]['url']);
954 } 954 }
955 955
956 public function testDeleteEntriesListAction() 956 public function testDeleteEntriesListAction()
@@ -965,17 +965,17 @@ class EntryRestControllerTest extends WallabagApiTestCase
965 'http://0.0.0.0/test-entry-not-exist', 965 'http://0.0.0.0/test-entry-not-exist',
966 ]; 966 ];
967 967
968 $this->client->request('DELETE', '/api/entries/list?urls='.json_encode($list)); 968 $this->client->request('DELETE', '/api/entries/list?urls=' . json_encode($list));
969 969
970 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 970 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
971 971
972 $content = json_decode($this->client->getResponse()->getContent(), true); 972 $content = json_decode($this->client->getResponse()->getContent(), true);
973 973
974 $this->assertTrue($content[0]['entry']); 974 $this->assertTrue($content[0]['entry']);
975 $this->assertEquals('http://0.0.0.0/test-entry1', $content[0]['url']); 975 $this->assertSame('http://0.0.0.0/test-entry1', $content[0]['url']);
976 976
977 $this->assertFalse($content[1]['entry']); 977 $this->assertFalse($content[1]['entry']);
978 $this->assertEquals('http://0.0.0.0/test-entry-not-exist', $content[1]['url']); 978 $this->assertSame('http://0.0.0.0/test-entry-not-exist', $content[1]['url']);
979 } 979 }
980 980
981 public function testLimitBulkAction() 981 public function testLimitBulkAction()
@@ -994,9 +994,9 @@ class EntryRestControllerTest extends WallabagApiTestCase
994 'http://0.0.0.0/entry1', 994 'http://0.0.0.0/entry1',
995 ]; 995 ];
996 996
997 $this->client->request('POST', '/api/entries/lists?urls='.json_encode($list)); 997 $this->client->request('POST', '/api/entries/lists?urls=' . json_encode($list));
998 998
999 $this->assertEquals(400, $this->client->getResponse()->getStatusCode()); 999 $this->assertSame(400, $this->client->getResponse()->getStatusCode());
1000 $this->assertContains('API limit reached', $this->client->getResponse()->getContent()); 1000 $this->assertContains('API limit reached', $this->client->getResponse()->getContent());
1001 } 1001 }
1002} 1002}
diff --git a/tests/Wallabag/ApiBundle/Controller/TagRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/TagRestControllerTest.php
index 7f69bd67..430e548d 100644
--- a/tests/Wallabag/ApiBundle/Controller/TagRestControllerTest.php
+++ b/tests/Wallabag/ApiBundle/Controller/TagRestControllerTest.php
@@ -11,7 +11,7 @@ class TagRestControllerTest extends WallabagApiTestCase
11 { 11 {
12 $this->client->request('GET', '/api/tags.json'); 12 $this->client->request('GET', '/api/tags.json');
13 13
14 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 14 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
15 15
16 $content = json_decode($this->client->getResponse()->getContent(), true); 16 $content = json_decode($this->client->getResponse()->getContent(), true);
17 17
@@ -33,15 +33,15 @@ class TagRestControllerTest extends WallabagApiTestCase
33 $em->flush(); 33 $em->flush();
34 $em->clear(); 34 $em->clear();
35 35
36 $this->client->request('DELETE', '/api/tags/'.$tag->getId().'.json'); 36 $this->client->request('DELETE', '/api/tags/' . $tag->getId() . '.json');
37 37
38 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 38 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
39 39
40 $content = json_decode($this->client->getResponse()->getContent(), true); 40 $content = json_decode($this->client->getResponse()->getContent(), true);
41 41
42 $this->assertArrayHasKey('label', $content); 42 $this->assertArrayHasKey('label', $content);
43 $this->assertEquals($tag->getLabel(), $content['label']); 43 $this->assertSame($tag->getLabel(), $content['label']);
44 $this->assertEquals($tag->getSlug(), $content['slug']); 44 $this->assertSame($tag->getSlug(), $content['slug']);
45 45
46 $entries = $em->getRepository('WallabagCoreBundle:Entry') 46 $entries = $em->getRepository('WallabagCoreBundle:Entry')
47 ->findAllByTagId($this->user->getId(), $tag->getId()); 47 ->findAllByTagId($this->user->getId(), $tag->getId());
@@ -50,7 +50,7 @@ class TagRestControllerTest extends WallabagApiTestCase
50 50
51 $tag = $em->getRepository('WallabagCoreBundle:Tag')->findOneByLabel($tagLabel); 51 $tag = $em->getRepository('WallabagCoreBundle:Tag')->findOneByLabel($tagLabel);
52 52
53 $this->assertNull($tag, $tagLabel.' was removed because it begun an orphan tag'); 53 $this->assertNull($tag, $tagLabel . ' was removed because it begun an orphan tag');
54 } 54 }
55 55
56 public function dataForDeletingTagByLabel() 56 public function dataForDeletingTagByLabel()
@@ -84,18 +84,18 @@ class TagRestControllerTest extends WallabagApiTestCase
84 $em->flush(); 84 $em->flush();
85 85
86 if ($useQueryString) { 86 if ($useQueryString) {
87 $this->client->request('DELETE', '/api/tag/label.json?tag='.$tag->getLabel()); 87 $this->client->request('DELETE', '/api/tag/label.json?tag=' . $tag->getLabel());
88 } else { 88 } else {
89 $this->client->request('DELETE', '/api/tag/label.json', ['tag' => $tag->getLabel()]); 89 $this->client->request('DELETE', '/api/tag/label.json', ['tag' => $tag->getLabel()]);
90 } 90 }
91 91
92 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 92 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
93 93
94 $content = json_decode($this->client->getResponse()->getContent(), true); 94 $content = json_decode($this->client->getResponse()->getContent(), true);
95 95
96 $this->assertArrayHasKey('label', $content); 96 $this->assertArrayHasKey('label', $content);
97 $this->assertEquals($tag->getLabel(), $content['label']); 97 $this->assertSame($tag->getLabel(), $content['label']);
98 $this->assertEquals($tag->getSlug(), $content['slug']); 98 $this->assertSame($tag->getSlug(), $content['slug']);
99 99
100 $entries = $this->client->getContainer() 100 $entries = $this->client->getContainer()
101 ->get('doctrine.orm.entity_manager') 101 ->get('doctrine.orm.entity_manager')
@@ -109,7 +109,7 @@ class TagRestControllerTest extends WallabagApiTestCase
109 { 109 {
110 $this->client->request('DELETE', '/api/tag/label.json', ['tag' => 'does not exist']); 110 $this->client->request('DELETE', '/api/tag/label.json', ['tag' => 'does not exist']);
111 111
112 $this->assertEquals(404, $this->client->getResponse()->getStatusCode()); 112 $this->assertSame(404, $this->client->getResponse()->getStatusCode());
113 } 113 }
114 114
115 /** 115 /**
@@ -140,24 +140,24 @@ class TagRestControllerTest extends WallabagApiTestCase
140 $em->flush(); 140 $em->flush();
141 141
142 if ($useQueryString) { 142 if ($useQueryString) {
143 $this->client->request('DELETE', '/api/tags/label.json?tags='.$tag->getLabel().','.$tag2->getLabel()); 143 $this->client->request('DELETE', '/api/tags/label.json?tags=' . $tag->getLabel() . ',' . $tag2->getLabel());
144 } else { 144 } else {
145 $this->client->request('DELETE', '/api/tags/label.json', ['tags' => $tag->getLabel().','.$tag2->getLabel()]); 145 $this->client->request('DELETE', '/api/tags/label.json', ['tags' => $tag->getLabel() . ',' . $tag2->getLabel()]);
146 } 146 }
147 147
148 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 148 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
149 149
150 $content = json_decode($this->client->getResponse()->getContent(), true); 150 $content = json_decode($this->client->getResponse()->getContent(), true);
151 151
152 $this->assertCount(2, $content); 152 $this->assertCount(2, $content);
153 153
154 $this->assertArrayHasKey('label', $content[0]); 154 $this->assertArrayHasKey('label', $content[0]);
155 $this->assertEquals($tag->getLabel(), $content[0]['label']); 155 $this->assertSame($tag->getLabel(), $content[0]['label']);
156 $this->assertEquals($tag->getSlug(), $content[0]['slug']); 156 $this->assertSame($tag->getSlug(), $content[0]['slug']);
157 157
158 $this->assertArrayHasKey('label', $content[1]); 158 $this->assertArrayHasKey('label', $content[1]);
159 $this->assertEquals($tag2->getLabel(), $content[1]['label']); 159 $this->assertSame($tag2->getLabel(), $content[1]['label']);
160 $this->assertEquals($tag2->getSlug(), $content[1]['slug']); 160 $this->assertSame($tag2->getSlug(), $content[1]['slug']);
161 161
162 $entries = $this->client->getContainer() 162 $entries = $this->client->getContainer()
163 ->get('doctrine.orm.entity_manager') 163 ->get('doctrine.orm.entity_manager')
@@ -178,6 +178,6 @@ class TagRestControllerTest extends WallabagApiTestCase
178 { 178 {
179 $this->client->request('DELETE', '/api/tags/label.json', ['tags' => 'does not exist']); 179 $this->client->request('DELETE', '/api/tags/label.json', ['tags' => 'does not exist']);
180 180
181 $this->assertEquals(404, $this->client->getResponse()->getStatusCode()); 181 $this->assertSame(404, $this->client->getResponse()->getStatusCode());
182 } 182 }
183} 183}
diff --git a/tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php
index 4e65f130..51fac2bd 100644
--- a/tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php
+++ b/tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php
@@ -9,7 +9,7 @@ class UserRestControllerTest extends WallabagApiTestCase
9 public function testGetUser() 9 public function testGetUser()
10 { 10 {
11 $this->client->request('GET', '/api/user.json'); 11 $this->client->request('GET', '/api/user.json');
12 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 12 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
13 13
14 $content = json_decode($this->client->getResponse()->getContent(), true); 14 $content = json_decode($this->client->getResponse()->getContent(), true);
15 15
@@ -20,27 +20,27 @@ class UserRestControllerTest extends WallabagApiTestCase
20 $this->assertArrayHasKey('created_at', $content); 20 $this->assertArrayHasKey('created_at', $content);
21 $this->assertArrayHasKey('updated_at', $content); 21 $this->assertArrayHasKey('updated_at', $content);
22 22
23 $this->assertEquals('bigboss@wallabag.org', $content['email']); 23 $this->assertSame('bigboss@wallabag.org', $content['email']);
24 $this->assertEquals('Big boss', $content['name']); 24 $this->assertSame('Big boss', $content['name']);
25 $this->assertEquals('admin', $content['username']); 25 $this->assertSame('admin', $content['username']);
26 26
27 $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); 27 $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type'));
28 } 28 }
29 29
30 public function testGetUserWithoutAuthentication() 30 public function testGetUserWithoutAuthentication()
31 { 31 {
32 $client = static::createClient(); 32 $client = static::createClient();
33 $client->request('GET', '/api/user.json'); 33 $client->request('GET', '/api/user.json');
34 $this->assertEquals(401, $client->getResponse()->getStatusCode()); 34 $this->assertSame(401, $client->getResponse()->getStatusCode());
35 35
36 $content = json_decode($client->getResponse()->getContent(), true); 36 $content = json_decode($client->getResponse()->getContent(), true);
37 37
38 $this->assertArrayHasKey('error', $content); 38 $this->assertArrayHasKey('error', $content);
39 $this->assertArrayHasKey('error_description', $content); 39 $this->assertArrayHasKey('error_description', $content);
40 40
41 $this->assertEquals('access_denied', $content['error']); 41 $this->assertSame('access_denied', $content['error']);
42 42
43 $this->assertEquals('application/json', $client->getResponse()->headers->get('Content-Type')); 43 $this->assertSame('application/json', $client->getResponse()->headers->get('Content-Type'));
44 } 44 }
45 45
46 public function testCreateNewUser() 46 public function testCreateNewUser()
@@ -52,7 +52,7 @@ class UserRestControllerTest extends WallabagApiTestCase
52 'email' => 'wallabag@google.com', 52 'email' => 'wallabag@google.com',
53 ]); 53 ]);
54 54
55 $this->assertEquals(201, $this->client->getResponse()->getStatusCode()); 55 $this->assertSame(201, $this->client->getResponse()->getStatusCode());
56 56
57 $content = json_decode($this->client->getResponse()->getContent(), true); 57 $content = json_decode($this->client->getResponse()->getContent(), true);
58 58
@@ -63,15 +63,15 @@ class UserRestControllerTest extends WallabagApiTestCase
63 $this->assertArrayHasKey('updated_at', $content); 63 $this->assertArrayHasKey('updated_at', $content);
64 $this->assertArrayHasKey('default_client', $content); 64 $this->assertArrayHasKey('default_client', $content);
65 65
66 $this->assertEquals('wallabag@google.com', $content['email']); 66 $this->assertSame('wallabag@google.com', $content['email']);
67 $this->assertEquals('google', $content['username']); 67 $this->assertSame('google', $content['username']);
68 68
69 $this->assertArrayHasKey('client_secret', $content['default_client']); 69 $this->assertArrayHasKey('client_secret', $content['default_client']);
70 $this->assertArrayHasKey('client_id', $content['default_client']); 70 $this->assertArrayHasKey('client_id', $content['default_client']);
71 71
72 $this->assertEquals('Default client', $content['default_client']['name']); 72 $this->assertSame('Default client', $content['default_client']['name']);
73 73
74 $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); 74 $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type'));
75 75
76 $this->client->getContainer()->get('craue_config')->set('api_user_registration', 0); 76 $this->client->getContainer()->get('craue_config')->set('api_user_registration', 0);
77 } 77 }
@@ -88,7 +88,7 @@ class UserRestControllerTest extends WallabagApiTestCase
88 'client_name' => 'My client name !!', 88 'client_name' => 'My client name !!',
89 ]); 89 ]);
90 90
91 $this->assertEquals(201, $client->getResponse()->getStatusCode()); 91 $this->assertSame(201, $client->getResponse()->getStatusCode());
92 92
93 $content = json_decode($client->getResponse()->getContent(), true); 93 $content = json_decode($client->getResponse()->getContent(), true);
94 94
@@ -99,15 +99,15 @@ class UserRestControllerTest extends WallabagApiTestCase
99 $this->assertArrayHasKey('updated_at', $content); 99 $this->assertArrayHasKey('updated_at', $content);
100 $this->assertArrayHasKey('default_client', $content); 100 $this->assertArrayHasKey('default_client', $content);
101 101
102 $this->assertEquals('wallabag@google.com', $content['email']); 102 $this->assertSame('wallabag@google.com', $content['email']);
103 $this->assertEquals('google', $content['username']); 103 $this->assertSame('google', $content['username']);
104 104
105 $this->assertArrayHasKey('client_secret', $content['default_client']); 105 $this->assertArrayHasKey('client_secret', $content['default_client']);
106 $this->assertArrayHasKey('client_id', $content['default_client']); 106 $this->assertArrayHasKey('client_id', $content['default_client']);
107 107
108 $this->assertEquals('My client name !!', $content['default_client']['name']); 108 $this->assertSame('My client name !!', $content['default_client']['name']);
109 109
110 $this->assertEquals('application/json', $client->getResponse()->headers->get('Content-Type')); 110 $this->assertSame('application/json', $client->getResponse()->headers->get('Content-Type'));
111 111
112 $client->getContainer()->get('craue_config')->set('api_user_registration', 0); 112 $client->getContainer()->get('craue_config')->set('api_user_registration', 0);
113 } 113 }
@@ -122,7 +122,7 @@ class UserRestControllerTest extends WallabagApiTestCase
122 'email' => 'bigboss@wallabag.org', 122 'email' => 'bigboss@wallabag.org',
123 ]); 123 ]);
124 124
125 $this->assertEquals(400, $client->getResponse()->getStatusCode()); 125 $this->assertSame(400, $client->getResponse()->getStatusCode());
126 126
127 $content = json_decode($client->getResponse()->getContent(), true); 127 $content = json_decode($client->getResponse()->getContent(), true);
128 128
@@ -133,10 +133,10 @@ class UserRestControllerTest extends WallabagApiTestCase
133 // $this->assertEquals('fos_user.username.already_used', $content['error']['username'][0]); 133 // $this->assertEquals('fos_user.username.already_used', $content['error']['username'][0]);
134 // $this->assertEquals('fos_user.email.already_used', $content['error']['email'][0]); 134 // $this->assertEquals('fos_user.email.already_used', $content['error']['email'][0]);
135 // This shouldn't be translated ... 135 // This shouldn't be translated ...
136 $this->assertEquals('This value is already used.', $content['error']['username'][0]); 136 $this->assertSame('This value is already used.', $content['error']['username'][0]);
137 $this->assertEquals('This value is already used.', $content['error']['email'][0]); 137 $this->assertSame('This value is already used.', $content['error']['email'][0]);
138 138
139 $this->assertEquals('application/json', $client->getResponse()->headers->get('Content-Type')); 139 $this->assertSame('application/json', $client->getResponse()->headers->get('Content-Type'));
140 140
141 $client->getContainer()->get('craue_config')->set('api_user_registration', 0); 141 $client->getContainer()->get('craue_config')->set('api_user_registration', 0);
142 } 142 }
@@ -151,16 +151,16 @@ class UserRestControllerTest extends WallabagApiTestCase
151 'email' => 'facebook@wallabag.org', 151 'email' => 'facebook@wallabag.org',
152 ]); 152 ]);
153 153
154 $this->assertEquals(400, $client->getResponse()->getStatusCode()); 154 $this->assertSame(400, $client->getResponse()->getStatusCode());
155 155
156 $content = json_decode($client->getResponse()->getContent(), true); 156 $content = json_decode($client->getResponse()->getContent(), true);
157 157
158 $this->assertArrayHasKey('error', $content); 158 $this->assertArrayHasKey('error', $content);
159 $this->assertArrayHasKey('password', $content['error']); 159 $this->assertArrayHasKey('password', $content['error']);
160 160
161 $this->assertEquals('validator.password_too_short', $content['error']['password'][0]); 161 $this->assertSame('validator.password_too_short', $content['error']['password'][0]);
162 162
163 $this->assertEquals('application/json', $client->getResponse()->headers->get('Content-Type')); 163 $this->assertSame('application/json', $client->getResponse()->headers->get('Content-Type'));
164 164
165 $client->getContainer()->get('craue_config')->set('api_user_registration', 0); 165 $client->getContainer()->get('craue_config')->set('api_user_registration', 0);
166 } 166 }
@@ -174,12 +174,12 @@ class UserRestControllerTest extends WallabagApiTestCase
174 'email' => 'facebook@wallabag.org', 174 'email' => 'facebook@wallabag.org',
175 ]); 175 ]);
176 176
177 $this->assertEquals(403, $client->getResponse()->getStatusCode()); 177 $this->assertSame(403, $client->getResponse()->getStatusCode());
178 178
179 $content = json_decode($client->getResponse()->getContent(), true); 179 $content = json_decode($client->getResponse()->getContent(), true);
180 180
181 $this->assertArrayHasKey('error', $content); 181 $this->assertArrayHasKey('error', $content);
182 182
183 $this->assertEquals('application/json', $client->getResponse()->headers->get('Content-Type')); 183 $this->assertSame('application/json', $client->getResponse()->headers->get('Content-Type'));
184 } 184 }
185} 185}
diff --git a/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php
index df638e8f..ac4d6cdc 100644
--- a/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php
+++ b/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php
@@ -12,10 +12,10 @@ class WallabagRestControllerTest extends WallabagApiTestCase
12 $client = static::createClient(); 12 $client = static::createClient();
13 $client->request('GET', '/api/version'); 13 $client->request('GET', '/api/version');
14 14
15 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 15 $this->assertSame(200, $client->getResponse()->getStatusCode());
16 16
17 $content = json_decode($client->getResponse()->getContent(), true); 17 $content = json_decode($client->getResponse()->getContent(), true);
18 18
19 $this->assertEquals($client->getContainer()->getParameter('wallabag_core.version'), $content); 19 $this->assertSame($client->getContainer()->getParameter('wallabag_core.version'), $content);
20 } 20 }
21} 21}
diff --git a/tests/Wallabag/ApiBundle/WallabagApiTestCase.php b/tests/Wallabag/ApiBundle/WallabagApiTestCase.php
index 8709da70..8a188e1c 100644
--- a/tests/Wallabag/ApiBundle/WallabagApiTestCase.php
+++ b/tests/Wallabag/ApiBundle/WallabagApiTestCase.php
@@ -40,7 +40,7 @@ abstract class WallabagApiTestCase extends WebTestCase
40 $loginManager->logInUser($firewallName, $this->user); 40 $loginManager->logInUser($firewallName, $this->user);
41 41
42 // save the login token into the session and put it in a cookie 42 // save the login token into the session and put it in a cookie
43 $container->get('session')->set('_security_'.$firewallName, serialize($container->get('security.token_storage')->getToken())); 43 $container->get('session')->set('_security_' . $firewallName, serialize($container->get('security.token_storage')->getToken()));
44 $container->get('session')->save(); 44 $container->get('session')->save();
45 45
46 $session = $container->get('session'); 46 $session = $container->get('session');
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
5use Symfony\Bundle\FrameworkBundle\Console\Application; 5use Symfony\Bundle\FrameworkBundle\Console\Application;
6use Symfony\Component\Console\Tester\CommandTester; 6use Symfony\Component\Console\Tester\CommandTester;
7use Wallabag\CoreBundle\Command\CleanDuplicatesCommand;
8use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; 7use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
8use Wallabag\CoreBundle\Command\CleanDuplicatesCommand;
9use Wallabag\CoreBundle\Entity\Entry; 9use Wallabag\CoreBundle\Entity\Entry;
10 10
11class CleanDuplicatesCommandTest extends WallabagCoreTestCase 11class 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
5use Symfony\Bundle\FrameworkBundle\Console\Application; 5use Symfony\Bundle\FrameworkBundle\Console\Application;
6use Symfony\Component\Console\Tester\CommandTester; 6use Symfony\Component\Console\Tester\CommandTester;
7use Wallabag\CoreBundle\Command\ExportCommand;
8use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; 7use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
8use Wallabag\CoreBundle\Command\ExportCommand;
9 9
10class ExportCommandTest extends WallabagCoreTestCase 10class 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;
11use Symfony\Component\Console\Input\ArrayInput; 11use Symfony\Component\Console\Input\ArrayInput;
12use Symfony\Component\Console\Output\NullOutput; 12use Symfony\Component\Console\Output\NullOutput;
13use Symfony\Component\Console\Tester\CommandTester; 13use Symfony\Component\Console\Tester\CommandTester;
14use Wallabag\CoreBundle\Command\InstallCommand;
15use Tests\Wallabag\CoreBundle\Mock\InstallCommandMock; 14use Tests\Wallabag\CoreBundle\Mock\InstallCommandMock;
16use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; 15use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
16use Wallabag\CoreBundle\Command\InstallCommand;
17 17
18class InstallCommandTest extends WallabagCoreTestCase 18class 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
5use Symfony\Bundle\FrameworkBundle\Console\Application; 5use Symfony\Bundle\FrameworkBundle\Console\Application;
6use Symfony\Component\Console\Tester\CommandTester; 6use Symfony\Component\Console\Tester\CommandTester;
7use Wallabag\CoreBundle\Command\TagAllCommand;
8use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; 7use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
8use Wallabag\CoreBundle\Command\TagAllCommand;
9 9
10class TagAllCommandTest extends WallabagCoreTestCase 10class 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 @@
3namespace tests\Wallabag\CoreBundle\Controller; 3namespace tests\Wallabag\CoreBundle\Controller;
4 4
5use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; 5use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
6use Wallabag\AnnotationBundle\Entity\Annotation;
6use Wallabag\CoreBundle\Entity\Config; 7use Wallabag\CoreBundle\Entity\Config;
7use Wallabag\UserBundle\Entity\User;
8use Wallabag\CoreBundle\Entity\Entry; 8use Wallabag\CoreBundle\Entity\Entry;
9use Wallabag\CoreBundle\Entity\Tag; 9use Wallabag\CoreBundle\Entity\Tag;
10use Wallabag\AnnotationBundle\Entity\Annotation; 10use Wallabag\UserBundle\Entity\User;
11 11
12class ConfigControllerTest extends WallabagCoreTestCase 12class 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..b528bcdb 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
@@ -45,14 +45,14 @@ class EntryControllerTest extends WallabagCoreTestCase
45 $client->request('GET', '/unread/list'); 45 $client->request('GET', '/unread/list');
46 $crawler = $client->followRedirect(); 46 $crawler = $client->followRedirect();
47 47
48 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 48 $this->assertSame(200, $client->getResponse()->getStatusCode());
49 $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); 49 $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
50 $this->assertContains('quickstart.intro.title', $body[0]); 50 $this->assertContains('quickstart.intro.title', $body[0]);
51 51
52 // Test if quickstart is disabled when user has 1 entry 52 // Test if quickstart is disabled when user has 1 entry
53 $crawler = $client->request('GET', '/new'); 53 $crawler = $client->request('GET', '/new');
54 54
55 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 55 $this->assertSame(200, $client->getResponse()->getStatusCode());
56 56
57 $form = $crawler->filter('form[name=entry]')->form(); 57 $form = $crawler->filter('form[name=entry]')->form();
58 58
@@ -61,7 +61,7 @@ class EntryControllerTest extends WallabagCoreTestCase
61 ]; 61 ];
62 62
63 $client->submit($form, $data); 63 $client->submit($form, $data);
64 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 64 $this->assertSame(302, $client->getResponse()->getStatusCode());
65 $client->followRedirect(); 65 $client->followRedirect();
66 66
67 $crawler = $client->request('GET', '/unread/list'); 67 $crawler = $client->request('GET', '/unread/list');
@@ -77,7 +77,7 @@ class EntryControllerTest extends WallabagCoreTestCase
77 77
78 $crawler = $client->request('GET', '/new'); 78 $crawler = $client->request('GET', '/new');
79 79
80 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 80 $this->assertSame(200, $client->getResponse()->getStatusCode());
81 81
82 $this->assertCount(1, $crawler->filter('input[type=url]')); 82 $this->assertCount(1, $crawler->filter('input[type=url]'));
83 $this->assertCount(1, $crawler->filter('form[name=entry]')); 83 $this->assertCount(1, $crawler->filter('form[name=entry]'));
@@ -95,7 +95,7 @@ class EntryControllerTest extends WallabagCoreTestCase
95 95
96 // Good URL 96 // Good URL
97 $client->request('GET', '/bookmarklet', ['url' => $this->url]); 97 $client->request('GET', '/bookmarklet', ['url' => $this->url]);
98 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 98 $this->assertSame(302, $client->getResponse()->getStatusCode());
99 $client->followRedirect(); 99 $client->followRedirect();
100 $crawler = $client->request('GET', '/'); 100 $crawler = $client->request('GET', '/');
101 $this->assertCount(5, $crawler->filter('div[class=entry]')); 101 $this->assertCount(5, $crawler->filter('div[class=entry]'));
@@ -116,15 +116,15 @@ class EntryControllerTest extends WallabagCoreTestCase
116 116
117 $crawler = $client->request('GET', '/new'); 117 $crawler = $client->request('GET', '/new');
118 118
119 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 119 $this->assertSame(200, $client->getResponse()->getStatusCode());
120 120
121 $form = $crawler->filter('form[name=entry]')->form(); 121 $form = $crawler->filter('form[name=entry]')->form();
122 122
123 $crawler = $client->submit($form); 123 $crawler = $client->submit($form);
124 124
125 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 125 $this->assertSame(200, $client->getResponse()->getStatusCode());
126 $this->assertCount(1, $alert = $crawler->filter('form ul li')->extract(['_text'])); 126 $this->assertCount(1, $alert = $crawler->filter('form ul li')->extract(['_text']));
127 $this->assertEquals('This value should not be blank.', $alert[0]); 127 $this->assertSame('This value should not be blank.', $alert[0]);
128 } 128 }
129 129
130 /** 130 /**
@@ -137,7 +137,7 @@ class EntryControllerTest extends WallabagCoreTestCase
137 137
138 $crawler = $client->request('GET', '/new'); 138 $crawler = $client->request('GET', '/new');
139 139
140 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 140 $this->assertSame(200, $client->getResponse()->getStatusCode());
141 141
142 $form = $crawler->filter('form[name=entry]')->form(); 142 $form = $crawler->filter('form[name=entry]')->form();
143 143
@@ -147,7 +147,7 @@ class EntryControllerTest extends WallabagCoreTestCase
147 147
148 $client->submit($form, $data); 148 $client->submit($form, $data);
149 149
150 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 150 $this->assertSame(302, $client->getResponse()->getStatusCode());
151 151
152 $content = $client->getContainer() 152 $content = $client->getContainer()
153 ->get('doctrine.orm.entity_manager') 153 ->get('doctrine.orm.entity_manager')
@@ -157,11 +157,11 @@ class EntryControllerTest extends WallabagCoreTestCase
157 $author = $content->getPublishedBy(); 157 $author = $content->getPublishedBy();
158 158
159 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content); 159 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
160 $this->assertEquals($this->url, $content->getUrl()); 160 $this->assertSame($this->url, $content->getUrl());
161 $this->assertContains('Google', $content->getTitle()); 161 $this->assertContains('Google', $content->getTitle());
162 $this->assertEquals('fr', $content->getLanguage()); 162 $this->assertSame('fr', $content->getLanguage());
163 $this->assertEquals('2015-03-28 15:37:39', $content->getPublishedAt()->format('Y-m-d H:i:s')); 163 $this->assertSame('2015-03-28 15:37:39', $content->getPublishedAt()->format('Y-m-d H:i:s'));
164 $this->assertEquals('Morgane Tual', $author[0]); 164 $this->assertSame('Morgane Tual', $author[0]);
165 $this->assertArrayHasKey('x-varnish1', $content->getHeaders()); 165 $this->assertArrayHasKey('x-varnish1', $content->getHeaders());
166 } 166 }
167 167
@@ -173,7 +173,7 @@ class EntryControllerTest extends WallabagCoreTestCase
173 173
174 $crawler = $client->request('GET', '/new'); 174 $crawler = $client->request('GET', '/new');
175 175
176 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 176 $this->assertSame(200, $client->getResponse()->getStatusCode());
177 177
178 $form = $crawler->filter('form[name=entry]')->form(); 178 $form = $crawler->filter('form[name=entry]')->form();
179 179
@@ -183,7 +183,7 @@ class EntryControllerTest extends WallabagCoreTestCase
183 183
184 $client->submit($form, $data); 184 $client->submit($form, $data);
185 185
186 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 186 $this->assertSame(302, $client->getResponse()->getStatusCode());
187 187
188 $content = $client->getContainer() 188 $content = $client->getContainer()
189 ->get('doctrine.orm.entity_manager') 189 ->get('doctrine.orm.entity_manager')
@@ -191,10 +191,10 @@ class EntryControllerTest extends WallabagCoreTestCase
191 ->findByUrlAndUserId($url, $this->getLoggedInUserId()); 191 ->findByUrlAndUserId($url, $this->getLoggedInUserId());
192 192
193 $authors = $content->getPublishedBy(); 193 $authors = $content->getPublishedBy();
194 $this->assertEquals('2017-04-05 19:26:13', $content->getPublishedAt()->format('Y-m-d H:i:s')); 194 $this->assertSame('2017-04-05 19:26:13', $content->getPublishedAt()->format('Y-m-d H:i:s'));
195 $this->assertEquals('fr', $content->getLanguage()); 195 $this->assertSame('fr', $content->getLanguage());
196 $this->assertEquals('Raphaël Balenieri, correspondant à Pékin', $authors[0]); 196 $this->assertSame('Raphaël Balenieri, correspondant à Pékin', $authors[0]);
197 $this->assertEquals('Frédéric Autran, correspondant à New York', $authors[1]); 197 $this->assertSame('Frédéric Autran, correspondant à New York', $authors[1]);
198 } 198 }
199 199
200 public function testPostNewOkUrlExist() 200 public function testPostNewOkUrlExist()
@@ -210,7 +210,7 @@ class EntryControllerTest extends WallabagCoreTestCase
210 210
211 $crawler = $client->request('GET', '/new'); 211 $crawler = $client->request('GET', '/new');
212 212
213 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 213 $this->assertSame(200, $client->getResponse()->getStatusCode());
214 214
215 $form = $crawler->filter('form[name=entry]')->form(); 215 $form = $crawler->filter('form[name=entry]')->form();
216 216
@@ -220,7 +220,7 @@ class EntryControllerTest extends WallabagCoreTestCase
220 220
221 $client->submit($form, $data); 221 $client->submit($form, $data);
222 222
223 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 223 $this->assertSame(302, $client->getResponse()->getStatusCode());
224 $this->assertContains('/view/', $client->getResponse()->getTargetUrl()); 224 $this->assertContains('/view/', $client->getResponse()->getTargetUrl());
225 } 225 }
226 226
@@ -233,7 +233,7 @@ class EntryControllerTest extends WallabagCoreTestCase
233 233
234 $crawler = $client->request('GET', '/new'); 234 $crawler = $client->request('GET', '/new');
235 235
236 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 236 $this->assertSame(200, $client->getResponse()->getStatusCode());
237 237
238 $form = $crawler->filter('form[name=entry]')->form(); 238 $form = $crawler->filter('form[name=entry]')->form();
239 239
@@ -245,7 +245,7 @@ class EntryControllerTest extends WallabagCoreTestCase
245 245
246 $crawler = $client->request('GET', '/new'); 246 $crawler = $client->request('GET', '/new');
247 247
248 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 248 $this->assertSame(200, $client->getResponse()->getStatusCode());
249 249
250 $form = $crawler->filter('form[name=entry]')->form(); 250 $form = $crawler->filter('form[name=entry]')->form();
251 251
@@ -255,7 +255,7 @@ class EntryControllerTest extends WallabagCoreTestCase
255 255
256 $client->submit($form, $data); 256 $client->submit($form, $data);
257 257
258 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 258 $this->assertSame(302, $client->getResponse()->getStatusCode());
259 $this->assertContains('/view/', $client->getResponse()->getTargetUrl()); 259 $this->assertContains('/view/', $client->getResponse()->getTargetUrl());
260 } 260 }
261 261
@@ -269,7 +269,7 @@ class EntryControllerTest extends WallabagCoreTestCase
269 269
270 $crawler = $client->request('GET', '/new'); 270 $crawler = $client->request('GET', '/new');
271 271
272 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 272 $this->assertSame(200, $client->getResponse()->getStatusCode());
273 273
274 $form = $crawler->filter('form[name=entry]')->form(); 274 $form = $crawler->filter('form[name=entry]')->form();
275 275
@@ -279,7 +279,7 @@ class EntryControllerTest extends WallabagCoreTestCase
279 279
280 $client->submit($form, $data); 280 $client->submit($form, $data);
281 281
282 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 282 $this->assertSame(302, $client->getResponse()->getStatusCode());
283 $this->assertContains('/', $client->getResponse()->getTargetUrl()); 283 $this->assertContains('/', $client->getResponse()->getTargetUrl());
284 284
285 $em = $client->getContainer() 285 $em = $client->getContainer()
@@ -291,7 +291,7 @@ class EntryControllerTest extends WallabagCoreTestCase
291 291
292 $this->assertCount(2, $tags); 292 $this->assertCount(2, $tags);
293 $this->assertContains('wallabag', $tags); 293 $this->assertContains('wallabag', $tags);
294 $this->assertEquals('en', $entry->getLanguage()); 294 $this->assertSame('en', $entry->getLanguage());
295 295
296 $em->remove($entry); 296 $em->remove($entry);
297 $em->flush(); 297 $em->flush();
@@ -300,7 +300,7 @@ class EntryControllerTest extends WallabagCoreTestCase
300 // related https://github.com/wallabag/wallabag/issues/2121 300 // related https://github.com/wallabag/wallabag/issues/2121
301 $crawler = $client->request('GET', '/new'); 301 $crawler = $client->request('GET', '/new');
302 302
303 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 303 $this->assertSame(200, $client->getResponse()->getStatusCode());
304 304
305 $form = $crawler->filter('form[name=entry]')->form(); 305 $form = $crawler->filter('form[name=entry]')->form();
306 306
@@ -310,7 +310,7 @@ class EntryControllerTest extends WallabagCoreTestCase
310 310
311 $client->submit($form, $data); 311 $client->submit($form, $data);
312 312
313 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 313 $this->assertSame(302, $client->getResponse()->getStatusCode());
314 $this->assertContains('/', $client->getResponse()->getTargetUrl()); 314 $this->assertContains('/', $client->getResponse()->getTargetUrl());
315 315
316 $entry = $em 316 $entry = $em
@@ -333,7 +333,7 @@ class EntryControllerTest extends WallabagCoreTestCase
333 333
334 $client->request('GET', '/archive/list'); 334 $client->request('GET', '/archive/list');
335 335
336 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 336 $this->assertSame(200, $client->getResponse()->getStatusCode());
337 } 337 }
338 338
339 public function testUntagged() 339 public function testUntagged()
@@ -343,7 +343,7 @@ class EntryControllerTest extends WallabagCoreTestCase
343 343
344 $client->request('GET', '/untagged/list'); 344 $client->request('GET', '/untagged/list');
345 345
346 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 346 $this->assertSame(200, $client->getResponse()->getStatusCode());
347 } 347 }
348 348
349 public function testStarred() 349 public function testStarred()
@@ -353,7 +353,7 @@ class EntryControllerTest extends WallabagCoreTestCase
353 353
354 $client->request('GET', '/starred/list'); 354 $client->request('GET', '/starred/list');
355 355
356 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 356 $this->assertSame(200, $client->getResponse()->getStatusCode());
357 } 357 }
358 358
359 public function testRangeException() 359 public function testRangeException()
@@ -363,8 +363,8 @@ class EntryControllerTest extends WallabagCoreTestCase
363 363
364 $client->request('GET', '/all/list/900'); 364 $client->request('GET', '/all/list/900');
365 365
366 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 366 $this->assertSame(302, $client->getResponse()->getStatusCode());
367 $this->assertEquals('/all/list', $client->getResponse()->getTargetUrl()); 367 $this->assertSame('/all/list', $client->getResponse()->getTargetUrl());
368 } 368 }
369 369
370 public function testView() 370 public function testView()
@@ -379,9 +379,9 @@ class EntryControllerTest extends WallabagCoreTestCase
379 $this->getEntityManager()->persist($entry); 379 $this->getEntityManager()->persist($entry);
380 $this->getEntityManager()->flush(); 380 $this->getEntityManager()->flush();
381 381
382 $crawler = $client->request('GET', '/view/'.$entry->getId()); 382 $crawler = $client->request('GET', '/view/' . $entry->getId());
383 383
384 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 384 $this->assertSame(200, $client->getResponse()->getStatusCode());
385 $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); 385 $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
386 $this->assertContains($entry->getTitle(), $body[0]); 386 $this->assertContains($entry->getTitle(), $body[0]);
387 } 387 }
@@ -402,9 +402,9 @@ class EntryControllerTest extends WallabagCoreTestCase
402 $this->getEntityManager()->flush(); 402 $this->getEntityManager()->flush();
403 $this->getEntityManager()->clear(); 403 $this->getEntityManager()->clear();
404 404
405 $client->request('GET', '/reload/'.$entry->getId()); 405 $client->request('GET', '/reload/' . $entry->getId());
406 406
407 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 407 $this->assertSame(302, $client->getResponse()->getStatusCode());
408 408
409 $entry = $this->getEntityManager() 409 $entry = $this->getEntityManager()
410 ->getRepository('WallabagCoreBundle:Entry') 410 ->getRepository('WallabagCoreBundle:Entry')
@@ -423,9 +423,9 @@ class EntryControllerTest extends WallabagCoreTestCase
423 $this->getEntityManager()->persist($entry); 423 $this->getEntityManager()->persist($entry);
424 $this->getEntityManager()->flush(); 424 $this->getEntityManager()->flush();
425 425
426 $client->request('GET', '/reload/'.$entry->getId()); 426 $client->request('GET', '/reload/' . $entry->getId());
427 427
428 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 428 $this->assertSame(302, $client->getResponse()->getStatusCode());
429 429
430 // force EntityManager to clear previous entity 430 // force EntityManager to clear previous entity
431 // otherwise, retrieve the same entity will retrieve change from the previous request :0 431 // otherwise, retrieve the same entity will retrieve change from the previous request :0
@@ -434,7 +434,7 @@ class EntryControllerTest extends WallabagCoreTestCase
434 ->getRepository('WallabagCoreBundle:Entry') 434 ->getRepository('WallabagCoreBundle:Entry')
435 ->find($entry->getId()); 435 ->find($entry->getId());
436 436
437 $this->assertNotEquals($client->getContainer()->getParameter('wallabag_core.fetching_error_message'), $newContent->getContent()); 437 $this->assertNotSame($client->getContainer()->getParameter('wallabag_core.fetching_error_message'), $newContent->getContent());
438 } 438 }
439 439
440 public function testEdit() 440 public function testEdit()
@@ -447,9 +447,9 @@ class EntryControllerTest extends WallabagCoreTestCase
447 $this->getEntityManager()->persist($entry); 447 $this->getEntityManager()->persist($entry);
448 $this->getEntityManager()->flush(); 448 $this->getEntityManager()->flush();
449 449
450 $crawler = $client->request('GET', '/edit/'.$entry->getId()); 450 $crawler = $client->request('GET', '/edit/' . $entry->getId());
451 451
452 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 452 $this->assertSame(200, $client->getResponse()->getStatusCode());
453 453
454 $this->assertCount(1, $crawler->filter('input[id=entry_title]')); 454 $this->assertCount(1, $crawler->filter('input[id=entry_title]'));
455 $this->assertCount(1, $crawler->filter('button[id=entry_save]')); 455 $this->assertCount(1, $crawler->filter('button[id=entry_save]'));
@@ -465,9 +465,9 @@ class EntryControllerTest extends WallabagCoreTestCase
465 $this->getEntityManager()->persist($entry); 465 $this->getEntityManager()->persist($entry);
466 $this->getEntityManager()->flush(); 466 $this->getEntityManager()->flush();
467 467
468 $crawler = $client->request('GET', '/edit/'.$entry->getId()); 468 $crawler = $client->request('GET', '/edit/' . $entry->getId());
469 469
470 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 470 $this->assertSame(200, $client->getResponse()->getStatusCode());
471 471
472 $form = $crawler->filter('button[type=submit]')->form(); 472 $form = $crawler->filter('button[type=submit]')->form();
473 473
@@ -477,7 +477,7 @@ class EntryControllerTest extends WallabagCoreTestCase
477 477
478 $client->submit($form, $data); 478 $client->submit($form, $data);
479 479
480 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 480 $this->assertSame(302, $client->getResponse()->getStatusCode());
481 481
482 $crawler = $client->followRedirect(); 482 $crawler = $client->followRedirect();
483 483
@@ -496,16 +496,16 @@ class EntryControllerTest extends WallabagCoreTestCase
496 $this->getEntityManager()->flush(); 496 $this->getEntityManager()->flush();
497 $this->getEntityManager()->clear(); 497 $this->getEntityManager()->clear();
498 498
499 $client->request('GET', '/archive/'.$entry->getId()); 499 $client->request('GET', '/archive/' . $entry->getId());
500 500
501 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 501 $this->assertSame(302, $client->getResponse()->getStatusCode());
502 502
503 $res = $client->getContainer() 503 $res = $client->getContainer()
504 ->get('doctrine.orm.entity_manager') 504 ->get('doctrine.orm.entity_manager')
505 ->getRepository('WallabagCoreBundle:Entry') 505 ->getRepository('WallabagCoreBundle:Entry')
506 ->find($entry->getId()); 506 ->find($entry->getId());
507 507
508 $this->assertEquals($res->isArchived(), true); 508 $this->assertSame($res->isArchived(), true);
509 } 509 }
510 510
511 public function testToggleStar() 511 public function testToggleStar()
@@ -519,16 +519,16 @@ class EntryControllerTest extends WallabagCoreTestCase
519 $this->getEntityManager()->flush(); 519 $this->getEntityManager()->flush();
520 $this->getEntityManager()->clear(); 520 $this->getEntityManager()->clear();
521 521
522 $client->request('GET', '/star/'.$entry->getId()); 522 $client->request('GET', '/star/' . $entry->getId());
523 523
524 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 524 $this->assertSame(302, $client->getResponse()->getStatusCode());
525 525
526 $res = $client->getContainer() 526 $res = $client->getContainer()
527 ->get('doctrine.orm.entity_manager') 527 ->get('doctrine.orm.entity_manager')
528 ->getRepository('WallabagCoreBundle:Entry') 528 ->getRepository('WallabagCoreBundle:Entry')
529 ->findOneById($entry->getId()); 529 ->findOneById($entry->getId());
530 530
531 $this->assertEquals($res->isStarred(), true); 531 $this->assertSame($res->isStarred(), true);
532 } 532 }
533 533
534 public function testDelete() 534 public function testDelete()
@@ -541,13 +541,13 @@ class EntryControllerTest extends WallabagCoreTestCase
541 $this->getEntityManager()->persist($entry); 541 $this->getEntityManager()->persist($entry);
542 $this->getEntityManager()->flush(); 542 $this->getEntityManager()->flush();
543 543
544 $client->request('GET', '/delete/'.$entry->getId()); 544 $client->request('GET', '/delete/' . $entry->getId());
545 545
546 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 546 $this->assertSame(302, $client->getResponse()->getStatusCode());
547 547
548 $client->request('GET', '/delete/'.$entry->getId()); 548 $client->request('GET', '/delete/' . $entry->getId());
549 549
550 $this->assertEquals(404, $client->getResponse()->getStatusCode()); 550 $this->assertSame(404, $client->getResponse()->getStatusCode());
551 } 551 }
552 552
553 /** 553 /**
@@ -583,14 +583,14 @@ class EntryControllerTest extends WallabagCoreTestCase
583 $em->persist($content); 583 $em->persist($content);
584 $em->flush(); 584 $em->flush();
585 585
586 $client->request('GET', '/view/'.$content->getId()); 586 $client->request('GET', '/view/' . $content->getId());
587 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 587 $this->assertSame(200, $client->getResponse()->getStatusCode());
588 588
589 $client->request('GET', '/delete/'.$content->getId()); 589 $client->request('GET', '/delete/' . $content->getId());
590 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 590 $this->assertSame(302, $client->getResponse()->getStatusCode());
591 591
592 $client->followRedirect(); 592 $client->followRedirect();
593 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 593 $this->assertSame(200, $client->getResponse()->getStatusCode());
594 } 594 }
595 595
596 public function testViewOtherUserEntry() 596 public function testViewOtherUserEntry()
@@ -603,9 +603,9 @@ class EntryControllerTest extends WallabagCoreTestCase
603 ->getRepository('WallabagCoreBundle:Entry') 603 ->getRepository('WallabagCoreBundle:Entry')
604 ->findOneByUsernameAndNotArchived('bob'); 604 ->findOneByUsernameAndNotArchived('bob');
605 605
606 $client->request('GET', '/view/'.$content->getId()); 606 $client->request('GET', '/view/' . $content->getId());
607 607
608 $this->assertEquals(403, $client->getResponse()->getStatusCode()); 608 $this->assertSame(403, $client->getResponse()->getStatusCode());
609 } 609 }
610 610
611 public function testFilterOnReadingTime() 611 public function testFilterOnReadingTime()
@@ -793,7 +793,7 @@ class EntryControllerTest extends WallabagCoreTestCase
793 793
794 $parameters = '?entry_filter%5BreadingTime%5D%5Bleft_number%5D=&entry_filter%5BreadingTime%5D%5Bright_number%5D='; 794 $parameters = '?entry_filter%5BreadingTime%5D%5Bleft_number%5D=&entry_filter%5BreadingTime%5D%5Bright_number%5D=';
795 795
796 $client->request('GET', 'unread/list'.$parameters); 796 $client->request('GET', 'unread/list' . $parameters);
797 797
798 $this->assertContains($parameters, $client->getResponse()->getContent()); 798 $this->assertContains($parameters, $client->getResponse()->getContent());
799 799
@@ -934,16 +934,16 @@ class EntryControllerTest extends WallabagCoreTestCase
934 $this->getEntityManager()->clear(); 934 $this->getEntityManager()->clear();
935 935
936 // no uid 936 // no uid
937 $client->request('GET', '/share/'.$content->getUid()); 937 $client->request('GET', '/share/' . $content->getUid());
938 $this->assertEquals(404, $client->getResponse()->getStatusCode()); 938 $this->assertSame(404, $client->getResponse()->getStatusCode());
939 939
940 // generating the uid 940 // generating the uid
941 $client->request('GET', '/share/'.$content->getId()); 941 $client->request('GET', '/share/' . $content->getId());
942 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 942 $this->assertSame(302, $client->getResponse()->getStatusCode());
943 943
944 // follow link with uid 944 // follow link with uid
945 $crawler = $client->followRedirect(); 945 $crawler = $client->followRedirect();
946 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 946 $this->assertSame(200, $client->getResponse()->getStatusCode());
947 $this->assertContains('max-age=25200', $client->getResponse()->headers->get('cache-control')); 947 $this->assertContains('max-age=25200', $client->getResponse()->headers->get('cache-control'));
948 $this->assertContains('public', $client->getResponse()->headers->get('cache-control')); 948 $this->assertContains('public', $client->getResponse()->headers->get('cache-control'));
949 $this->assertContains('s-maxage=25200', $client->getResponse()->headers->get('cache-control')); 949 $this->assertContains('s-maxage=25200', $client->getResponse()->headers->get('cache-control'));
@@ -955,19 +955,19 @@ class EntryControllerTest extends WallabagCoreTestCase
955 955
956 // sharing is now disabled 956 // sharing is now disabled
957 $client->getContainer()->get('craue_config')->set('share_public', 0); 957 $client->getContainer()->get('craue_config')->set('share_public', 0);
958 $client->request('GET', '/share/'.$content->getUid()); 958 $client->request('GET', '/share/' . $content->getUid());
959 $this->assertEquals(404, $client->getResponse()->getStatusCode()); 959 $this->assertSame(404, $client->getResponse()->getStatusCode());
960 960
961 $client->request('GET', '/view/'.$content->getId()); 961 $client->request('GET', '/view/' . $content->getId());
962 $this->assertContains('no-cache', $client->getResponse()->headers->get('cache-control')); 962 $this->assertContains('no-cache', $client->getResponse()->headers->get('cache-control'));
963 963
964 // removing the share 964 // removing the share
965 $client->request('GET', '/share/delete/'.$content->getId()); 965 $client->request('GET', '/share/delete/' . $content->getId());
966 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 966 $this->assertSame(302, $client->getResponse()->getStatusCode());
967 967
968 // share is now disable 968 // share is now disable
969 $client->request('GET', '/share/'.$content->getUid()); 969 $client->request('GET', '/share/' . $content->getUid());
970 $this->assertEquals(404, $client->getResponse()->getStatusCode()); 970 $this->assertSame(404, $client->getResponse()->getStatusCode());
971 } 971 }
972 972
973 public function testNewEntryWithDownloadImagesEnabled() 973 public function testNewEntryWithDownloadImagesEnabled()
@@ -981,7 +981,7 @@ class EntryControllerTest extends WallabagCoreTestCase
981 981
982 $crawler = $client->request('GET', '/new'); 982 $crawler = $client->request('GET', '/new');
983 983
984 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 984 $this->assertSame(200, $client->getResponse()->getStatusCode());
985 985
986 $form = $crawler->filter('form[name=entry]')->form(); 986 $form = $crawler->filter('form[name=entry]')->form();
987 987
@@ -991,7 +991,7 @@ class EntryControllerTest extends WallabagCoreTestCase
991 991
992 $client->submit($form, $data); 992 $client->submit($form, $data);
993 993
994 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 994 $this->assertSame(302, $client->getResponse()->getStatusCode());
995 995
996 $em = $client->getContainer() 996 $em = $client->getContainer()
997 ->get('doctrine.orm.entity_manager'); 997 ->get('doctrine.orm.entity_manager');
@@ -1001,7 +1001,7 @@ class EntryControllerTest extends WallabagCoreTestCase
1001 ->findByUrlAndUserId($url, $this->getLoggedInUserId()); 1001 ->findByUrlAndUserId($url, $this->getLoggedInUserId());
1002 1002
1003 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $entry); 1003 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $entry);
1004 $this->assertEquals($url, $entry->getUrl()); 1004 $this->assertSame($url, $entry->getUrl());
1005 $this->assertContains('Perpignan', $entry->getTitle()); 1005 $this->assertContains('Perpignan', $entry->getTitle());
1006 // instead of checking for the filename (which might change) check that the image is now local 1006 // 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()); 1007 $this->assertContains('https://your-wallabag-url-instance.com/assets/images/', $entry->getContent());
@@ -1023,7 +1023,7 @@ class EntryControllerTest extends WallabagCoreTestCase
1023 1023
1024 $crawler = $client->request('GET', '/new'); 1024 $crawler = $client->request('GET', '/new');
1025 1025
1026 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 1026 $this->assertSame(200, $client->getResponse()->getStatusCode());
1027 1027
1028 $form = $crawler->filter('form[name=entry]')->form(); 1028 $form = $crawler->filter('form[name=entry]')->form();
1029 1029
@@ -1033,16 +1033,16 @@ class EntryControllerTest extends WallabagCoreTestCase
1033 1033
1034 $client->submit($form, $data); 1034 $client->submit($form, $data);
1035 1035
1036 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 1036 $this->assertSame(302, $client->getResponse()->getStatusCode());
1037 1037
1038 $content = $client->getContainer() 1038 $content = $client->getContainer()
1039 ->get('doctrine.orm.entity_manager') 1039 ->get('doctrine.orm.entity_manager')
1040 ->getRepository('WallabagCoreBundle:Entry') 1040 ->getRepository('WallabagCoreBundle:Entry')
1041 ->findByUrlAndUserId($url, $this->getLoggedInUserId()); 1041 ->findByUrlAndUserId($url, $this->getLoggedInUserId());
1042 1042
1043 $client->request('GET', '/delete/'.$content->getId()); 1043 $client->request('GET', '/delete/' . $content->getId());
1044 1044
1045 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 1045 $this->assertSame(302, $client->getResponse()->getStatusCode());
1046 1046
1047 $client->getContainer()->get('craue_config')->set('download_images_enabled', 0); 1047 $client->getContainer()->get('craue_config')->set('download_images_enabled', 0);
1048 } 1048 }
@@ -1063,11 +1063,11 @@ class EntryControllerTest extends WallabagCoreTestCase
1063 1063
1064 $this->getEntityManager()->flush(); 1064 $this->getEntityManager()->flush();
1065 1065
1066 $client->request('GET', '/view/'.$entry->getId()); 1066 $client->request('GET', '/view/' . $entry->getId());
1067 $client->request('GET', '/archive/'.$entry->getId()); 1067 $client->request('GET', '/archive/' . $entry->getId());
1068 1068
1069 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 1069 $this->assertSame(302, $client->getResponse()->getStatusCode());
1070 $this->assertEquals('/', $client->getResponse()->headers->get('location')); 1070 $this->assertSame('/', $client->getResponse()->headers->get('location'));
1071 } 1071 }
1072 1072
1073 public function testRedirectToCurrentPage() 1073 public function testRedirectToCurrentPage()
@@ -1086,11 +1086,11 @@ class EntryControllerTest extends WallabagCoreTestCase
1086 1086
1087 $this->getEntityManager()->flush(); 1087 $this->getEntityManager()->flush();
1088 1088
1089 $client->request('GET', '/view/'.$entry->getId()); 1089 $client->request('GET', '/view/' . $entry->getId());
1090 $client->request('GET', '/archive/'.$entry->getId()); 1090 $client->request('GET', '/archive/' . $entry->getId());
1091 1091
1092 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 1092 $this->assertSame(302, $client->getResponse()->getStatusCode());
1093 $this->assertContains('/view/'.$entry->getId(), $client->getResponse()->headers->get('location')); 1093 $this->assertContains('/view/' . $entry->getId(), $client->getResponse()->headers->get('location'));
1094 } 1094 }
1095 1095
1096 public function testFilterOnHttpStatus() 1096 public function testFilterOnHttpStatus()
@@ -1213,7 +1213,7 @@ class EntryControllerTest extends WallabagCoreTestCase
1213 $crawler = $client->submit($form, $data); 1213 $crawler = $client->submit($form, $data);
1214 1214
1215 $this->assertCount(1, $crawler->filter('div[class=entry]')); 1215 $this->assertCount(1, $crawler->filter('div[class=entry]'));
1216 $client->request('GET', '/delete/'.$entry->getId()); 1216 $client->request('GET', '/delete/' . $entry->getId());
1217 1217
1218 // test on list of all articles 1218 // test on list of all articles
1219 $crawler = $client->request('GET', '/all/list'); 1219 $crawler = $client->request('GET', '/all/list');
@@ -1315,7 +1315,7 @@ class EntryControllerTest extends WallabagCoreTestCase
1315 1315
1316 $crawler = $client->request('GET', '/new'); 1316 $crawler = $client->request('GET', '/new');
1317 1317
1318 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 1318 $this->assertSame(200, $client->getResponse()->getStatusCode());
1319 1319
1320 $form = $crawler->filter('form[name=entry]')->form(); 1320 $form = $crawler->filter('form[name=entry]')->form();
1321 1321
@@ -1325,7 +1325,7 @@ class EntryControllerTest extends WallabagCoreTestCase
1325 1325
1326 $client->submit($form, $data); 1326 $client->submit($form, $data);
1327 1327
1328 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 1328 $this->assertSame(302, $client->getResponse()->getStatusCode());
1329 1329
1330 $content = $client->getContainer() 1330 $content = $client->getContainer()
1331 ->get('doctrine.orm.entity_manager') 1331 ->get('doctrine.orm.entity_manager')
@@ -1333,8 +1333,8 @@ class EntryControllerTest extends WallabagCoreTestCase
1333 ->findByUrlAndUserId($url, $this->getLoggedInUserId()); 1333 ->findByUrlAndUserId($url, $this->getLoggedInUserId());
1334 1334
1335 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content); 1335 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
1336 $this->assertEquals($url, $content->getUrl()); 1336 $this->assertSame($url, $content->getUrl());
1337 $this->assertEquals($expectedLanguage, $content->getLanguage()); 1337 $this->assertSame($expectedLanguage, $content->getLanguage());
1338 } 1338 }
1339 1339
1340 /** 1340 /**
@@ -1362,7 +1362,7 @@ class EntryControllerTest extends WallabagCoreTestCase
1362 1362
1363 $crawler = $client->request('GET', '/new'); 1363 $crawler = $client->request('GET', '/new');
1364 1364
1365 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 1365 $this->assertSame(200, $client->getResponse()->getStatusCode());
1366 1366
1367 $form = $crawler->filter('form[name=entry]')->form(); 1367 $form = $crawler->filter('form[name=entry]')->form();
1368 1368
@@ -1372,11 +1372,11 @@ class EntryControllerTest extends WallabagCoreTestCase
1372 1372
1373 $client->submit($form, $data); 1373 $client->submit($form, $data);
1374 1374
1375 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 1375 $this->assertSame(302, $client->getResponse()->getStatusCode());
1376 1376
1377 $crawler = $client->followRedirect(); 1377 $crawler = $client->followRedirect();
1378 1378
1379 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 1379 $this->assertSame(200, $client->getResponse()->getStatusCode());
1380 $this->assertContains('flashes.entry.notice.entry_saved', $crawler->filter('body')->extract(['_text'])[0]); 1380 $this->assertContains('flashes.entry.notice.entry_saved', $crawler->filter('body')->extract(['_text'])[0]);
1381 1381
1382 $content = $em 1382 $content = $em
diff --git a/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php
index b38961d3..ba9296af 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($contentInDB->isArchived(), $content[0]['is_archived']);
234 $this->assertEquals($contentInDB->isStarred(), $content[0]['is_starred']); 234 $this->assertSame($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
14class LocaleListenerTest extends \PHPUnit_Framework_TestCase 14class 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..91ce0102 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->assertSame('', $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..85036e35 100644
--- a/tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php
+++ b/tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php
@@ -2,13 +2,13 @@
2 2
3namespace Tests\Wallabag\CoreBundle\GuzzleSiteAuthenticator; 3namespace Tests\Wallabag\CoreBundle\GuzzleSiteAuthenticator;
4 4
5use Monolog\Handler\TestHandler;
6use Monolog\Logger;
7use BD\GuzzleSiteAuthenticator\SiteConfig\SiteConfig; 5use BD\GuzzleSiteAuthenticator\SiteConfig\SiteConfig;
8use Graby\SiteConfig\SiteConfig as GrabySiteConfig; 6use Graby\SiteConfig\SiteConfig as GrabySiteConfig;
9use Wallabag\CoreBundle\GuzzleSiteAuthenticator\GrabySiteConfigBuilder; 7use Monolog\Handler\TestHandler;
10use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; 8use Monolog\Logger;
11use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; 9use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
10use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
11use Wallabag\CoreBundle\GuzzleSiteAuthenticator\GrabySiteConfigBuilder;
12 12
13class GrabySiteConfigBuilderTest extends \PHPUnit_Framework_TestCase 13class GrabySiteConfigBuilderTest extends \PHPUnit_Framework_TestCase
14{ 14{
@@ -68,7 +68,7 @@ class GrabySiteConfigBuilderTest extends \PHPUnit_Framework_TestCase
68 68
69 $config = $this->builder->buildForHost('www.example.com'); 69 $config = $this->builder->buildForHost('www.example.com');
70 70
71 $this->assertEquals( 71 $this->assertSame(
72 new SiteConfig([ 72 new SiteConfig([
73 'host' => 'example.com', 73 'host' => 'example.com',
74 'requiresLogin' => true, 74 'requiresLogin' => true,
diff --git a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
index dbddbc5c..7e19631b 100644
--- a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
+++ b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
@@ -2,18 +2,18 @@
2 2
3namespace Tests\Wallabag\CoreBundle\Helper; 3namespace Tests\Wallabag\CoreBundle\Helper;
4 4
5use Psr\Log\NullLogger; 5use Graby\Graby;
6use Monolog\Logger;
7use Monolog\Handler\TestHandler; 6use Monolog\Handler\TestHandler;
8use Wallabag\CoreBundle\Helper\ContentProxy; 7use Monolog\Logger;
8use Psr\Log\NullLogger;
9use Symfony\Component\Validator\ConstraintViolation;
10use Symfony\Component\Validator\ConstraintViolationList;
11use Symfony\Component\Validator\Validator\RecursiveValidator;
9use Wallabag\CoreBundle\Entity\Entry; 12use Wallabag\CoreBundle\Entity\Entry;
10use Wallabag\CoreBundle\Entity\Tag; 13use Wallabag\CoreBundle\Entity\Tag;
11use Wallabag\UserBundle\Entity\User; 14use Wallabag\CoreBundle\Helper\ContentProxy;
12use Wallabag\CoreBundle\Helper\RuleBasedTagger; 15use Wallabag\CoreBundle\Helper\RuleBasedTagger;
13use Graby\Graby; 16use Wallabag\UserBundle\Entity\User;
14use Symfony\Component\Validator\Validator\RecursiveValidator;
15use Symfony\Component\Validator\ConstraintViolationList;
16use Symfony\Component\Validator\ConstraintViolation;
17 17
18class ContentProxyTest extends \PHPUnit_Framework_TestCase 18class 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(false, $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
3namespace Tests\Wallabag\CoreBundle\Helper; 3namespace Tests\Wallabag\CoreBundle\Helper;
4 4
5use Psr\Log\NullLogger;
6use Monolog\Logger;
7use Monolog\Handler\TestHandler; 5use Monolog\Handler\TestHandler;
6use Monolog\Logger;
7use Psr\Log\NullLogger;
8use Wallabag\CoreBundle\Helper\CryptoProxy; 8use Wallabag\CoreBundle\Helper\CryptoProxy;
9 9
10class CryptoProxyTest extends \PHPUnit_Framework_TestCase 10class 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
3namespace Tests\Wallabag\CoreBundle\Helper; 3namespace Tests\Wallabag\CoreBundle\Helper;
4 4
5use Wallabag\CoreBundle\Helper\DownloadImages;
6use Monolog\Logger;
7use Monolog\Handler\TestHandler;
8use GuzzleHttp\Client; 5use GuzzleHttp\Client;
9use GuzzleHttp\Subscriber\Mock;
10use GuzzleHttp\Message\Response; 6use GuzzleHttp\Message\Response;
11use GuzzleHttp\Stream\Stream; 7use GuzzleHttp\Stream\Stream;
8use GuzzleHttp\Subscriber\Mock;
9use Monolog\Handler\TestHandler;
10use Monolog\Logger;
11use Wallabag\CoreBundle\Helper\DownloadImages;
12 12
13class DownloadImagesTest extends \PHPUnit_Framework_TestCase 13class 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
3namespace Tests\Wallabag\CoreBundle\Helper; 3namespace Tests\Wallabag\CoreBundle\Helper;
4 4
5use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
6use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
5use Wallabag\CoreBundle\Entity\Config; 7use Wallabag\CoreBundle\Entity\Config;
6use Wallabag\UserBundle\Entity\User;
7use Wallabag\CoreBundle\Helper\Redirect; 8use Wallabag\CoreBundle\Helper\Redirect;
8use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; 9use Wallabag\UserBundle\Entity\User;
9use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
10 10
11class RedirectTest extends \PHPUnit_Framework_TestCase 11class 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;
5use Wallabag\CoreBundle\Entity\Entry; 5use Wallabag\CoreBundle\Entity\Entry;
6use Wallabag\CoreBundle\Entity\Tag; 6use Wallabag\CoreBundle\Entity\Tag;
7use Wallabag\CoreBundle\Helper\TagsAssigner; 7use Wallabag\CoreBundle\Helper\TagsAssigner;
8use Wallabag\UserBundle\Entity\User;
9use Wallabag\CoreBundle\Repository\TagRepository; 8use Wallabag\CoreBundle\Repository\TagRepository;
9use Wallabag\UserBundle\Entity\User;
10 10
11class TagsAssignerTest extends \PHPUnit_Framework_TestCase 11class 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());
diff --git a/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php b/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php
index f507563c..8bed180a 100644
--- a/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php
+++ b/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php
@@ -4,8 +4,8 @@ namespace Tests\Wallabag\ImportBundle\Command;
4 4
5use Symfony\Bundle\FrameworkBundle\Console\Application; 5use Symfony\Bundle\FrameworkBundle\Console\Application;
6use Symfony\Component\Console\Tester\CommandTester; 6use Symfony\Component\Console\Tester\CommandTester;
7use Wallabag\ImportBundle\Command\ImportCommand;
8use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; 7use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
8use Wallabag\ImportBundle\Command\ImportCommand;
9 9
10class ImportCommandTest extends WallabagCoreTestCase 10class ImportCommandTest extends WallabagCoreTestCase
11{ 11{
@@ -74,7 +74,7 @@ class ImportCommandTest extends WallabagCoreTestCase
74 $tester->execute([ 74 $tester->execute([
75 'command' => $command->getName(), 75 'command' => $command->getName(),
76 'username' => 'admin', 76 'username' => 'admin',
77 'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.root_dir').'/../tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json', 77 'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.root_dir') . '/../tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json',
78 '--importer' => 'v2', 78 '--importer' => 'v2',
79 ]); 79 ]);
80 80
@@ -93,7 +93,7 @@ class ImportCommandTest extends WallabagCoreTestCase
93 $tester->execute([ 93 $tester->execute([
94 'command' => $command->getName(), 94 'command' => $command->getName(),
95 'username' => 1, 95 'username' => 1,
96 'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.root_dir').'/../tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json', 96 'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.root_dir') . '/../tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json',
97 '--useUserId' => true, 97 '--useUserId' => true,
98 '--importer' => 'v2', 98 '--importer' => 'v2',
99 ]); 99 ]);
diff --git a/tests/Wallabag/ImportBundle/Command/RedisWorkerCommandTest.php b/tests/Wallabag/ImportBundle/Command/RedisWorkerCommandTest.php
index e5e251a0..af62550c 100644
--- a/tests/Wallabag/ImportBundle/Command/RedisWorkerCommandTest.php
+++ b/tests/Wallabag/ImportBundle/Command/RedisWorkerCommandTest.php
@@ -2,11 +2,11 @@
2 2
3namespace Tests\Wallabag\ImportBundle\Command; 3namespace Tests\Wallabag\ImportBundle\Command;
4 4
5use M6Web\Component\RedisMock\RedisMockFactory;
5use Symfony\Bundle\FrameworkBundle\Console\Application; 6use Symfony\Bundle\FrameworkBundle\Console\Application;
6use Symfony\Component\Console\Tester\CommandTester; 7use Symfony\Component\Console\Tester\CommandTester;
7use Wallabag\ImportBundle\Command\RedisWorkerCommand;
8use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; 8use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
9use M6Web\Component\RedisMock\RedisMockFactory; 9use Wallabag\ImportBundle\Command\RedisWorkerCommand;
10 10
11class RedisWorkerCommandTest extends WallabagCoreTestCase 11class RedisWorkerCommandTest extends WallabagCoreTestCase
12{ 12{
diff --git a/tests/Wallabag/ImportBundle/Consumer/AMQPEntryConsumerTest.php b/tests/Wallabag/ImportBundle/Consumer/AMQPEntryConsumerTest.php
index a989ec7f..52b98a0b 100644
--- a/tests/Wallabag/ImportBundle/Consumer/AMQPEntryConsumerTest.php
+++ b/tests/Wallabag/ImportBundle/Consumer/AMQPEntryConsumerTest.php
@@ -2,10 +2,10 @@
2 2
3namespace Tests\Wallabag\ImportBundle\Consumer\AMQP; 3namespace Tests\Wallabag\ImportBundle\Consumer\AMQP;
4 4
5use Wallabag\ImportBundle\Consumer\AMQPEntryConsumer;
6use PhpAmqpLib\Message\AMQPMessage; 5use PhpAmqpLib\Message\AMQPMessage;
7use Wallabag\UserBundle\Entity\User;
8use Wallabag\CoreBundle\Entity\Entry; 6use Wallabag\CoreBundle\Entity\Entry;
7use Wallabag\ImportBundle\Consumer\AMQPEntryConsumer;
8use Wallabag\UserBundle\Entity\User;
9 9
10class AMQPEntryConsumerTest extends \PHPUnit_Framework_TestCase 10class AMQPEntryConsumerTest extends \PHPUnit_Framework_TestCase
11{ 11{
diff --git a/tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php b/tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php
index 78bd83ba..9506ff63 100644
--- a/tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php
+++ b/tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php
@@ -2,9 +2,9 @@
2 2
3namespace Tests\Wallabag\ImportBundle\Consumer\AMQP; 3namespace Tests\Wallabag\ImportBundle\Consumer\AMQP;
4 4
5use Wallabag\CoreBundle\Entity\Entry;
5use Wallabag\ImportBundle\Consumer\RedisEntryConsumer; 6use Wallabag\ImportBundle\Consumer\RedisEntryConsumer;
6use Wallabag\UserBundle\Entity\User; 7use Wallabag\UserBundle\Entity\User;
7use Wallabag\CoreBundle\Entity\Entry;
8 8
9class RedisEntryConsumerTest extends \PHPUnit_Framework_TestCase 9class RedisEntryConsumerTest extends \PHPUnit_Framework_TestCase
10{ 10{
diff --git a/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php
index 8e9f65e3..3873ccf4 100644
--- a/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php
@@ -2,8 +2,8 @@
2 2
3namespace Tests\Wallabag\ImportBundle\Controller; 3namespace Tests\Wallabag\ImportBundle\Controller;
4 4
5use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
6use Symfony\Component\HttpFoundation\File\UploadedFile; 5use Symfony\Component\HttpFoundation\File\UploadedFile;
6use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
7 7
8class ChromeControllerTest extends WallabagCoreTestCase 8class ChromeControllerTest extends WallabagCoreTestCase
9{ 9{
@@ -14,9 +14,9 @@ class ChromeControllerTest extends WallabagCoreTestCase
14 14
15 $crawler = $client->request('GET', '/import/chrome'); 15 $crawler = $client->request('GET', '/import/chrome');
16 16
17 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 17 $this->assertSame(200, $client->getResponse()->getStatusCode());
18 $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); 18 $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
19 $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); 19 $this->assertSame(1, $crawler->filter('input[type=file]')->count());
20 } 20 }
21 21
22 public function testImportChromeWithRabbitEnabled() 22 public function testImportChromeWithRabbitEnabled()
@@ -28,9 +28,9 @@ class ChromeControllerTest extends WallabagCoreTestCase
28 28
29 $crawler = $client->request('GET', '/import/chrome'); 29 $crawler = $client->request('GET', '/import/chrome');
30 30
31 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 31 $this->assertSame(200, $client->getResponse()->getStatusCode());
32 $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); 32 $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
33 $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); 33 $this->assertSame(1, $crawler->filter('input[type=file]')->count());
34 34
35 $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0); 35 $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0);
36 } 36 }
@@ -49,7 +49,7 @@ class ChromeControllerTest extends WallabagCoreTestCase
49 49
50 $client->submit($form, $data); 50 $client->submit($form, $data);
51 51
52 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 52 $this->assertSame(200, $client->getResponse()->getStatusCode());
53 } 53 }
54 54
55 public function testImportChromeWithRedisEnabled() 55 public function testImportChromeWithRedisEnabled()
@@ -61,13 +61,13 @@ class ChromeControllerTest extends WallabagCoreTestCase
61 61
62 $crawler = $client->request('GET', '/import/chrome'); 62 $crawler = $client->request('GET', '/import/chrome');
63 63
64 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 64 $this->assertSame(200, $client->getResponse()->getStatusCode());
65 $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); 65 $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
66 $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); 66 $this->assertSame(1, $crawler->filter('input[type=file]')->count());
67 67
68 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); 68 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
69 69
70 $file = new UploadedFile(__DIR__.'/../fixtures/chrome-bookmarks', 'Bookmarks'); 70 $file = new UploadedFile(__DIR__ . '/../fixtures/chrome-bookmarks', 'Bookmarks');
71 71
72 $data = [ 72 $data = [
73 'upload_import_file[file]' => $file, 73 'upload_import_file[file]' => $file,
@@ -75,7 +75,7 @@ class ChromeControllerTest extends WallabagCoreTestCase
75 75
76 $client->submit($form, $data); 76 $client->submit($form, $data);
77 77
78 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 78 $this->assertSame(302, $client->getResponse()->getStatusCode());
79 79
80 $crawler = $client->followRedirect(); 80 $crawler = $client->followRedirect();
81 81
@@ -95,7 +95,7 @@ class ChromeControllerTest extends WallabagCoreTestCase
95 $crawler = $client->request('GET', '/import/chrome'); 95 $crawler = $client->request('GET', '/import/chrome');
96 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); 96 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
97 97
98 $file = new UploadedFile(__DIR__.'/../fixtures/chrome-bookmarks', 'Bookmarks'); 98 $file = new UploadedFile(__DIR__ . '/../fixtures/chrome-bookmarks', 'Bookmarks');
99 99
100 $data = [ 100 $data = [
101 'upload_import_file[file]' => $file, 101 'upload_import_file[file]' => $file,
@@ -103,7 +103,7 @@ class ChromeControllerTest extends WallabagCoreTestCase
103 103
104 $client->submit($form, $data); 104 $client->submit($form, $data);
105 105
106 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 106 $this->assertSame(302, $client->getResponse()->getStatusCode());
107 107
108 $crawler = $client->followRedirect(); 108 $crawler = $client->followRedirect();
109 109
@@ -120,11 +120,11 @@ class ChromeControllerTest extends WallabagCoreTestCase
120 120
121 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.usinenouvelle.com is ok'); 121 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.usinenouvelle.com is ok');
122 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.usinenouvelle.com is ok'); 122 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.usinenouvelle.com is ok');
123 $this->assertEquals(1, count($content->getTags())); 123 $this->assertSame(1, count($content->getTags()));
124 124
125 $createdAt = $content->getCreatedAt(); 125 $createdAt = $content->getCreatedAt();
126 $this->assertEquals('2011', $createdAt->format('Y')); 126 $this->assertSame('2011', $createdAt->format('Y'));
127 $this->assertEquals('07', $createdAt->format('m')); 127 $this->assertSame('07', $createdAt->format('m'));
128 } 128 }
129 129
130 public function testImportWallabagWithEmptyFile() 130 public function testImportWallabagWithEmptyFile()
@@ -135,7 +135,7 @@ class ChromeControllerTest extends WallabagCoreTestCase
135 $crawler = $client->request('GET', '/import/chrome'); 135 $crawler = $client->request('GET', '/import/chrome');
136 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); 136 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
137 137
138 $file = new UploadedFile(__DIR__.'/../fixtures/test.txt', 'test.txt'); 138 $file = new UploadedFile(__DIR__ . '/../fixtures/test.txt', 'test.txt');
139 139
140 $data = [ 140 $data = [
141 'upload_import_file[file]' => $file, 141 'upload_import_file[file]' => $file,
@@ -143,7 +143,7 @@ class ChromeControllerTest extends WallabagCoreTestCase
143 143
144 $client->submit($form, $data); 144 $client->submit($form, $data);
145 145
146 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 146 $this->assertSame(302, $client->getResponse()->getStatusCode());
147 147
148 $crawler = $client->followRedirect(); 148 $crawler = $client->followRedirect();
149 149
diff --git a/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php b/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php
index 5354439c..5e1260b1 100644
--- a/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php
@@ -2,8 +2,8 @@
2 2
3namespace Tests\Wallabag\ImportBundle\Controller; 3namespace Tests\Wallabag\ImportBundle\Controller;
4 4
5use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
6use Symfony\Component\HttpFoundation\File\UploadedFile; 5use Symfony\Component\HttpFoundation\File\UploadedFile;
6use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
7 7
8class FirefoxControllerTest extends WallabagCoreTestCase 8class FirefoxControllerTest extends WallabagCoreTestCase
9{ 9{
@@ -14,9 +14,9 @@ class FirefoxControllerTest extends WallabagCoreTestCase
14 14
15 $crawler = $client->request('GET', '/import/firefox'); 15 $crawler = $client->request('GET', '/import/firefox');
16 16
17 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 17 $this->assertSame(200, $client->getResponse()->getStatusCode());
18 $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); 18 $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
19 $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); 19 $this->assertSame(1, $crawler->filter('input[type=file]')->count());
20 } 20 }
21 21
22 public function testImportFirefoxWithRabbitEnabled() 22 public function testImportFirefoxWithRabbitEnabled()
@@ -28,9 +28,9 @@ class FirefoxControllerTest extends WallabagCoreTestCase
28 28
29 $crawler = $client->request('GET', '/import/firefox'); 29 $crawler = $client->request('GET', '/import/firefox');
30 30
31 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 31 $this->assertSame(200, $client->getResponse()->getStatusCode());
32 $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); 32 $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
33 $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); 33 $this->assertSame(1, $crawler->filter('input[type=file]')->count());
34 34
35 $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0); 35 $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0);
36 } 36 }
@@ -49,7 +49,7 @@ class FirefoxControllerTest extends WallabagCoreTestCase
49 49
50 $client->submit($form, $data); 50 $client->submit($form, $data);
51 51
52 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 52 $this->assertSame(200, $client->getResponse()->getStatusCode());
53 } 53 }
54 54
55 public function testImportFirefoxWithRedisEnabled() 55 public function testImportFirefoxWithRedisEnabled()
@@ -61,13 +61,13 @@ class FirefoxControllerTest extends WallabagCoreTestCase
61 61
62 $crawler = $client->request('GET', '/import/firefox'); 62 $crawler = $client->request('GET', '/import/firefox');
63 63
64 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 64 $this->assertSame(200, $client->getResponse()->getStatusCode());
65 $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); 65 $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
66 $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); 66 $this->assertSame(1, $crawler->filter('input[type=file]')->count());
67 67
68 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); 68 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
69 69
70 $file = new UploadedFile(__DIR__.'/../fixtures/firefox-bookmarks.json', 'Bookmarks'); 70 $file = new UploadedFile(__DIR__ . '/../fixtures/firefox-bookmarks.json', 'Bookmarks');
71 71
72 $data = [ 72 $data = [
73 'upload_import_file[file]' => $file, 73 'upload_import_file[file]' => $file,
@@ -75,7 +75,7 @@ class FirefoxControllerTest extends WallabagCoreTestCase
75 75
76 $client->submit($form, $data); 76 $client->submit($form, $data);
77 77
78 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 78 $this->assertSame(302, $client->getResponse()->getStatusCode());
79 79
80 $crawler = $client->followRedirect(); 80 $crawler = $client->followRedirect();
81 81
@@ -95,7 +95,7 @@ class FirefoxControllerTest extends WallabagCoreTestCase
95 $crawler = $client->request('GET', '/import/firefox'); 95 $crawler = $client->request('GET', '/import/firefox');
96 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); 96 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
97 97
98 $file = new UploadedFile(__DIR__.'/../fixtures/firefox-bookmarks.json', 'Bookmarks'); 98 $file = new UploadedFile(__DIR__ . '/../fixtures/firefox-bookmarks.json', 'Bookmarks');
99 99
100 $data = [ 100 $data = [
101 'upload_import_file[file]' => $file, 101 'upload_import_file[file]' => $file,
@@ -103,7 +103,7 @@ class FirefoxControllerTest extends WallabagCoreTestCase
103 103
104 $client->submit($form, $data); 104 $client->submit($form, $data);
105 105
106 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 106 $this->assertSame(302, $client->getResponse()->getStatusCode());
107 107
108 $crawler = $client->followRedirect(); 108 $crawler = $client->followRedirect();
109 109
@@ -121,7 +121,7 @@ class FirefoxControllerTest extends WallabagCoreTestCase
121 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://lexpansion.lexpress.fr is ok'); 121 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://lexpansion.lexpress.fr is ok');
122 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://lexpansion.lexpress.fr is ok'); 122 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://lexpansion.lexpress.fr is ok');
123 $this->assertNotEmpty($content->getLanguage(), 'Language for http://lexpansion.lexpress.fr is ok'); 123 $this->assertNotEmpty($content->getLanguage(), 'Language for http://lexpansion.lexpress.fr is ok');
124 $this->assertEquals(3, count($content->getTags())); 124 $this->assertSame(3, count($content->getTags()));
125 125
126 $content = $client->getContainer() 126 $content = $client->getContainer()
127 ->get('doctrine.orm.entity_manager') 127 ->get('doctrine.orm.entity_manager')
@@ -136,8 +136,8 @@ class FirefoxControllerTest extends WallabagCoreTestCase
136 $this->assertEmpty($content->getLanguage(), 'Language for https://stackoverflow.com is ok'); 136 $this->assertEmpty($content->getLanguage(), 'Language for https://stackoverflow.com is ok');
137 137
138 $createdAt = $content->getCreatedAt(); 138 $createdAt = $content->getCreatedAt();
139 $this->assertEquals('2013', $createdAt->format('Y')); 139 $this->assertSame('2013', $createdAt->format('Y'));
140 $this->assertEquals('12', $createdAt->format('m')); 140 $this->assertSame('12', $createdAt->format('m'));
141 } 141 }
142 142
143 public function testImportWallabagWithEmptyFile() 143 public function testImportWallabagWithEmptyFile()
@@ -148,7 +148,7 @@ class FirefoxControllerTest extends WallabagCoreTestCase
148 $crawler = $client->request('GET', '/import/firefox'); 148 $crawler = $client->request('GET', '/import/firefox');
149 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); 149 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
150 150
151 $file = new UploadedFile(__DIR__.'/../fixtures/test.txt', 'test.txt'); 151 $file = new UploadedFile(__DIR__ . '/../fixtures/test.txt', 'test.txt');
152 152
153 $data = [ 153 $data = [
154 'upload_import_file[file]' => $file, 154 'upload_import_file[file]' => $file,
@@ -156,7 +156,7 @@ class FirefoxControllerTest extends WallabagCoreTestCase
156 156
157 $client->submit($form, $data); 157 $client->submit($form, $data);
158 158
159 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 159 $this->assertSame(302, $client->getResponse()->getStatusCode());
160 160
161 $crawler = $client->followRedirect(); 161 $crawler = $client->followRedirect();
162 162
diff --git a/tests/Wallabag/ImportBundle/Controller/ImportControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ImportControllerTest.php
index 5e57dcef..e1ec7c65 100644
--- a/tests/Wallabag/ImportBundle/Controller/ImportControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/ImportControllerTest.php
@@ -12,7 +12,7 @@ class ImportControllerTest extends WallabagCoreTestCase
12 12
13 $client->request('GET', '/import/'); 13 $client->request('GET', '/import/');
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 ImportControllerTest extends WallabagCoreTestCase
23 23
24 $crawler = $client->request('GET', '/import/'); 24 $crawler = $client->request('GET', '/import/');
25 25
26 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 26 $this->assertSame(200, $client->getResponse()->getStatusCode());
27 $this->assertEquals(8, $crawler->filter('blockquote')->count()); 27 $this->assertSame(8, $crawler->filter('blockquote')->count());
28 } 28 }
29} 29}
diff --git a/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php b/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php
index 84742e0a..067cf3dc 100644
--- a/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php
@@ -2,8 +2,8 @@
2 2
3namespace Tests\Wallabag\ImportBundle\Controller; 3namespace Tests\Wallabag\ImportBundle\Controller;
4 4
5use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
6use Symfony\Component\HttpFoundation\File\UploadedFile; 5use Symfony\Component\HttpFoundation\File\UploadedFile;
6use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
7 7
8class InstapaperControllerTest extends WallabagCoreTestCase 8class InstapaperControllerTest extends WallabagCoreTestCase
9{ 9{
@@ -14,9 +14,9 @@ class InstapaperControllerTest extends WallabagCoreTestCase
14 14
15 $crawler = $client->request('GET', '/import/instapaper'); 15 $crawler = $client->request('GET', '/import/instapaper');
16 16
17 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 17 $this->assertSame(200, $client->getResponse()->getStatusCode());
18 $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); 18 $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
19 $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); 19 $this->assertSame(1, $crawler->filter('input[type=file]')->count());
20 } 20 }
21 21
22 public function testImportInstapaperWithRabbitEnabled() 22 public function testImportInstapaperWithRabbitEnabled()
@@ -28,9 +28,9 @@ class InstapaperControllerTest extends WallabagCoreTestCase
28 28
29 $crawler = $client->request('GET', '/import/instapaper'); 29 $crawler = $client->request('GET', '/import/instapaper');
30 30
31 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 31 $this->assertSame(200, $client->getResponse()->getStatusCode());
32 $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); 32 $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
33 $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); 33 $this->assertSame(1, $crawler->filter('input[type=file]')->count());
34 34
35 $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0); 35 $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0);
36 } 36 }
@@ -49,7 +49,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase
49 49
50 $client->submit($form, $data); 50 $client->submit($form, $data);
51 51
52 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 52 $this->assertSame(200, $client->getResponse()->getStatusCode());
53 } 53 }
54 54
55 public function testImportInstapaperWithRedisEnabled() 55 public function testImportInstapaperWithRedisEnabled()
@@ -61,13 +61,13 @@ class InstapaperControllerTest extends WallabagCoreTestCase
61 61
62 $crawler = $client->request('GET', '/import/instapaper'); 62 $crawler = $client->request('GET', '/import/instapaper');
63 63
64 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 64 $this->assertSame(200, $client->getResponse()->getStatusCode());
65 $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); 65 $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
66 $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); 66 $this->assertSame(1, $crawler->filter('input[type=file]')->count());
67 67
68 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); 68 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
69 69
70 $file = new UploadedFile(__DIR__.'/../fixtures/instapaper-export.csv', 'instapaper.csv'); 70 $file = new UploadedFile(__DIR__ . '/../fixtures/instapaper-export.csv', 'instapaper.csv');
71 71
72 $data = [ 72 $data = [
73 'upload_import_file[file]' => $file, 73 'upload_import_file[file]' => $file,
@@ -75,7 +75,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase
75 75
76 $client->submit($form, $data); 76 $client->submit($form, $data);
77 77
78 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 78 $this->assertSame(302, $client->getResponse()->getStatusCode());
79 79
80 $crawler = $client->followRedirect(); 80 $crawler = $client->followRedirect();
81 81
@@ -95,7 +95,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase
95 $crawler = $client->request('GET', '/import/instapaper'); 95 $crawler = $client->request('GET', '/import/instapaper');
96 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); 96 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
97 97
98 $file = new UploadedFile(__DIR__.'/../fixtures/instapaper-export.csv', 'instapaper.csv'); 98 $file = new UploadedFile(__DIR__ . '/../fixtures/instapaper-export.csv', 'instapaper.csv');
99 99
100 $data = [ 100 $data = [
101 'upload_import_file[file]' => $file, 101 'upload_import_file[file]' => $file,
@@ -103,7 +103,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase
103 103
104 $client->submit($form, $data); 104 $client->submit($form, $data);
105 105
106 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 106 $this->assertSame(302, $client->getResponse()->getStatusCode());
107 107
108 $crawler = $client->followRedirect(); 108 $crawler = $client->followRedirect();
109 109
@@ -122,7 +122,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase
122 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.liberation.fr is ok'); 122 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.liberation.fr is ok');
123 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.liberation.fr is ok'); 123 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.liberation.fr is ok');
124 $this->assertContains('foot', $content->getTags(), 'It includes the "foot" tag'); 124 $this->assertContains('foot', $content->getTags(), 'It includes the "foot" tag');
125 $this->assertEquals(1, count($content->getTags())); 125 $this->assertSame(1, count($content->getTags()));
126 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); 126 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
127 127
128 $content = $client->getContainer() 128 $content = $client->getContainer()
@@ -136,7 +136,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase
136 $this->assertContains('foot', $content->getTags()); 136 $this->assertContains('foot', $content->getTags());
137 $this->assertContains('test_tag', $content->getTags()); 137 $this->assertContains('test_tag', $content->getTags());
138 138
139 $this->assertEquals(2, count($content->getTags())); 139 $this->assertSame(2, count($content->getTags()));
140 } 140 }
141 141
142 public function testImportInstapaperWithFileAndMarkAllAsRead() 142 public function testImportInstapaperWithFileAndMarkAllAsRead()
@@ -147,7 +147,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase
147 $crawler = $client->request('GET', '/import/instapaper'); 147 $crawler = $client->request('GET', '/import/instapaper');
148 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); 148 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
149 149
150 $file = new UploadedFile(__DIR__.'/../fixtures/instapaper-export.csv', 'instapaper-read.csv'); 150 $file = new UploadedFile(__DIR__ . '/../fixtures/instapaper-export.csv', 'instapaper-read.csv');
151 151
152 $data = [ 152 $data = [
153 'upload_import_file[file]' => $file, 153 'upload_import_file[file]' => $file,
@@ -156,7 +156,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase
156 156
157 $client->submit($form, $data); 157 $client->submit($form, $data);
158 158
159 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 159 $this->assertSame(302, $client->getResponse()->getStatusCode());
160 160
161 $crawler = $client->followRedirect(); 161 $crawler = $client->followRedirect();
162 162
@@ -192,7 +192,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase
192 $crawler = $client->request('GET', '/import/instapaper'); 192 $crawler = $client->request('GET', '/import/instapaper');
193 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); 193 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
194 194
195 $file = new UploadedFile(__DIR__.'/../fixtures/test.txt', 'test.txt'); 195 $file = new UploadedFile(__DIR__ . '/../fixtures/test.txt', 'test.txt');
196 196
197 $data = [ 197 $data = [
198 'upload_import_file[file]' => $file, 198 'upload_import_file[file]' => $file,
@@ -200,7 +200,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase
200 200
201 $client->submit($form, $data); 201 $client->submit($form, $data);
202 202
203 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 203 $this->assertSame(302, $client->getResponse()->getStatusCode());
204 204
205 $crawler = $client->followRedirect(); 205 $crawler = $client->followRedirect();
206 206
diff --git a/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php b/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php
index e2b6e7b6..c307f96c 100644
--- a/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php
@@ -2,8 +2,8 @@
2 2
3namespace Tests\Wallabag\ImportBundle\Controller; 3namespace Tests\Wallabag\ImportBundle\Controller;
4 4
5use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
6use Symfony\Component\HttpFoundation\File\UploadedFile; 5use Symfony\Component\HttpFoundation\File\UploadedFile;
6use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
7 7
8class PinboardControllerTest extends WallabagCoreTestCase 8class PinboardControllerTest extends WallabagCoreTestCase
9{ 9{
@@ -14,9 +14,9 @@ class PinboardControllerTest extends WallabagCoreTestCase
14 14
15 $crawler = $client->request('GET', '/import/pinboard'); 15 $crawler = $client->request('GET', '/import/pinboard');
16 16
17 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 17 $this->assertSame(200, $client->getResponse()->getStatusCode());
18 $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); 18 $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
19 $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); 19 $this->assertSame(1, $crawler->filter('input[type=file]')->count());
20 } 20 }
21 21
22 public function testImportPinboardWithRabbitEnabled() 22 public function testImportPinboardWithRabbitEnabled()
@@ -28,9 +28,9 @@ class PinboardControllerTest extends WallabagCoreTestCase
28 28
29 $crawler = $client->request('GET', '/import/pinboard'); 29 $crawler = $client->request('GET', '/import/pinboard');
30 30
31 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 31 $this->assertSame(200, $client->getResponse()->getStatusCode());
32 $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); 32 $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
33 $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); 33 $this->assertSame(1, $crawler->filter('input[type=file]')->count());
34 34
35 $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0); 35 $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0);
36 } 36 }
@@ -49,7 +49,7 @@ class PinboardControllerTest extends WallabagCoreTestCase
49 49
50 $client->submit($form, $data); 50 $client->submit($form, $data);
51 51
52 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 52 $this->assertSame(200, $client->getResponse()->getStatusCode());
53 } 53 }
54 54
55 public function testImportPinboardWithRedisEnabled() 55 public function testImportPinboardWithRedisEnabled()
@@ -61,13 +61,13 @@ class PinboardControllerTest extends WallabagCoreTestCase
61 61
62 $crawler = $client->request('GET', '/import/pinboard'); 62 $crawler = $client->request('GET', '/import/pinboard');
63 63
64 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 64 $this->assertSame(200, $client->getResponse()->getStatusCode());
65 $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); 65 $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
66 $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); 66 $this->assertSame(1, $crawler->filter('input[type=file]')->count());
67 67
68 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); 68 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
69 69
70 $file = new UploadedFile(__DIR__.'/../fixtures/pinboard_export', 'pinboard.json'); 70 $file = new UploadedFile(__DIR__ . '/../fixtures/pinboard_export', 'pinboard.json');
71 71
72 $data = [ 72 $data = [
73 'upload_import_file[file]' => $file, 73 'upload_import_file[file]' => $file,
@@ -75,7 +75,7 @@ class PinboardControllerTest extends WallabagCoreTestCase
75 75
76 $client->submit($form, $data); 76 $client->submit($form, $data);
77 77
78 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 78 $this->assertSame(302, $client->getResponse()->getStatusCode());
79 79
80 $crawler = $client->followRedirect(); 80 $crawler = $client->followRedirect();
81 81
@@ -95,7 +95,7 @@ class PinboardControllerTest extends WallabagCoreTestCase
95 $crawler = $client->request('GET', '/import/pinboard'); 95 $crawler = $client->request('GET', '/import/pinboard');
96 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); 96 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
97 97
98 $file = new UploadedFile(__DIR__.'/../fixtures/pinboard_export', 'pinboard.json'); 98 $file = new UploadedFile(__DIR__ . '/../fixtures/pinboard_export', 'pinboard.json');
99 99
100 $data = [ 100 $data = [
101 'upload_import_file[file]' => $file, 101 'upload_import_file[file]' => $file,
@@ -103,7 +103,7 @@ class PinboardControllerTest extends WallabagCoreTestCase
103 103
104 $client->submit($form, $data); 104 $client->submit($form, $data);
105 105
106 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 106 $this->assertSame(302, $client->getResponse()->getStatusCode());
107 107
108 $crawler = $client->followRedirect(); 108 $crawler = $client->followRedirect();
109 109
@@ -126,10 +126,10 @@ class PinboardControllerTest extends WallabagCoreTestCase
126 $this->assertContains('foot', $tags, 'It includes the "foot" tag'); 126 $this->assertContains('foot', $tags, 'It includes the "foot" tag');
127 $this->assertContains('varnish', $tags, 'It includes the "varnish" tag'); 127 $this->assertContains('varnish', $tags, 'It includes the "varnish" tag');
128 $this->assertContains('PHP', $tags, 'It includes the "PHP" tag'); 128 $this->assertContains('PHP', $tags, 'It includes the "PHP" tag');
129 $this->assertEquals(3, count($tags)); 129 $this->assertSame(3, count($tags));
130 130
131 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); 131 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
132 $this->assertEquals('2016-10-26', $content->getCreatedAt()->format('Y-m-d')); 132 $this->assertSame('2016-10-26', $content->getCreatedAt()->format('Y-m-d'));
133 } 133 }
134 134
135 public function testImportPinboardWithFileAndMarkAllAsRead() 135 public function testImportPinboardWithFileAndMarkAllAsRead()
@@ -140,7 +140,7 @@ class PinboardControllerTest extends WallabagCoreTestCase
140 $crawler = $client->request('GET', '/import/pinboard'); 140 $crawler = $client->request('GET', '/import/pinboard');
141 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); 141 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
142 142
143 $file = new UploadedFile(__DIR__.'/../fixtures/pinboard_export', 'pinboard-read.json'); 143 $file = new UploadedFile(__DIR__ . '/../fixtures/pinboard_export', 'pinboard-read.json');
144 144
145 $data = [ 145 $data = [
146 'upload_import_file[file]' => $file, 146 'upload_import_file[file]' => $file,
@@ -149,7 +149,7 @@ class PinboardControllerTest extends WallabagCoreTestCase
149 149
150 $client->submit($form, $data); 150 $client->submit($form, $data);
151 151
152 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 152 $this->assertSame(302, $client->getResponse()->getStatusCode());
153 153
154 $crawler = $client->followRedirect(); 154 $crawler = $client->followRedirect();
155 155
@@ -185,7 +185,7 @@ class PinboardControllerTest extends WallabagCoreTestCase
185 $crawler = $client->request('GET', '/import/pinboard'); 185 $crawler = $client->request('GET', '/import/pinboard');
186 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); 186 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
187 187
188 $file = new UploadedFile(__DIR__.'/../fixtures/test.txt', 'test.txt'); 188 $file = new UploadedFile(__DIR__ . '/../fixtures/test.txt', 'test.txt');
189 189
190 $data = [ 190 $data = [
191 'upload_import_file[file]' => $file, 191 'upload_import_file[file]' => $file,
@@ -193,7 +193,7 @@ class PinboardControllerTest extends WallabagCoreTestCase
193 193
194 $client->submit($form, $data); 194 $client->submit($form, $data);
195 195
196 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 196 $this->assertSame(302, $client->getResponse()->getStatusCode());
197 197
198 $crawler = $client->followRedirect(); 198 $crawler = $client->followRedirect();
199 199
diff --git a/tests/Wallabag/ImportBundle/Controller/PocketControllerTest.php b/tests/Wallabag/ImportBundle/Controller/PocketControllerTest.php
index 7d6a300f..17ce1a2a 100644
--- a/tests/Wallabag/ImportBundle/Controller/PocketControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/PocketControllerTest.php
@@ -13,8 +13,8 @@ class PocketControllerTest extends WallabagCoreTestCase
13 13
14 $crawler = $client->request('GET', '/import/pocket'); 14 $crawler = $client->request('GET', '/import/pocket');
15 15
16 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 16 $this->assertSame(200, $client->getResponse()->getStatusCode());
17 $this->assertEquals(1, $crawler->filter('button[type=submit]')->count()); 17 $this->assertSame(1, $crawler->filter('button[type=submit]')->count());
18 } 18 }
19 19
20 public function testImportPocketWithRabbitEnabled() 20 public function testImportPocketWithRabbitEnabled()
@@ -26,8 +26,8 @@ class PocketControllerTest extends WallabagCoreTestCase
26 26
27 $crawler = $client->request('GET', '/import/pocket'); 27 $crawler = $client->request('GET', '/import/pocket');
28 28
29 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 29 $this->assertSame(200, $client->getResponse()->getStatusCode());
30 $this->assertEquals(1, $crawler->filter('button[type=submit]')->count()); 30 $this->assertSame(1, $crawler->filter('button[type=submit]')->count());
31 31
32 $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0); 32 $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0);
33 } 33 }
@@ -42,8 +42,8 @@ class PocketControllerTest extends WallabagCoreTestCase
42 42
43 $crawler = $client->request('GET', '/import/pocket'); 43 $crawler = $client->request('GET', '/import/pocket');
44 44
45 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 45 $this->assertSame(200, $client->getResponse()->getStatusCode());
46 $this->assertEquals(1, $crawler->filter('button[type=submit]')->count()); 46 $this->assertSame(1, $crawler->filter('button[type=submit]')->count());
47 47
48 $client->getContainer()->get('craue_config')->set('import_with_redis', 0); 48 $client->getContainer()->get('craue_config')->set('import_with_redis', 0);
49 } 49 }
@@ -55,7 +55,7 @@ class PocketControllerTest extends WallabagCoreTestCase
55 55
56 $client->request('GET', '/import/pocket/auth'); 56 $client->request('GET', '/import/pocket/auth');
57 57
58 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 58 $this->assertSame(302, $client->getResponse()->getStatusCode());
59 } 59 }
60 60
61 public function testImportPocketAuth() 61 public function testImportPocketAuth()
@@ -76,7 +76,7 @@ class PocketControllerTest extends WallabagCoreTestCase
76 76
77 $client->request('GET', '/import/pocket/auth'); 77 $client->request('GET', '/import/pocket/auth');
78 78
79 $this->assertEquals(301, $client->getResponse()->getStatusCode()); 79 $this->assertSame(301, $client->getResponse()->getStatusCode());
80 $this->assertContains('getpocket.com/auth/authorize', $client->getResponse()->headers->get('location')); 80 $this->assertContains('getpocket.com/auth/authorize', $client->getResponse()->headers->get('location'));
81 } 81 }
82 82
@@ -98,9 +98,9 @@ class PocketControllerTest extends WallabagCoreTestCase
98 98
99 $client->request('GET', '/import/pocket/callback'); 99 $client->request('GET', '/import/pocket/callback');
100 100
101 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 101 $this->assertSame(302, $client->getResponse()->getStatusCode());
102 $this->assertContains('/', $client->getResponse()->headers->get('location'), 'Import is ok, redirect to homepage'); 102 $this->assertContains('/', $client->getResponse()->headers->get('location'), 'Import is ok, redirect to homepage');
103 $this->assertEquals('flashes.import.notice.failed', $client->getContainer()->get('session')->getFlashBag()->peek('notice')[0]); 103 $this->assertSame('flashes.import.notice.failed', $client->getContainer()->get('session')->getFlashBag()->peek('notice')[0]);
104 } 104 }
105 105
106 public function testImportPocketCallback() 106 public function testImportPocketCallback()
@@ -132,8 +132,8 @@ class PocketControllerTest extends WallabagCoreTestCase
132 132
133 $client->request('GET', '/import/pocket/callback'); 133 $client->request('GET', '/import/pocket/callback');
134 134
135 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 135 $this->assertSame(302, $client->getResponse()->getStatusCode());
136 $this->assertContains('/', $client->getResponse()->headers->get('location'), 'Import is ok, redirect to homepage'); 136 $this->assertContains('/', $client->getResponse()->headers->get('location'), 'Import is ok, redirect to homepage');
137 $this->assertEquals('flashes.import.notice.summary', $client->getContainer()->get('session')->getFlashBag()->peek('notice')[0]); 137 $this->assertSame('flashes.import.notice.summary', $client->getContainer()->get('session')->getFlashBag()->peek('notice')[0]);
138 } 138 }
139} 139}
diff --git a/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php
index bde0a600..e1915150 100644
--- a/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php
@@ -2,8 +2,8 @@
2 2
3namespace Tests\Wallabag\ImportBundle\Controller; 3namespace Tests\Wallabag\ImportBundle\Controller;
4 4
5use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
6use Symfony\Component\HttpFoundation\File\UploadedFile; 5use Symfony\Component\HttpFoundation\File\UploadedFile;
6use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
7 7
8class ReadabilityControllerTest extends WallabagCoreTestCase 8class ReadabilityControllerTest extends WallabagCoreTestCase
9{ 9{
@@ -14,9 +14,9 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
14 14
15 $crawler = $client->request('GET', '/import/readability'); 15 $crawler = $client->request('GET', '/import/readability');
16 16
17 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 17 $this->assertSame(200, $client->getResponse()->getStatusCode());
18 $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); 18 $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
19 $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); 19 $this->assertSame(1, $crawler->filter('input[type=file]')->count());
20 } 20 }
21 21
22 public function testImportReadabilityWithRabbitEnabled() 22 public function testImportReadabilityWithRabbitEnabled()
@@ -28,9 +28,9 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
28 28
29 $crawler = $client->request('GET', '/import/readability'); 29 $crawler = $client->request('GET', '/import/readability');
30 30
31 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 31 $this->assertSame(200, $client->getResponse()->getStatusCode());
32 $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); 32 $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
33 $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); 33 $this->assertSame(1, $crawler->filter('input[type=file]')->count());
34 34
35 $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0); 35 $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0);
36 } 36 }
@@ -49,7 +49,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
49 49
50 $client->submit($form, $data); 50 $client->submit($form, $data);
51 51
52 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 52 $this->assertSame(200, $client->getResponse()->getStatusCode());
53 } 53 }
54 54
55 public function testImportReadabilityWithRedisEnabled() 55 public function testImportReadabilityWithRedisEnabled()
@@ -61,13 +61,13 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
61 61
62 $crawler = $client->request('GET', '/import/readability'); 62 $crawler = $client->request('GET', '/import/readability');
63 63
64 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 64 $this->assertSame(200, $client->getResponse()->getStatusCode());
65 $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); 65 $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
66 $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); 66 $this->assertSame(1, $crawler->filter('input[type=file]')->count());
67 67
68 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); 68 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
69 69
70 $file = new UploadedFile(__DIR__.'/../fixtures/readability.json', 'readability.json'); 70 $file = new UploadedFile(__DIR__ . '/../fixtures/readability.json', 'readability.json');
71 71
72 $data = [ 72 $data = [
73 'upload_import_file[file]' => $file, 73 'upload_import_file[file]' => $file,
@@ -75,7 +75,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
75 75
76 $client->submit($form, $data); 76 $client->submit($form, $data);
77 77
78 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 78 $this->assertSame(302, $client->getResponse()->getStatusCode());
79 79
80 $crawler = $client->followRedirect(); 80 $crawler = $client->followRedirect();
81 81
@@ -95,7 +95,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
95 $crawler = $client->request('GET', '/import/readability'); 95 $crawler = $client->request('GET', '/import/readability');
96 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); 96 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
97 97
98 $file = new UploadedFile(__DIR__.'/../fixtures/readability.json', 'readability.json'); 98 $file = new UploadedFile(__DIR__ . '/../fixtures/readability.json', 'readability.json');
99 99
100 $data = [ 100 $data = [
101 'upload_import_file[file]' => $file, 101 'upload_import_file[file]' => $file,
@@ -103,7 +103,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
103 103
104 $client->submit($form, $data); 104 $client->submit($form, $data);
105 105
106 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 106 $this->assertSame(302, $client->getResponse()->getStatusCode());
107 107
108 $crawler = $client->followRedirect(); 108 $crawler = $client->followRedirect();
109 109
@@ -124,10 +124,10 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
124 124
125 $tags = $content->getTags(); 125 $tags = $content->getTags();
126 $this->assertContains('foot', $tags, 'It includes the "foot" tag'); 126 $this->assertContains('foot', $tags, 'It includes the "foot" tag');
127 $this->assertEquals(1, count($tags)); 127 $this->assertSame(1, count($tags));
128 128
129 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); 129 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
130 $this->assertEquals('2016-09-08', $content->getCreatedAt()->format('Y-m-d')); 130 $this->assertSame('2016-09-08', $content->getCreatedAt()->format('Y-m-d'));
131 } 131 }
132 132
133 public function testImportReadabilityWithFileAndMarkAllAsRead() 133 public function testImportReadabilityWithFileAndMarkAllAsRead()
@@ -138,7 +138,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
138 $crawler = $client->request('GET', '/import/readability'); 138 $crawler = $client->request('GET', '/import/readability');
139 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); 139 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
140 140
141 $file = new UploadedFile(__DIR__.'/../fixtures/readability-read.json', 'readability-read.json'); 141 $file = new UploadedFile(__DIR__ . '/../fixtures/readability-read.json', 'readability-read.json');
142 142
143 $data = [ 143 $data = [
144 'upload_import_file[file]' => $file, 144 'upload_import_file[file]' => $file,
@@ -147,7 +147,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
147 147
148 $client->submit($form, $data); 148 $client->submit($form, $data);
149 149
150 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 150 $this->assertSame(302, $client->getResponse()->getStatusCode());
151 151
152 $crawler = $client->followRedirect(); 152 $crawler = $client->followRedirect();
153 153
@@ -183,7 +183,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
183 $crawler = $client->request('GET', '/import/readability'); 183 $crawler = $client->request('GET', '/import/readability');
184 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); 184 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
185 185
186 $file = new UploadedFile(__DIR__.'/../fixtures/test.txt', 'test.txt'); 186 $file = new UploadedFile(__DIR__ . '/../fixtures/test.txt', 'test.txt');
187 187
188 $data = [ 188 $data = [
189 'upload_import_file[file]' => $file, 189 'upload_import_file[file]' => $file,
@@ -191,7 +191,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
191 191
192 $client->submit($form, $data); 192 $client->submit($form, $data);
193 193
194 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 194 $this->assertSame(302, $client->getResponse()->getStatusCode());
195 195
196 $crawler = $client->followRedirect(); 196 $crawler = $client->followRedirect();
197 197
diff --git a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php
index 2c492c20..25625c35 100644
--- a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php
@@ -2,8 +2,8 @@
2 2
3namespace Tests\Wallabag\ImportBundle\Controller; 3namespace Tests\Wallabag\ImportBundle\Controller;
4 4
5use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
6use Symfony\Component\HttpFoundation\File\UploadedFile; 5use Symfony\Component\HttpFoundation\File\UploadedFile;
6use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
7 7
8class WallabagV1ControllerTest extends WallabagCoreTestCase 8class WallabagV1ControllerTest extends WallabagCoreTestCase
9{ 9{
@@ -14,9 +14,9 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
14 14
15 $crawler = $client->request('GET', '/import/wallabag-v1'); 15 $crawler = $client->request('GET', '/import/wallabag-v1');
16 16
17 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 17 $this->assertSame(200, $client->getResponse()->getStatusCode());
18 $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); 18 $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
19 $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); 19 $this->assertSame(1, $crawler->filter('input[type=file]')->count());
20 } 20 }
21 21
22 public function testImportWallabagWithRabbitEnabled() 22 public function testImportWallabagWithRabbitEnabled()
@@ -28,9 +28,9 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
28 28
29 $crawler = $client->request('GET', '/import/wallabag-v1'); 29 $crawler = $client->request('GET', '/import/wallabag-v1');
30 30
31 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 31 $this->assertSame(200, $client->getResponse()->getStatusCode());
32 $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); 32 $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
33 $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); 33 $this->assertSame(1, $crawler->filter('input[type=file]')->count());
34 34
35 $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0); 35 $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0);
36 } 36 }
@@ -49,7 +49,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
49 49
50 $client->submit($form, $data); 50 $client->submit($form, $data);
51 51
52 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 52 $this->assertSame(200, $client->getResponse()->getStatusCode());
53 } 53 }
54 54
55 public function testImportWallabagWithRedisEnabled() 55 public function testImportWallabagWithRedisEnabled()
@@ -62,13 +62,13 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
62 62
63 $crawler = $client->request('GET', '/import/wallabag-v1'); 63 $crawler = $client->request('GET', '/import/wallabag-v1');
64 64
65 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 65 $this->assertSame(200, $client->getResponse()->getStatusCode());
66 $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); 66 $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
67 $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); 67 $this->assertSame(1, $crawler->filter('input[type=file]')->count());
68 68
69 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); 69 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
70 70
71 $file = new UploadedFile(__DIR__.'/../fixtures/wallabag-v1.json', 'wallabag-v1.json'); 71 $file = new UploadedFile(__DIR__ . '/../fixtures/wallabag-v1.json', 'wallabag-v1.json');
72 72
73 $data = [ 73 $data = [
74 'upload_import_file[file]' => $file, 74 'upload_import_file[file]' => $file,
@@ -76,7 +76,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
76 76
77 $client->submit($form, $data); 77 $client->submit($form, $data);
78 78
79 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 79 $this->assertSame(302, $client->getResponse()->getStatusCode());
80 80
81 $crawler = $client->followRedirect(); 81 $crawler = $client->followRedirect();
82 82
@@ -96,7 +96,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
96 $crawler = $client->request('GET', '/import/wallabag-v1'); 96 $crawler = $client->request('GET', '/import/wallabag-v1');
97 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); 97 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
98 98
99 $file = new UploadedFile(__DIR__.'/../fixtures/wallabag-v1.json', 'wallabag-v1.json'); 99 $file = new UploadedFile(__DIR__ . '/../fixtures/wallabag-v1.json', 'wallabag-v1.json');
100 100
101 $data = [ 101 $data = [
102 'upload_import_file[file]' => $file, 102 'upload_import_file[file]' => $file,
@@ -104,7 +104,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
104 104
105 $client->submit($form, $data); 105 $client->submit($form, $data);
106 106
107 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 107 $this->assertSame(302, $client->getResponse()->getStatusCode());
108 108
109 $crawler = $client->followRedirect(); 109 $crawler = $client->followRedirect();
110 110
@@ -126,7 +126,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
126 $tags = $content->getTags(); 126 $tags = $content->getTags();
127 $this->assertContains('foot', $tags, 'It includes the "foot" tag'); 127 $this->assertContains('foot', $tags, 'It includes the "foot" tag');
128 $this->assertContains('Framabag', $tags, 'It includes the "Framabag" tag'); 128 $this->assertContains('Framabag', $tags, 'It includes the "Framabag" tag');
129 $this->assertEquals(2, count($tags)); 129 $this->assertSame(2, count($tags));
130 130
131 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); 131 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
132 } 132 }
@@ -139,7 +139,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
139 $crawler = $client->request('GET', '/import/wallabag-v1'); 139 $crawler = $client->request('GET', '/import/wallabag-v1');
140 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); 140 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
141 141
142 $file = new UploadedFile(__DIR__.'/../fixtures/wallabag-v1-read.json', 'wallabag-v1-read.json'); 142 $file = new UploadedFile(__DIR__ . '/../fixtures/wallabag-v1-read.json', 'wallabag-v1-read.json');
143 143
144 $data = [ 144 $data = [
145 'upload_import_file[file]' => $file, 145 'upload_import_file[file]' => $file,
@@ -148,7 +148,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
148 148
149 $client->submit($form, $data); 149 $client->submit($form, $data);
150 150
151 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 151 $this->assertSame(302, $client->getResponse()->getStatusCode());
152 152
153 $crawler = $client->followRedirect(); 153 $crawler = $client->followRedirect();
154 154
@@ -184,7 +184,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
184 $crawler = $client->request('GET', '/import/wallabag-v1'); 184 $crawler = $client->request('GET', '/import/wallabag-v1');
185 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); 185 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
186 186
187 $file = new UploadedFile(__DIR__.'/../fixtures/test.txt', 'test.txt'); 187 $file = new UploadedFile(__DIR__ . '/../fixtures/test.txt', 'test.txt');
188 188
189 $data = [ 189 $data = [
190 'upload_import_file[file]' => $file, 190 'upload_import_file[file]' => $file,
@@ -192,7 +192,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
192 192
193 $client->submit($form, $data); 193 $client->submit($form, $data);
194 194
195 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 195 $this->assertSame(302, $client->getResponse()->getStatusCode());
196 196
197 $crawler = $client->followRedirect(); 197 $crawler = $client->followRedirect();
198 198
diff --git a/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php b/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php
index 24893259..a94adcaf 100644
--- a/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php
@@ -2,8 +2,8 @@
2 2
3namespace Tests\Wallabag\ImportBundle\Controller; 3namespace Tests\Wallabag\ImportBundle\Controller;
4 4
5use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
6use Symfony\Component\HttpFoundation\File\UploadedFile; 5use Symfony\Component\HttpFoundation\File\UploadedFile;
6use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
7 7
8class WallabagV2ControllerTest extends WallabagCoreTestCase 8class WallabagV2ControllerTest extends WallabagCoreTestCase
9{ 9{
@@ -14,9 +14,9 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
14 14
15 $crawler = $client->request('GET', '/import/wallabag-v2'); 15 $crawler = $client->request('GET', '/import/wallabag-v2');
16 16
17 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 17 $this->assertSame(200, $client->getResponse()->getStatusCode());
18 $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); 18 $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
19 $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); 19 $this->assertSame(1, $crawler->filter('input[type=file]')->count());
20 } 20 }
21 21
22 public function testImportWallabagWithRabbitEnabled() 22 public function testImportWallabagWithRabbitEnabled()
@@ -28,9 +28,9 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
28 28
29 $crawler = $client->request('GET', '/import/wallabag-v2'); 29 $crawler = $client->request('GET', '/import/wallabag-v2');
30 30
31 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 31 $this->assertSame(200, $client->getResponse()->getStatusCode());
32 $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); 32 $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
33 $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); 33 $this->assertSame(1, $crawler->filter('input[type=file]')->count());
34 34
35 $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0); 35 $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0);
36 } 36 }
@@ -49,7 +49,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
49 49
50 $client->submit($form, $data); 50 $client->submit($form, $data);
51 51
52 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 52 $this->assertSame(200, $client->getResponse()->getStatusCode());
53 } 53 }
54 54
55 public function testImportWallabagWithRedisEnabled() 55 public function testImportWallabagWithRedisEnabled()
@@ -62,13 +62,13 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
62 62
63 $crawler = $client->request('GET', '/import/wallabag-v2'); 63 $crawler = $client->request('GET', '/import/wallabag-v2');
64 64
65 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 65 $this->assertSame(200, $client->getResponse()->getStatusCode());
66 $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); 66 $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
67 $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); 67 $this->assertSame(1, $crawler->filter('input[type=file]')->count());
68 68
69 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); 69 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
70 70
71 $file = new UploadedFile(__DIR__.'/../fixtures/wallabag-v2.json', 'wallabag-v2.json'); 71 $file = new UploadedFile(__DIR__ . '/../fixtures/wallabag-v2.json', 'wallabag-v2.json');
72 72
73 $data = [ 73 $data = [
74 'upload_import_file[file]' => $file, 74 'upload_import_file[file]' => $file,
@@ -76,7 +76,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
76 76
77 $client->submit($form, $data); 77 $client->submit($form, $data);
78 78
79 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 79 $this->assertSame(302, $client->getResponse()->getStatusCode());
80 80
81 $crawler = $client->followRedirect(); 81 $crawler = $client->followRedirect();
82 82
@@ -96,7 +96,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
96 $crawler = $client->request('GET', '/import/wallabag-v2'); 96 $crawler = $client->request('GET', '/import/wallabag-v2');
97 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); 97 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
98 98
99 $file = new UploadedFile(__DIR__.'/../fixtures/wallabag-v2.json', 'wallabag-v2.json'); 99 $file = new UploadedFile(__DIR__ . '/../fixtures/wallabag-v2.json', 'wallabag-v2.json');
100 100
101 $data = [ 101 $data = [
102 'upload_import_file[file]' => $file, 102 'upload_import_file[file]' => $file,
@@ -104,7 +104,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
104 104
105 $client->submit($form, $data); 105 $client->submit($form, $data);
106 106
107 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 107 $this->assertSame(302, $client->getResponse()->getStatusCode());
108 108
109 $crawler = $client->followRedirect(); 109 $crawler = $client->followRedirect();
110 110
@@ -126,7 +126,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
126 126
127 $tags = $content->getTags(); 127 $tags = $content->getTags();
128 $this->assertContains('foot', $tags, 'It includes the "foot" tag'); 128 $this->assertContains('foot', $tags, 'It includes the "foot" tag');
129 $this->assertEquals(1, count($tags)); 129 $this->assertSame(1, count($tags));
130 130
131 $content = $client->getContainer() 131 $content = $client->getContainer()
132 ->get('doctrine.orm.entity_manager') 132 ->get('doctrine.orm.entity_manager')
@@ -144,10 +144,10 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
144 $this->assertContains('foot', $tags, 'It includes the "foot" tag'); 144 $this->assertContains('foot', $tags, 'It includes the "foot" tag');
145 $this->assertContains('mediapart', $tags, 'It includes the "mediapart" tag'); 145 $this->assertContains('mediapart', $tags, 'It includes the "mediapart" tag');
146 $this->assertContains('blog', $tags, 'It includes the "blog" tag'); 146 $this->assertContains('blog', $tags, 'It includes the "blog" tag');
147 $this->assertEquals(3, count($tags)); 147 $this->assertSame(3, count($tags));
148 148
149 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); 149 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
150 $this->assertEquals('2016-09-08', $content->getCreatedAt()->format('Y-m-d')); 150 $this->assertSame('2016-09-08', $content->getCreatedAt()->format('Y-m-d'));
151 $this->assertTrue($content->isStarred(), 'Entry is starred'); 151 $this->assertTrue($content->isStarred(), 'Entry is starred');
152 } 152 }
153 153
@@ -159,7 +159,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
159 $crawler = $client->request('GET', '/import/wallabag-v2'); 159 $crawler = $client->request('GET', '/import/wallabag-v2');
160 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); 160 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
161 161
162 $file = new UploadedFile(__DIR__.'/../fixtures/test.txt', 'test.txt'); 162 $file = new UploadedFile(__DIR__ . '/../fixtures/test.txt', 'test.txt');
163 163
164 $data = [ 164 $data = [
165 'upload_import_file[file]' => $file, 165 'upload_import_file[file]' => $file,
@@ -167,7 +167,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
167 167
168 $client->submit($form, $data); 168 $client->submit($form, $data);
169 169
170 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 170 $this->assertSame(302, $client->getResponse()->getStatusCode());
171 171
172 $crawler = $client->followRedirect(); 172 $crawler = $client->followRedirect();
173 173
diff --git a/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php b/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php
index cec19534..5559ac7e 100644
--- a/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php
@@ -2,14 +2,14 @@
2 2
3namespace Tests\Wallabag\ImportBundle\Import; 3namespace Tests\Wallabag\ImportBundle\Import;
4 4
5use Wallabag\ImportBundle\Import\ChromeImport; 5use M6Web\Component\RedisMock\RedisMockFactory;
6use Wallabag\UserBundle\Entity\User;
7use Wallabag\CoreBundle\Entity\Entry;
8use Wallabag\ImportBundle\Redis\Producer;
9use Monolog\Logger;
10use Monolog\Handler\TestHandler; 6use Monolog\Handler\TestHandler;
7use Monolog\Logger;
11use Simpleue\Queue\RedisQueue; 8use Simpleue\Queue\RedisQueue;
12use M6Web\Component\RedisMock\RedisMockFactory; 9use Wallabag\CoreBundle\Entity\Entry;
10use Wallabag\ImportBundle\Import\ChromeImport;
11use Wallabag\ImportBundle\Redis\Producer;
12use Wallabag\UserBundle\Entity\User;
13 13
14class ChromeImportTest extends \PHPUnit_Framework_TestCase 14class ChromeImportTest extends \PHPUnit_Framework_TestCase
15{ 15{
@@ -19,56 +19,19 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase
19 protected $contentProxy; 19 protected $contentProxy;
20 protected $tagsAssigner; 20 protected $tagsAssigner;
21 21
22 private function getChromeImport($unsetUser = false, $dispatched = 0)
23 {
24 $this->user = new User();
25
26 $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
27 ->disableOriginalConstructor()
28 ->getMock();
29
30 $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy')
31 ->disableOriginalConstructor()
32 ->getMock();
33
34 $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
35 ->disableOriginalConstructor()
36 ->getMock();
37
38 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
39 ->disableOriginalConstructor()
40 ->getMock();
41
42 $dispatcher
43 ->expects($this->exactly($dispatched))
44 ->method('dispatch');
45
46 $wallabag = new ChromeImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
47
48 $this->logHandler = new TestHandler();
49 $logger = new Logger('test', [$this->logHandler]);
50 $wallabag->setLogger($logger);
51
52 if (false === $unsetUser) {
53 $wallabag->setUser($this->user);
54 }
55
56 return $wallabag;
57 }
58
59 public function testInit() 22 public function testInit()
60 { 23 {
61 $chromeImport = $this->getChromeImport(); 24 $chromeImport = $this->getChromeImport();
62 25
63 $this->assertEquals('Chrome', $chromeImport->getName()); 26 $this->assertSame('Chrome', $chromeImport->getName());
64 $this->assertNotEmpty($chromeImport->getUrl()); 27 $this->assertNotEmpty($chromeImport->getUrl());
65 $this->assertEquals('import.chrome.description', $chromeImport->getDescription()); 28 $this->assertSame('import.chrome.description', $chromeImport->getDescription());
66 } 29 }
67 30
68 public function testImport() 31 public function testImport()
69 { 32 {
70 $chromeImport = $this->getChromeImport(false, 1); 33 $chromeImport = $this->getChromeImport(false, 1);
71 $chromeImport->setFilepath(__DIR__.'/../fixtures/chrome-bookmarks'); 34 $chromeImport->setFilepath(__DIR__ . '/../fixtures/chrome-bookmarks');
72 35
73 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') 36 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
74 ->disableOriginalConstructor() 37 ->disableOriginalConstructor()
@@ -95,13 +58,13 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase
95 $res = $chromeImport->import(); 58 $res = $chromeImport->import();
96 59
97 $this->assertTrue($res); 60 $this->assertTrue($res);
98 $this->assertEquals(['skipped' => 0, 'imported' => 1, 'queued' => 0], $chromeImport->getSummary()); 61 $this->assertSame(['skipped' => 0, 'imported' => 1, 'queued' => 0], $chromeImport->getSummary());
99 } 62 }
100 63
101 public function testImportAndMarkAllAsRead() 64 public function testImportAndMarkAllAsRead()
102 { 65 {
103 $chromeImport = $this->getChromeImport(false, 1); 66 $chromeImport = $this->getChromeImport(false, 1);
104 $chromeImport->setFilepath(__DIR__.'/../fixtures/chrome-bookmarks'); 67 $chromeImport->setFilepath(__DIR__ . '/../fixtures/chrome-bookmarks');
105 68
106 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') 69 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
107 ->disableOriginalConstructor() 70 ->disableOriginalConstructor()
@@ -133,13 +96,13 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase
133 96
134 $this->assertTrue($res); 97 $this->assertTrue($res);
135 98
136 $this->assertEquals(['skipped' => 0, 'imported' => 1, 'queued' => 0], $chromeImport->getSummary()); 99 $this->assertSame(['skipped' => 0, 'imported' => 1, 'queued' => 0], $chromeImport->getSummary());
137 } 100 }
138 101
139 public function testImportWithRabbit() 102 public function testImportWithRabbit()
140 { 103 {
141 $chromeImport = $this->getChromeImport(); 104 $chromeImport = $this->getChromeImport();
142 $chromeImport->setFilepath(__DIR__.'/../fixtures/chrome-bookmarks'); 105 $chromeImport->setFilepath(__DIR__ . '/../fixtures/chrome-bookmarks');
143 106
144 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') 107 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
145 ->disableOriginalConstructor() 108 ->disableOriginalConstructor()
@@ -173,13 +136,13 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase
173 $res = $chromeImport->setMarkAsRead(true)->import(); 136 $res = $chromeImport->setMarkAsRead(true)->import();
174 137
175 $this->assertTrue($res); 138 $this->assertTrue($res);
176 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 1], $chromeImport->getSummary()); 139 $this->assertSame(['skipped' => 0, 'imported' => 0, 'queued' => 1], $chromeImport->getSummary());
177 } 140 }
178 141
179 public function testImportWithRedis() 142 public function testImportWithRedis()
180 { 143 {
181 $chromeImport = $this->getChromeImport(); 144 $chromeImport = $this->getChromeImport();
182 $chromeImport->setFilepath(__DIR__.'/../fixtures/chrome-bookmarks'); 145 $chromeImport->setFilepath(__DIR__ . '/../fixtures/chrome-bookmarks');
183 146
184 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') 147 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
185 ->disableOriginalConstructor() 148 ->disableOriginalConstructor()
@@ -211,7 +174,7 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase
211 $res = $chromeImport->setMarkAsRead(true)->import(); 174 $res = $chromeImport->setMarkAsRead(true)->import();
212 175
213 $this->assertTrue($res); 176 $this->assertTrue($res);
214 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 1], $chromeImport->getSummary()); 177 $this->assertSame(['skipped' => 0, 'imported' => 0, 'queued' => 1], $chromeImport->getSummary());
215 178
216 $this->assertNotEmpty($redisMock->lpop('chrome')); 179 $this->assertNotEmpty($redisMock->lpop('chrome'));
217 } 180 }
@@ -219,7 +182,7 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase
219 public function testImportBadFile() 182 public function testImportBadFile()
220 { 183 {
221 $chromeImport = $this->getChromeImport(); 184 $chromeImport = $this->getChromeImport();
222 $chromeImport->setFilepath(__DIR__.'/../fixtures/wallabag-v1.jsonx'); 185 $chromeImport->setFilepath(__DIR__ . '/../fixtures/wallabag-v1.jsonx');
223 186
224 $res = $chromeImport->import(); 187 $res = $chromeImport->import();
225 188
@@ -227,13 +190,13 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase
227 190
228 $records = $this->logHandler->getRecords(); 191 $records = $this->logHandler->getRecords();
229 $this->assertContains('Wallabag Browser Import: unable to read file', $records[0]['message']); 192 $this->assertContains('Wallabag Browser Import: unable to read file', $records[0]['message']);
230 $this->assertEquals('ERROR', $records[0]['level_name']); 193 $this->assertSame('ERROR', $records[0]['level_name']);
231 } 194 }
232 195
233 public function testImportUserNotDefined() 196 public function testImportUserNotDefined()
234 { 197 {
235 $chromeImport = $this->getChromeImport(true); 198 $chromeImport = $this->getChromeImport(true);
236 $chromeImport->setFilepath(__DIR__.'/../fixtures/chrome-bookmarks'); 199 $chromeImport->setFilepath(__DIR__ . '/../fixtures/chrome-bookmarks');
237 200
238 $res = $chromeImport->import(); 201 $res = $chromeImport->import();
239 202
@@ -241,6 +204,43 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase
241 204
242 $records = $this->logHandler->getRecords(); 205 $records = $this->logHandler->getRecords();
243 $this->assertContains('Wallabag Browser Import: user is not defined', $records[0]['message']); 206 $this->assertContains('Wallabag Browser Import: user is not defined', $records[0]['message']);
244 $this->assertEquals('ERROR', $records[0]['level_name']); 207 $this->assertSame('ERROR', $records[0]['level_name']);
208 }
209
210 private function getChromeImport($unsetUser = false, $dispatched = 0)
211 {
212 $this->user = new User();
213
214 $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
215 ->disableOriginalConstructor()
216 ->getMock();
217
218 $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy')
219 ->disableOriginalConstructor()
220 ->getMock();
221
222 $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
223 ->disableOriginalConstructor()
224 ->getMock();
225
226 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
227 ->disableOriginalConstructor()
228 ->getMock();
229
230 $dispatcher
231 ->expects($this->exactly($dispatched))
232 ->method('dispatch');
233
234 $wallabag = new ChromeImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
235
236 $this->logHandler = new TestHandler();
237 $logger = new Logger('test', [$this->logHandler]);
238 $wallabag->setLogger($logger);
239
240 if (false === $unsetUser) {
241 $wallabag->setUser($this->user);
242 }
243
244 return $wallabag;
245 } 245 }
246} 246}
diff --git a/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php b/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php
index c186c820..a1783bfc 100644
--- a/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php
@@ -2,14 +2,14 @@
2 2
3namespace Tests\Wallabag\ImportBundle\Import; 3namespace Tests\Wallabag\ImportBundle\Import;
4 4
5use Wallabag\ImportBundle\Import\FirefoxImport; 5use M6Web\Component\RedisMock\RedisMockFactory;
6use Wallabag\UserBundle\Entity\User;
7use Wallabag\CoreBundle\Entity\Entry;
8use Wallabag\ImportBundle\Redis\Producer;
9use Monolog\Logger;
10use Monolog\Handler\TestHandler; 6use Monolog\Handler\TestHandler;
7use Monolog\Logger;
11use Simpleue\Queue\RedisQueue; 8use Simpleue\Queue\RedisQueue;
12use M6Web\Component\RedisMock\RedisMockFactory; 9use Wallabag\CoreBundle\Entity\Entry;
10use Wallabag\ImportBundle\Import\FirefoxImport;
11use Wallabag\ImportBundle\Redis\Producer;
12use Wallabag\UserBundle\Entity\User;
13 13
14class FirefoxImportTest extends \PHPUnit_Framework_TestCase 14class FirefoxImportTest extends \PHPUnit_Framework_TestCase
15{ 15{
@@ -19,56 +19,19 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase
19 protected $contentProxy; 19 protected $contentProxy;
20 protected $tagsAssigner; 20 protected $tagsAssigner;
21 21
22 private function getFirefoxImport($unsetUser = false, $dispatched = 0)
23 {
24 $this->user = new User();
25
26 $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
27 ->disableOriginalConstructor()
28 ->getMock();
29
30 $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy')
31 ->disableOriginalConstructor()
32 ->getMock();
33
34 $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
35 ->disableOriginalConstructor()
36 ->getMock();
37
38 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
39 ->disableOriginalConstructor()
40 ->getMock();
41
42 $dispatcher
43 ->expects($this->exactly($dispatched))
44 ->method('dispatch');
45
46 $wallabag = new FirefoxImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
47
48 $this->logHandler = new TestHandler();
49 $logger = new Logger('test', [$this->logHandler]);
50 $wallabag->setLogger($logger);
51
52 if (false === $unsetUser) {
53 $wallabag->setUser($this->user);
54 }
55
56 return $wallabag;
57 }
58
59 public function testInit() 22 public function testInit()
60 { 23 {
61 $firefoxImport = $this->getFirefoxImport(); 24 $firefoxImport = $this->getFirefoxImport();
62 25
63 $this->assertEquals('Firefox', $firefoxImport->getName()); 26 $this->assertSame('Firefox', $firefoxImport->getName());
64 $this->assertNotEmpty($firefoxImport->getUrl()); 27 $this->assertNotEmpty($firefoxImport->getUrl());
65 $this->assertEquals('import.firefox.description', $firefoxImport->getDescription()); 28 $this->assertSame('import.firefox.description', $firefoxImport->getDescription());
66 } 29 }
67 30
68 public function testImport() 31 public function testImport()
69 { 32 {
70 $firefoxImport = $this->getFirefoxImport(false, 2); 33 $firefoxImport = $this->getFirefoxImport(false, 2);
71 $firefoxImport->setFilepath(__DIR__.'/../fixtures/firefox-bookmarks.json'); 34 $firefoxImport->setFilepath(__DIR__ . '/../fixtures/firefox-bookmarks.json');
72 35
73 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') 36 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
74 ->disableOriginalConstructor() 37 ->disableOriginalConstructor()
@@ -95,13 +58,13 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase
95 $res = $firefoxImport->import(); 58 $res = $firefoxImport->import();
96 59
97 $this->assertTrue($res); 60 $this->assertTrue($res);
98 $this->assertEquals(['skipped' => 0, 'imported' => 2, 'queued' => 0], $firefoxImport->getSummary()); 61 $this->assertSame(['skipped' => 0, 'imported' => 2, 'queued' => 0], $firefoxImport->getSummary());
99 } 62 }
100 63
101 public function testImportAndMarkAllAsRead() 64 public function testImportAndMarkAllAsRead()
102 { 65 {
103 $firefoxImport = $this->getFirefoxImport(false, 1); 66 $firefoxImport = $this->getFirefoxImport(false, 1);
104 $firefoxImport->setFilepath(__DIR__.'/../fixtures/firefox-bookmarks.json'); 67 $firefoxImport->setFilepath(__DIR__ . '/../fixtures/firefox-bookmarks.json');
105 68
106 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') 69 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
107 ->disableOriginalConstructor() 70 ->disableOriginalConstructor()
@@ -133,13 +96,13 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase
133 96
134 $this->assertTrue($res); 97 $this->assertTrue($res);
135 98
136 $this->assertEquals(['skipped' => 1, 'imported' => 1, 'queued' => 0], $firefoxImport->getSummary()); 99 $this->assertSame(['skipped' => 1, 'imported' => 1, 'queued' => 0], $firefoxImport->getSummary());
137 } 100 }
138 101
139 public function testImportWithRabbit() 102 public function testImportWithRabbit()
140 { 103 {
141 $firefoxImport = $this->getFirefoxImport(); 104 $firefoxImport = $this->getFirefoxImport();
142 $firefoxImport->setFilepath(__DIR__.'/../fixtures/firefox-bookmarks.json'); 105 $firefoxImport->setFilepath(__DIR__ . '/../fixtures/firefox-bookmarks.json');
143 106
144 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') 107 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
145 ->disableOriginalConstructor() 108 ->disableOriginalConstructor()
@@ -173,13 +136,13 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase
173 $res = $firefoxImport->setMarkAsRead(true)->import(); 136 $res = $firefoxImport->setMarkAsRead(true)->import();
174 137
175 $this->assertTrue($res); 138 $this->assertTrue($res);
176 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 1], $firefoxImport->getSummary()); 139 $this->assertSame(['skipped' => 0, 'imported' => 0, 'queued' => 1], $firefoxImport->getSummary());
177 } 140 }
178 141
179 public function testImportWithRedis() 142 public function testImportWithRedis()
180 { 143 {
181 $firefoxImport = $this->getFirefoxImport(); 144 $firefoxImport = $this->getFirefoxImport();
182 $firefoxImport->setFilepath(__DIR__.'/../fixtures/firefox-bookmarks.json'); 145 $firefoxImport->setFilepath(__DIR__ . '/../fixtures/firefox-bookmarks.json');
183 146
184 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') 147 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
185 ->disableOriginalConstructor() 148 ->disableOriginalConstructor()
@@ -211,7 +174,7 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase
211 $res = $firefoxImport->setMarkAsRead(true)->import(); 174 $res = $firefoxImport->setMarkAsRead(true)->import();
212 175
213 $this->assertTrue($res); 176 $this->assertTrue($res);
214 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 1], $firefoxImport->getSummary()); 177 $this->assertSame(['skipped' => 0, 'imported' => 0, 'queued' => 1], $firefoxImport->getSummary());
215 178
216 $this->assertNotEmpty($redisMock->lpop('firefox')); 179 $this->assertNotEmpty($redisMock->lpop('firefox'));
217 } 180 }
@@ -219,7 +182,7 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase
219 public function testImportBadFile() 182 public function testImportBadFile()
220 { 183 {
221 $firefoxImport = $this->getFirefoxImport(); 184 $firefoxImport = $this->getFirefoxImport();
222 $firefoxImport->setFilepath(__DIR__.'/../fixtures/wallabag-v1.jsonx'); 185 $firefoxImport->setFilepath(__DIR__ . '/../fixtures/wallabag-v1.jsonx');
223 186
224 $res = $firefoxImport->import(); 187 $res = $firefoxImport->import();
225 188
@@ -227,13 +190,13 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase
227 190
228 $records = $this->logHandler->getRecords(); 191 $records = $this->logHandler->getRecords();
229 $this->assertContains('Wallabag Browser Import: unable to read file', $records[0]['message']); 192 $this->assertContains('Wallabag Browser Import: unable to read file', $records[0]['message']);
230 $this->assertEquals('ERROR', $records[0]['level_name']); 193 $this->assertSame('ERROR', $records[0]['level_name']);
231 } 194 }
232 195
233 public function testImportUserNotDefined() 196 public function testImportUserNotDefined()
234 { 197 {
235 $firefoxImport = $this->getFirefoxImport(true); 198 $firefoxImport = $this->getFirefoxImport(true);
236 $firefoxImport->setFilepath(__DIR__.'/../fixtures/firefox-bookmarks.json'); 199 $firefoxImport->setFilepath(__DIR__ . '/../fixtures/firefox-bookmarks.json');
237 200
238 $res = $firefoxImport->import(); 201 $res = $firefoxImport->import();
239 202
@@ -241,6 +204,43 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase
241 204
242 $records = $this->logHandler->getRecords(); 205 $records = $this->logHandler->getRecords();
243 $this->assertContains('Wallabag Browser Import: user is not defined', $records[0]['message']); 206 $this->assertContains('Wallabag Browser Import: user is not defined', $records[0]['message']);
244 $this->assertEquals('ERROR', $records[0]['level_name']); 207 $this->assertSame('ERROR', $records[0]['level_name']);
208 }
209
210 private function getFirefoxImport($unsetUser = false, $dispatched = 0)
211 {
212 $this->user = new User();
213
214 $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
215 ->disableOriginalConstructor()
216 ->getMock();
217
218 $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy')
219 ->disableOriginalConstructor()
220 ->getMock();
221
222 $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
223 ->disableOriginalConstructor()
224 ->getMock();
225
226 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
227 ->disableOriginalConstructor()
228 ->getMock();
229
230 $dispatcher
231 ->expects($this->exactly($dispatched))
232 ->method('dispatch');
233
234 $wallabag = new FirefoxImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
235
236 $this->logHandler = new TestHandler();
237 $logger = new Logger('test', [$this->logHandler]);
238 $wallabag->setLogger($logger);
239
240 if (false === $unsetUser) {
241 $wallabag->setUser($this->user);
242 }
243
244 return $wallabag;
245 } 245 }
246} 246}
diff --git a/tests/Wallabag/ImportBundle/Import/ImportChainTest.php b/tests/Wallabag/ImportBundle/Import/ImportChainTest.php
index 32568ce5..a9a9915e 100644
--- a/tests/Wallabag/ImportBundle/Import/ImportChainTest.php
+++ b/tests/Wallabag/ImportBundle/Import/ImportChainTest.php
@@ -16,6 +16,6 @@ class ImportChainTest extends \PHPUnit_Framework_TestCase
16 $importChain->addImport($import, 'alias'); 16 $importChain->addImport($import, 'alias');
17 17
18 $this->assertCount(1, $importChain->getAll()); 18 $this->assertCount(1, $importChain->getAll());
19 $this->assertEquals($import, $importChain->getAll()['alias']); 19 $this->assertSame($import, $importChain->getAll()['alias']);
20 } 20 }
21} 21}
diff --git a/tests/Wallabag/ImportBundle/Import/ImportCompilerPassTest.php b/tests/Wallabag/ImportBundle/Import/ImportCompilerPassTest.php
index 71a007a9..207054f4 100644
--- a/tests/Wallabag/ImportBundle/Import/ImportCompilerPassTest.php
+++ b/tests/Wallabag/ImportBundle/Import/ImportCompilerPassTest.php
@@ -36,7 +36,7 @@ class ImportCompilerPassTest extends \PHPUnit_Framework_TestCase
36 $this->assertTrue($definition->hasMethodCall('addImport')); 36 $this->assertTrue($definition->hasMethodCall('addImport'));
37 37
38 $calls = $definition->getMethodCalls(); 38 $calls = $definition->getMethodCalls();
39 $this->assertEquals('pocket', $calls[0][1][1]); 39 $this->assertSame('pocket', $calls[0][1][1]);
40 } 40 }
41 41
42 protected function process(ContainerBuilder $container) 42 protected function process(ContainerBuilder $container)
diff --git a/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php b/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php
index 9158c8a2..274dc326 100644
--- a/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php
@@ -2,14 +2,14 @@
2 2
3namespace Tests\Wallabag\ImportBundle\Import; 3namespace Tests\Wallabag\ImportBundle\Import;
4 4
5use Wallabag\ImportBundle\Import\InstapaperImport; 5use M6Web\Component\RedisMock\RedisMockFactory;
6use Wallabag\UserBundle\Entity\User;
7use Wallabag\CoreBundle\Entity\Entry;
8use Wallabag\ImportBundle\Redis\Producer;
9use Monolog\Logger;
10use Monolog\Handler\TestHandler; 6use Monolog\Handler\TestHandler;
7use Monolog\Logger;
11use Simpleue\Queue\RedisQueue; 8use Simpleue\Queue\RedisQueue;
12use M6Web\Component\RedisMock\RedisMockFactory; 9use Wallabag\CoreBundle\Entity\Entry;
10use Wallabag\ImportBundle\Import\InstapaperImport;
11use Wallabag\ImportBundle\Redis\Producer;
12use Wallabag\UserBundle\Entity\User;
13 13
14class InstapaperImportTest extends \PHPUnit_Framework_TestCase 14class InstapaperImportTest extends \PHPUnit_Framework_TestCase
15{ 15{
@@ -20,70 +20,19 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase
20 protected $tagsAssigner; 20 protected $tagsAssigner;
21 protected $uow; 21 protected $uow;
22 22
23 private function getInstapaperImport($unsetUser = false, $dispatched = 0)
24 {
25 $this->user = new User();
26
27 $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
28 ->disableOriginalConstructor()
29 ->getMock();
30
31 $this->uow = $this->getMockBuilder('Doctrine\ORM\UnitOfWork')
32 ->disableOriginalConstructor()
33 ->getMock();
34
35 $this->em
36 ->expects($this->any())
37 ->method('getUnitOfWork')
38 ->willReturn($this->uow);
39
40 $this->uow
41 ->expects($this->any())
42 ->method('getScheduledEntityInsertions')
43 ->willReturn([]);
44
45 $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy')
46 ->disableOriginalConstructor()
47 ->getMock();
48
49 $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
50 ->disableOriginalConstructor()
51 ->getMock();
52
53 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
54 ->disableOriginalConstructor()
55 ->getMock();
56
57 $dispatcher
58 ->expects($this->exactly($dispatched))
59 ->method('dispatch');
60
61 $import = new InstapaperImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
62
63 $this->logHandler = new TestHandler();
64 $logger = new Logger('test', [$this->logHandler]);
65 $import->setLogger($logger);
66
67 if (false === $unsetUser) {
68 $import->setUser($this->user);
69 }
70
71 return $import;
72 }
73
74 public function testInit() 23 public function testInit()
75 { 24 {
76 $instapaperImport = $this->getInstapaperImport(); 25 $instapaperImport = $this->getInstapaperImport();
77 26
78 $this->assertEquals('Instapaper', $instapaperImport->getName()); 27 $this->assertSame('Instapaper', $instapaperImport->getName());
79 $this->assertNotEmpty($instapaperImport->getUrl()); 28 $this->assertNotEmpty($instapaperImport->getUrl());
80 $this->assertEquals('import.instapaper.description', $instapaperImport->getDescription()); 29 $this->assertSame('import.instapaper.description', $instapaperImport->getDescription());
81 } 30 }
82 31
83 public function testImport() 32 public function testImport()
84 { 33 {
85 $instapaperImport = $this->getInstapaperImport(false, 4); 34 $instapaperImport = $this->getInstapaperImport(false, 4);
86 $instapaperImport->setFilepath(__DIR__.'/../fixtures/instapaper-export.csv'); 35 $instapaperImport->setFilepath(__DIR__ . '/../fixtures/instapaper-export.csv');
87 36
88 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') 37 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
89 ->disableOriginalConstructor() 38 ->disableOriginalConstructor()
@@ -110,13 +59,13 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase
110 $res = $instapaperImport->import(); 59 $res = $instapaperImport->import();
111 60
112 $this->assertTrue($res); 61 $this->assertTrue($res);
113 $this->assertEquals(['skipped' => 0, 'imported' => 4, 'queued' => 0], $instapaperImport->getSummary()); 62 $this->assertSame(['skipped' => 0, 'imported' => 4, 'queued' => 0], $instapaperImport->getSummary());
114 } 63 }
115 64
116 public function testImportAndMarkAllAsRead() 65 public function testImportAndMarkAllAsRead()
117 { 66 {
118 $instapaperImport = $this->getInstapaperImport(false, 1); 67 $instapaperImport = $this->getInstapaperImport(false, 1);
119 $instapaperImport->setFilepath(__DIR__.'/../fixtures/instapaper-export.csv'); 68 $instapaperImport->setFilepath(__DIR__ . '/../fixtures/instapaper-export.csv');
120 69
121 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') 70 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
122 ->disableOriginalConstructor() 71 ->disableOriginalConstructor()
@@ -148,13 +97,13 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase
148 97
149 $this->assertTrue($res); 98 $this->assertTrue($res);
150 99
151 $this->assertEquals(['skipped' => 3, 'imported' => 1, 'queued' => 0], $instapaperImport->getSummary()); 100 $this->assertSame(['skipped' => 3, 'imported' => 1, 'queued' => 0], $instapaperImport->getSummary());
152 } 101 }
153 102
154 public function testImportWithRabbit() 103 public function testImportWithRabbit()
155 { 104 {
156 $instapaperImport = $this->getInstapaperImport(); 105 $instapaperImport = $this->getInstapaperImport();
157 $instapaperImport->setFilepath(__DIR__.'/../fixtures/instapaper-export.csv'); 106 $instapaperImport->setFilepath(__DIR__ . '/../fixtures/instapaper-export.csv');
158 107
159 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') 108 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
160 ->disableOriginalConstructor() 109 ->disableOriginalConstructor()
@@ -188,13 +137,13 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase
188 $res = $instapaperImport->setMarkAsRead(true)->import(); 137 $res = $instapaperImport->setMarkAsRead(true)->import();
189 138
190 $this->assertTrue($res); 139 $this->assertTrue($res);
191 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 4], $instapaperImport->getSummary()); 140 $this->assertSame(['skipped' => 0, 'imported' => 0, 'queued' => 4], $instapaperImport->getSummary());
192 } 141 }
193 142
194 public function testImportWithRedis() 143 public function testImportWithRedis()
195 { 144 {
196 $instapaperImport = $this->getInstapaperImport(); 145 $instapaperImport = $this->getInstapaperImport();
197 $instapaperImport->setFilepath(__DIR__.'/../fixtures/instapaper-export.csv'); 146 $instapaperImport->setFilepath(__DIR__ . '/../fixtures/instapaper-export.csv');
198 147
199 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') 148 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
200 ->disableOriginalConstructor() 149 ->disableOriginalConstructor()
@@ -226,7 +175,7 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase
226 $res = $instapaperImport->setMarkAsRead(true)->import(); 175 $res = $instapaperImport->setMarkAsRead(true)->import();
227 176
228 $this->assertTrue($res); 177 $this->assertTrue($res);
229 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 4], $instapaperImport->getSummary()); 178 $this->assertSame(['skipped' => 0, 'imported' => 0, 'queued' => 4], $instapaperImport->getSummary());
230 179
231 $this->assertNotEmpty($redisMock->lpop('instapaper')); 180 $this->assertNotEmpty($redisMock->lpop('instapaper'));
232 } 181 }
@@ -234,7 +183,7 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase
234 public function testImportBadFile() 183 public function testImportBadFile()
235 { 184 {
236 $instapaperImport = $this->getInstapaperImport(); 185 $instapaperImport = $this->getInstapaperImport();
237 $instapaperImport->setFilepath(__DIR__.'/../fixtures/wallabag-v1.jsonx'); 186 $instapaperImport->setFilepath(__DIR__ . '/../fixtures/wallabag-v1.jsonx');
238 187
239 $res = $instapaperImport->import(); 188 $res = $instapaperImport->import();
240 189
@@ -242,13 +191,13 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase
242 191
243 $records = $this->logHandler->getRecords(); 192 $records = $this->logHandler->getRecords();
244 $this->assertContains('InstapaperImport: unable to read file', $records[0]['message']); 193 $this->assertContains('InstapaperImport: unable to read file', $records[0]['message']);
245 $this->assertEquals('ERROR', $records[0]['level_name']); 194 $this->assertSame('ERROR', $records[0]['level_name']);
246 } 195 }
247 196
248 public function testImportUserNotDefined() 197 public function testImportUserNotDefined()
249 { 198 {
250 $instapaperImport = $this->getInstapaperImport(true); 199 $instapaperImport = $this->getInstapaperImport(true);
251 $instapaperImport->setFilepath(__DIR__.'/../fixtures/instapaper-export.csv'); 200 $instapaperImport->setFilepath(__DIR__ . '/../fixtures/instapaper-export.csv');
252 201
253 $res = $instapaperImport->import(); 202 $res = $instapaperImport->import();
254 203
@@ -256,6 +205,57 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase
256 205
257 $records = $this->logHandler->getRecords(); 206 $records = $this->logHandler->getRecords();
258 $this->assertContains('InstapaperImport: user is not defined', $records[0]['message']); 207 $this->assertContains('InstapaperImport: user is not defined', $records[0]['message']);
259 $this->assertEquals('ERROR', $records[0]['level_name']); 208 $this->assertSame('ERROR', $records[0]['level_name']);
209 }
210
211 private function getInstapaperImport($unsetUser = false, $dispatched = 0)
212 {
213 $this->user = new User();
214
215 $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
216 ->disableOriginalConstructor()
217 ->getMock();
218
219 $this->uow = $this->getMockBuilder('Doctrine\ORM\UnitOfWork')
220 ->disableOriginalConstructor()
221 ->getMock();
222
223 $this->em
224 ->expects($this->any())
225 ->method('getUnitOfWork')
226 ->willReturn($this->uow);
227
228 $this->uow
229 ->expects($this->any())
230 ->method('getScheduledEntityInsertions')
231 ->willReturn([]);
232
233 $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy')
234 ->disableOriginalConstructor()
235 ->getMock();
236
237 $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
238 ->disableOriginalConstructor()
239 ->getMock();
240
241 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
242 ->disableOriginalConstructor()
243 ->getMock();
244
245 $dispatcher
246 ->expects($this->exactly($dispatched))
247 ->method('dispatch');
248
249 $import = new InstapaperImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
250
251 $this->logHandler = new TestHandler();
252 $logger = new Logger('test', [$this->logHandler]);
253 $import->setLogger($logger);
254
255 if (false === $unsetUser) {
256 $import->setUser($this->user);
257 }
258
259 return $import;
260 } 260 }
261} 261}
diff --git a/tests/Wallabag/ImportBundle/Import/PocketImportTest.php b/tests/Wallabag/ImportBundle/Import/PocketImportTest.php
index b81ebe15..fe59f867 100644
--- a/tests/Wallabag/ImportBundle/Import/PocketImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/PocketImportTest.php
@@ -2,19 +2,19 @@
2 2
3namespace Tests\Wallabag\ImportBundle\Import; 3namespace Tests\Wallabag\ImportBundle\Import;
4 4
5use Wallabag\UserBundle\Entity\User;
6use Wallabag\CoreBundle\Entity\Entry;
7use Wallabag\CoreBundle\Entity\Config;
8use Wallabag\ImportBundle\Import\PocketImport;
9use GuzzleHttp\Client; 5use GuzzleHttp\Client;
10use GuzzleHttp\Subscriber\Mock;
11use GuzzleHttp\Message\Response; 6use GuzzleHttp\Message\Response;
12use GuzzleHttp\Stream\Stream; 7use GuzzleHttp\Stream\Stream;
13use Wallabag\ImportBundle\Redis\Producer; 8use GuzzleHttp\Subscriber\Mock;
14use Monolog\Logger; 9use M6Web\Component\RedisMock\RedisMockFactory;
15use Monolog\Handler\TestHandler; 10use Monolog\Handler\TestHandler;
11use Monolog\Logger;
16use Simpleue\Queue\RedisQueue; 12use Simpleue\Queue\RedisQueue;
17use M6Web\Component\RedisMock\RedisMockFactory; 13use Wallabag\CoreBundle\Entity\Config;
14use Wallabag\CoreBundle\Entity\Entry;
15use Wallabag\ImportBundle\Import\PocketImport;
16use Wallabag\ImportBundle\Redis\Producer;
17use Wallabag\UserBundle\Entity\User;
18 18
19class PocketImportTest extends \PHPUnit_Framework_TestCase 19class PocketImportTest extends \PHPUnit_Framework_TestCase
20{ 20{
@@ -26,66 +26,13 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
26 protected $tagsAssigner; 26 protected $tagsAssigner;
27 protected $uow; 27 protected $uow;
28 28
29 private function getPocketImport($consumerKey = 'ConsumerKey', $dispatched = 0)
30 {
31 $this->user = new User();
32
33 $config = new Config($this->user);
34 $config->setPocketConsumerKey('xxx');
35
36 $this->user->setConfig($config);
37
38 $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy')
39 ->disableOriginalConstructor()
40 ->getMock();
41
42 $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
43 ->disableOriginalConstructor()
44 ->getMock();
45
46 $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
47 ->disableOriginalConstructor()
48 ->getMock();
49
50 $this->uow = $this->getMockBuilder('Doctrine\ORM\UnitOfWork')
51 ->disableOriginalConstructor()
52 ->getMock();
53
54 $this->em
55 ->expects($this->any())
56 ->method('getUnitOfWork')
57 ->willReturn($this->uow);
58
59 $this->uow
60 ->expects($this->any())
61 ->method('getScheduledEntityInsertions')
62 ->willReturn([]);
63
64 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
65 ->disableOriginalConstructor()
66 ->getMock();
67
68 $dispatcher
69 ->expects($this->exactly($dispatched))
70 ->method('dispatch');
71
72 $pocket = new PocketImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
73 $pocket->setUser($this->user);
74
75 $this->logHandler = new TestHandler();
76 $logger = new Logger('test', [$this->logHandler]);
77 $pocket->setLogger($logger);
78
79 return $pocket;
80 }
81
82 public function testInit() 29 public function testInit()
83 { 30 {
84 $pocketImport = $this->getPocketImport(); 31 $pocketImport = $this->getPocketImport();
85 32
86 $this->assertEquals('Pocket', $pocketImport->getName()); 33 $this->assertSame('Pocket', $pocketImport->getName());
87 $this->assertNotEmpty($pocketImport->getUrl()); 34 $this->assertNotEmpty($pocketImport->getUrl());
88 $this->assertEquals('import.pocket.description', $pocketImport->getDescription()); 35 $this->assertSame('import.pocket.description', $pocketImport->getDescription());
89 } 36 }
90 37
91 public function testOAuthRequest() 38 public function testOAuthRequest()
@@ -103,7 +50,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
103 50
104 $code = $pocketImport->getRequestToken('http://0.0.0.0/redirect'); 51 $code = $pocketImport->getRequestToken('http://0.0.0.0/redirect');
105 52
106 $this->assertEquals('wunderbar_code', $code); 53 $this->assertSame('wunderbar_code', $code);
107 } 54 }
108 55
109 public function testOAuthRequestBadResponse() 56 public function testOAuthRequestBadResponse()
@@ -125,7 +72,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
125 72
126 $records = $this->logHandler->getRecords(); 73 $records = $this->logHandler->getRecords();
127 $this->assertContains('PocketImport: Failed to request token', $records[0]['message']); 74 $this->assertContains('PocketImport: Failed to request token', $records[0]['message']);
128 $this->assertEquals('ERROR', $records[0]['level_name']); 75 $this->assertSame('ERROR', $records[0]['level_name']);
129 } 76 }
130 77
131 public function testOAuthAuthorize() 78 public function testOAuthAuthorize()
@@ -144,7 +91,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
144 $res = $pocketImport->authorize('wunderbar_code'); 91 $res = $pocketImport->authorize('wunderbar_code');
145 92
146 $this->assertTrue($res); 93 $this->assertTrue($res);
147 $this->assertEquals('wunderbar_token', $pocketImport->getAccessToken()); 94 $this->assertSame('wunderbar_token', $pocketImport->getAccessToken());
148 } 95 }
149 96
150 public function testOAuthAuthorizeBadResponse() 97 public function testOAuthAuthorizeBadResponse()
@@ -166,7 +113,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
166 113
167 $records = $this->logHandler->getRecords(); 114 $records = $this->logHandler->getRecords();
168 $this->assertContains('PocketImport: Failed to authorize client', $records[0]['message']); 115 $this->assertContains('PocketImport: Failed to authorize client', $records[0]['message']);
169 $this->assertEquals('ERROR', $records[0]['level_name']); 116 $this->assertSame('ERROR', $records[0]['level_name']);
170 } 117 }
171 118
172 /** 119 /**
@@ -291,7 +238,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
291 $res = $pocketImport->import(); 238 $res = $pocketImport->import();
292 239
293 $this->assertTrue($res); 240 $this->assertTrue($res);
294 $this->assertEquals(['skipped' => 1, 'imported' => 1, 'queued' => 0], $pocketImport->getSummary()); 241 $this->assertSame(['skipped' => 1, 'imported' => 1, 'queued' => 0], $pocketImport->getSummary());
295 } 242 }
296 243
297 /** 244 /**
@@ -386,7 +333,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
386 $res = $pocketImport->setMarkAsRead(true)->import(); 333 $res = $pocketImport->setMarkAsRead(true)->import();
387 334
388 $this->assertTrue($res); 335 $this->assertTrue($res);
389 $this->assertEquals(['skipped' => 0, 'imported' => 2, 'queued' => 0], $pocketImport->getSummary()); 336 $this->assertSame(['skipped' => 0, 'imported' => 2, 'queued' => 0], $pocketImport->getSummary());
390 } 337 }
391 338
392 /** 339 /**
@@ -425,7 +372,7 @@ JSON;
425 { 372 {
426 "status": 1, 373 "status": 1,
427 "list": { 374 "list": {
428 "229279690": '.$body.' 375 "229279690": ' . $body . '
429 } 376 }
430 } 377 }
431 ')), 378 ')),
@@ -472,7 +419,7 @@ JSON;
472 $res = $pocketImport->setMarkAsRead(true)->import(); 419 $res = $pocketImport->setMarkAsRead(true)->import();
473 420
474 $this->assertTrue($res); 421 $this->assertTrue($res);
475 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 1], $pocketImport->getSummary()); 422 $this->assertSame(['skipped' => 0, 'imported' => 0, 'queued' => 1], $pocketImport->getSummary());
476 } 423 }
477 424
478 /** 425 /**
@@ -511,7 +458,7 @@ JSON;
511 { 458 {
512 "status": 1, 459 "status": 1,
513 "list": { 460 "list": {
514 "229279690": '.$body.' 461 "229279690": ' . $body . '
515 } 462 }
516 } 463 }
517 ')), 464 ')),
@@ -551,7 +498,7 @@ JSON;
551 $res = $pocketImport->setMarkAsRead(true)->import(); 498 $res = $pocketImport->setMarkAsRead(true)->import();
552 499
553 $this->assertTrue($res); 500 $this->assertTrue($res);
554 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 1], $pocketImport->getSummary()); 501 $this->assertSame(['skipped' => 0, 'imported' => 0, 'queued' => 1], $pocketImport->getSummary());
555 502
556 $this->assertNotEmpty($redisMock->lpop('pocket')); 503 $this->assertNotEmpty($redisMock->lpop('pocket'));
557 } 504 }
@@ -577,7 +524,7 @@ JSON;
577 524
578 $records = $this->logHandler->getRecords(); 525 $records = $this->logHandler->getRecords();
579 $this->assertContains('PocketImport: Failed to import', $records[0]['message']); 526 $this->assertContains('PocketImport: Failed to import', $records[0]['message']);
580 $this->assertEquals('ERROR', $records[0]['level_name']); 527 $this->assertSame('ERROR', $records[0]['level_name']);
581 } 528 }
582 529
583 public function testImportWithExceptionFromGraby() 530 public function testImportWithExceptionFromGraby()
@@ -630,6 +577,59 @@ JSON;
630 $res = $pocketImport->import(); 577 $res = $pocketImport->import();
631 578
632 $this->assertTrue($res); 579 $this->assertTrue($res);
633 $this->assertEquals(['skipped' => 0, 'imported' => 1, 'queued' => 0], $pocketImport->getSummary()); 580 $this->assertSame(['skipped' => 0, 'imported' => 1, 'queued' => 0], $pocketImport->getSummary());
581 }
582
583 private function getPocketImport($consumerKey = 'ConsumerKey', $dispatched = 0)
584 {
585 $this->user = new User();
586
587 $config = new Config($this->user);
588 $config->setPocketConsumerKey('xxx');
589
590 $this->user->setConfig($config);
591
592 $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy')
593 ->disableOriginalConstructor()
594 ->getMock();
595
596 $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
597 ->disableOriginalConstructor()
598 ->getMock();
599
600 $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
601 ->disableOriginalConstructor()
602 ->getMock();
603
604 $this->uow = $this->getMockBuilder('Doctrine\ORM\UnitOfWork')
605 ->disableOriginalConstructor()
606 ->getMock();
607
608 $this->em
609 ->expects($this->any())
610 ->method('getUnitOfWork')
611 ->willReturn($this->uow);
612
613 $this->uow
614 ->expects($this->any())
615 ->method('getScheduledEntityInsertions')
616 ->willReturn([]);
617
618 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
619 ->disableOriginalConstructor()
620 ->getMock();
621
622 $dispatcher
623 ->expects($this->exactly($dispatched))
624 ->method('dispatch');
625
626 $pocket = new PocketImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
627 $pocket->setUser($this->user);
628
629 $this->logHandler = new TestHandler();
630 $logger = new Logger('test', [$this->logHandler]);
631 $pocket->setLogger($logger);
632
633 return $pocket;
634 } 634 }
635} 635}
diff --git a/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php b/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php
index 8f466d38..1822cdaa 100644
--- a/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php
@@ -2,14 +2,14 @@
2 2
3namespace Tests\Wallabag\ImportBundle\Import; 3namespace Tests\Wallabag\ImportBundle\Import;
4 4
5use Wallabag\ImportBundle\Import\ReadabilityImport; 5use M6Web\Component\RedisMock\RedisMockFactory;
6use Wallabag\UserBundle\Entity\User;
7use Wallabag\CoreBundle\Entity\Entry;
8use Wallabag\ImportBundle\Redis\Producer;
9use Monolog\Logger;
10use Monolog\Handler\TestHandler; 6use Monolog\Handler\TestHandler;
7use Monolog\Logger;
11use Simpleue\Queue\RedisQueue; 8use Simpleue\Queue\RedisQueue;
12use M6Web\Component\RedisMock\RedisMockFactory; 9use Wallabag\CoreBundle\Entity\Entry;
10use Wallabag\ImportBundle\Import\ReadabilityImport;
11use Wallabag\ImportBundle\Redis\Producer;
12use Wallabag\UserBundle\Entity\User;
13 13
14class ReadabilityImportTest extends \PHPUnit_Framework_TestCase 14class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
15{ 15{
@@ -19,56 +19,19 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
19 protected $contentProxy; 19 protected $contentProxy;
20 protected $tagsAssigner; 20 protected $tagsAssigner;
21 21
22 private function getReadabilityImport($unsetUser = false, $dispatched = 0)
23 {
24 $this->user = new User();
25
26 $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
27 ->disableOriginalConstructor()
28 ->getMock();
29
30 $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy')
31 ->disableOriginalConstructor()
32 ->getMock();
33
34 $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
35 ->disableOriginalConstructor()
36 ->getMock();
37
38 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
39 ->disableOriginalConstructor()
40 ->getMock();
41
42 $dispatcher
43 ->expects($this->exactly($dispatched))
44 ->method('dispatch');
45
46 $wallabag = new ReadabilityImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
47
48 $this->logHandler = new TestHandler();
49 $logger = new Logger('test', [$this->logHandler]);
50 $wallabag->setLogger($logger);
51
52 if (false === $unsetUser) {
53 $wallabag->setUser($this->user);
54 }
55
56 return $wallabag;
57 }
58
59 public function testInit() 22 public function testInit()
60 { 23 {
61 $readabilityImport = $this->getReadabilityImport(); 24 $readabilityImport = $this->getReadabilityImport();
62 25
63 $this->assertEquals('Readability', $readabilityImport->getName()); 26 $this->assertSame('Readability', $readabilityImport->getName());
64 $this->assertNotEmpty($readabilityImport->getUrl()); 27 $this->assertNotEmpty($readabilityImport->getUrl());
65 $this->assertEquals('import.readability.description', $readabilityImport->getDescription()); 28 $this->assertSame('import.readability.description', $readabilityImport->getDescription());
66 } 29 }
67 30
68 public function testImport() 31 public function testImport()
69 { 32 {
70 $readabilityImport = $this->getReadabilityImport(false, 3); 33 $readabilityImport = $this->getReadabilityImport(false, 3);
71 $readabilityImport->setFilepath(__DIR__.'/../fixtures/readability.json'); 34 $readabilityImport->setFilepath(__DIR__ . '/../fixtures/readability.json');
72 35
73 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') 36 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
74 ->disableOriginalConstructor() 37 ->disableOriginalConstructor()
@@ -95,13 +58,13 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
95 $res = $readabilityImport->import(); 58 $res = $readabilityImport->import();
96 59
97 $this->assertTrue($res); 60 $this->assertTrue($res);
98 $this->assertEquals(['skipped' => 0, 'imported' => 3, 'queued' => 0], $readabilityImport->getSummary()); 61 $this->assertSame(['skipped' => 0, 'imported' => 3, 'queued' => 0], $readabilityImport->getSummary());
99 } 62 }
100 63
101 public function testImportAndMarkAllAsRead() 64 public function testImportAndMarkAllAsRead()
102 { 65 {
103 $readabilityImport = $this->getReadabilityImport(false, 1); 66 $readabilityImport = $this->getReadabilityImport(false, 1);
104 $readabilityImport->setFilepath(__DIR__.'/../fixtures/readability-read.json'); 67 $readabilityImport->setFilepath(__DIR__ . '/../fixtures/readability-read.json');
105 68
106 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') 69 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
107 ->disableOriginalConstructor() 70 ->disableOriginalConstructor()
@@ -133,13 +96,13 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
133 96
134 $this->assertTrue($res); 97 $this->assertTrue($res);
135 98
136 $this->assertEquals(['skipped' => 1, 'imported' => 1, 'queued' => 0], $readabilityImport->getSummary()); 99 $this->assertSame(['skipped' => 1, 'imported' => 1, 'queued' => 0], $readabilityImport->getSummary());
137 } 100 }
138 101
139 public function testImportWithRabbit() 102 public function testImportWithRabbit()
140 { 103 {
141 $readabilityImport = $this->getReadabilityImport(); 104 $readabilityImport = $this->getReadabilityImport();
142 $readabilityImport->setFilepath(__DIR__.'/../fixtures/readability.json'); 105 $readabilityImport->setFilepath(__DIR__ . '/../fixtures/readability.json');
143 106
144 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') 107 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
145 ->disableOriginalConstructor() 108 ->disableOriginalConstructor()
@@ -173,13 +136,13 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
173 $res = $readabilityImport->setMarkAsRead(true)->import(); 136 $res = $readabilityImport->setMarkAsRead(true)->import();
174 137
175 $this->assertTrue($res); 138 $this->assertTrue($res);
176 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 3], $readabilityImport->getSummary()); 139 $this->assertSame(['skipped' => 0, 'imported' => 0, 'queued' => 3], $readabilityImport->getSummary());
177 } 140 }
178 141
179 public function testImportWithRedis() 142 public function testImportWithRedis()
180 { 143 {
181 $readabilityImport = $this->getReadabilityImport(); 144 $readabilityImport = $this->getReadabilityImport();
182 $readabilityImport->setFilepath(__DIR__.'/../fixtures/readability.json'); 145 $readabilityImport->setFilepath(__DIR__ . '/../fixtures/readability.json');
183 146
184 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') 147 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
185 ->disableOriginalConstructor() 148 ->disableOriginalConstructor()
@@ -211,7 +174,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
211 $res = $readabilityImport->setMarkAsRead(true)->import(); 174 $res = $readabilityImport->setMarkAsRead(true)->import();
212 175
213 $this->assertTrue($res); 176 $this->assertTrue($res);
214 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 3], $readabilityImport->getSummary()); 177 $this->assertSame(['skipped' => 0, 'imported' => 0, 'queued' => 3], $readabilityImport->getSummary());
215 178
216 $this->assertNotEmpty($redisMock->lpop('readability')); 179 $this->assertNotEmpty($redisMock->lpop('readability'));
217 } 180 }
@@ -219,7 +182,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
219 public function testImportBadFile() 182 public function testImportBadFile()
220 { 183 {
221 $readabilityImport = $this->getReadabilityImport(); 184 $readabilityImport = $this->getReadabilityImport();
222 $readabilityImport->setFilepath(__DIR__.'/../fixtures/wallabag-v1.jsonx'); 185 $readabilityImport->setFilepath(__DIR__ . '/../fixtures/wallabag-v1.jsonx');
223 186
224 $res = $readabilityImport->import(); 187 $res = $readabilityImport->import();
225 188
@@ -227,13 +190,13 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
227 190
228 $records = $this->logHandler->getRecords(); 191 $records = $this->logHandler->getRecords();
229 $this->assertContains('ReadabilityImport: unable to read file', $records[0]['message']); 192 $this->assertContains('ReadabilityImport: unable to read file', $records[0]['message']);
230 $this->assertEquals('ERROR', $records[0]['level_name']); 193 $this->assertSame('ERROR', $records[0]['level_name']);
231 } 194 }
232 195
233 public function testImportUserNotDefined() 196 public function testImportUserNotDefined()
234 { 197 {
235 $readabilityImport = $this->getReadabilityImport(true); 198 $readabilityImport = $this->getReadabilityImport(true);
236 $readabilityImport->setFilepath(__DIR__.'/../fixtures/readability.json'); 199 $readabilityImport->setFilepath(__DIR__ . '/../fixtures/readability.json');
237 200
238 $res = $readabilityImport->import(); 201 $res = $readabilityImport->import();
239 202
@@ -241,6 +204,43 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
241 204
242 $records = $this->logHandler->getRecords(); 205 $records = $this->logHandler->getRecords();
243 $this->assertContains('ReadabilityImport: user is not defined', $records[0]['message']); 206 $this->assertContains('ReadabilityImport: user is not defined', $records[0]['message']);
244 $this->assertEquals('ERROR', $records[0]['level_name']); 207 $this->assertSame('ERROR', $records[0]['level_name']);
208 }
209
210 private function getReadabilityImport($unsetUser = false, $dispatched = 0)
211 {
212 $this->user = new User();
213
214 $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
215 ->disableOriginalConstructor()
216 ->getMock();
217
218 $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy')
219 ->disableOriginalConstructor()
220 ->getMock();
221
222 $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
223 ->disableOriginalConstructor()
224 ->getMock();
225
226 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
227 ->disableOriginalConstructor()
228 ->getMock();
229
230 $dispatcher
231 ->expects($this->exactly($dispatched))
232 ->method('dispatch');
233
234 $wallabag = new ReadabilityImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
235
236 $this->logHandler = new TestHandler();
237 $logger = new Logger('test', [$this->logHandler]);
238 $wallabag->setLogger($logger);
239
240 if (false === $unsetUser) {
241 $wallabag->setUser($this->user);
242 }
243
244 return $wallabag;
245 } 245 }
246} 246}
diff --git a/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php b/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php
index 834b7ef5..822ad694 100644
--- a/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php
@@ -2,14 +2,14 @@
2 2
3namespace Tests\Wallabag\ImportBundle\Import; 3namespace Tests\Wallabag\ImportBundle\Import;
4 4
5use Wallabag\ImportBundle\Import\WallabagV1Import; 5use M6Web\Component\RedisMock\RedisMockFactory;
6use Wallabag\UserBundle\Entity\User;
7use Wallabag\CoreBundle\Entity\Entry;
8use Wallabag\ImportBundle\Redis\Producer;
9use Monolog\Logger;
10use Monolog\Handler\TestHandler; 6use Monolog\Handler\TestHandler;
7use Monolog\Logger;
11use Simpleue\Queue\RedisQueue; 8use Simpleue\Queue\RedisQueue;
12use M6Web\Component\RedisMock\RedisMockFactory; 9use Wallabag\CoreBundle\Entity\Entry;
10use Wallabag\ImportBundle\Import\WallabagV1Import;
11use Wallabag\ImportBundle\Redis\Producer;
12use Wallabag\UserBundle\Entity\User;
13 13
14class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase 14class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
15{ 15{
@@ -22,77 +22,19 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
22 protected $fetchingErrorMessageTitle = 'No title found'; 22 protected $fetchingErrorMessageTitle = 'No title found';
23 protected $fetchingErrorMessage = 'wallabag can\'t retrieve contents for this article. Please <a href="http://doc.wallabag.org/en/master/user/errors_during_fetching.html#how-can-i-help-to-fix-that">troubleshoot this issue</a>.'; 23 protected $fetchingErrorMessage = 'wallabag can\'t retrieve contents for this article. Please <a href="http://doc.wallabag.org/en/master/user/errors_during_fetching.html#how-can-i-help-to-fix-that">troubleshoot this issue</a>.';
24 24
25 private function getWallabagV1Import($unsetUser = false, $dispatched = 0)
26 {
27 $this->user = new User();
28
29 $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
30 ->disableOriginalConstructor()
31 ->getMock();
32
33 $this->uow = $this->getMockBuilder('Doctrine\ORM\UnitOfWork')
34 ->disableOriginalConstructor()
35 ->getMock();
36
37 $this->em
38 ->expects($this->any())
39 ->method('getUnitOfWork')
40 ->willReturn($this->uow);
41
42 $this->uow
43 ->expects($this->any())
44 ->method('getScheduledEntityInsertions')
45 ->willReturn([]);
46
47 $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy')
48 ->disableOriginalConstructor()
49 ->getMock();
50
51 $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
52 ->disableOriginalConstructor()
53 ->getMock();
54
55 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
56 ->disableOriginalConstructor()
57 ->getMock();
58
59 $dispatcher
60 ->expects($this->exactly($dispatched))
61 ->method('dispatch');
62
63 $wallabag = new WallabagV1Import(
64 $this->em,
65 $this->contentProxy,
66 $this->tagsAssigner,
67 $dispatcher,
68 $this->fetchingErrorMessageTitle,
69 $this->fetchingErrorMessage
70 );
71
72 $this->logHandler = new TestHandler();
73 $logger = new Logger('test', [$this->logHandler]);
74 $wallabag->setLogger($logger);
75
76 if (false === $unsetUser) {
77 $wallabag->setUser($this->user);
78 }
79
80 return $wallabag;
81 }
82
83 public function testInit() 25 public function testInit()
84 { 26 {
85 $wallabagV1Import = $this->getWallabagV1Import(); 27 $wallabagV1Import = $this->getWallabagV1Import();
86 28
87 $this->assertEquals('wallabag v1', $wallabagV1Import->getName()); 29 $this->assertSame('wallabag v1', $wallabagV1Import->getName());
88 $this->assertNotEmpty($wallabagV1Import->getUrl()); 30 $this->assertNotEmpty($wallabagV1Import->getUrl());
89 $this->assertEquals('import.wallabag_v1.description', $wallabagV1Import->getDescription()); 31 $this->assertSame('import.wallabag_v1.description', $wallabagV1Import->getDescription());
90 } 32 }
91 33
92 public function testImport() 34 public function testImport()
93 { 35 {
94 $wallabagV1Import = $this->getWallabagV1Import(false, 1); 36 $wallabagV1Import = $this->getWallabagV1Import(false, 1);
95 $wallabagV1Import->setFilepath(__DIR__.'/../fixtures/wallabag-v1.json'); 37 $wallabagV1Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v1.json');
96 38
97 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') 39 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
98 ->disableOriginalConstructor() 40 ->disableOriginalConstructor()
@@ -119,13 +61,13 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
119 $res = $wallabagV1Import->import(); 61 $res = $wallabagV1Import->import();
120 62
121 $this->assertTrue($res); 63 $this->assertTrue($res);
122 $this->assertEquals(['skipped' => 1, 'imported' => 1, 'queued' => 0], $wallabagV1Import->getSummary()); 64 $this->assertSame(['skipped' => 1, 'imported' => 1, 'queued' => 0], $wallabagV1Import->getSummary());
123 } 65 }
124 66
125 public function testImportAndMarkAllAsRead() 67 public function testImportAndMarkAllAsRead()
126 { 68 {
127 $wallabagV1Import = $this->getWallabagV1Import(false, 3); 69 $wallabagV1Import = $this->getWallabagV1Import(false, 3);
128 $wallabagV1Import->setFilepath(__DIR__.'/../fixtures/wallabag-v1-read.json'); 70 $wallabagV1Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v1-read.json');
129 71
130 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') 72 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
131 ->disableOriginalConstructor() 73 ->disableOriginalConstructor()
@@ -157,13 +99,13 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
157 99
158 $this->assertTrue($res); 100 $this->assertTrue($res);
159 101
160 $this->assertEquals(['skipped' => 0, 'imported' => 3, 'queued' => 0], $wallabagV1Import->getSummary()); 102 $this->assertSame(['skipped' => 0, 'imported' => 3, 'queued' => 0], $wallabagV1Import->getSummary());
161 } 103 }
162 104
163 public function testImportWithRabbit() 105 public function testImportWithRabbit()
164 { 106 {
165 $wallabagV1Import = $this->getWallabagV1Import(); 107 $wallabagV1Import = $this->getWallabagV1Import();
166 $wallabagV1Import->setFilepath(__DIR__.'/../fixtures/wallabag-v1.json'); 108 $wallabagV1Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v1.json');
167 109
168 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') 110 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
169 ->disableOriginalConstructor() 111 ->disableOriginalConstructor()
@@ -197,13 +139,13 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
197 $res = $wallabagV1Import->setMarkAsRead(true)->import(); 139 $res = $wallabagV1Import->setMarkAsRead(true)->import();
198 140
199 $this->assertTrue($res); 141 $this->assertTrue($res);
200 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 2], $wallabagV1Import->getSummary()); 142 $this->assertSame(['skipped' => 0, 'imported' => 0, 'queued' => 2], $wallabagV1Import->getSummary());
201 } 143 }
202 144
203 public function testImportWithRedis() 145 public function testImportWithRedis()
204 { 146 {
205 $wallabagV1Import = $this->getWallabagV1Import(); 147 $wallabagV1Import = $this->getWallabagV1Import();
206 $wallabagV1Import->setFilepath(__DIR__.'/../fixtures/wallabag-v1.json'); 148 $wallabagV1Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v1.json');
207 149
208 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') 150 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
209 ->disableOriginalConstructor() 151 ->disableOriginalConstructor()
@@ -235,7 +177,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
235 $res = $wallabagV1Import->setMarkAsRead(true)->import(); 177 $res = $wallabagV1Import->setMarkAsRead(true)->import();
236 178
237 $this->assertTrue($res); 179 $this->assertTrue($res);
238 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 2], $wallabagV1Import->getSummary()); 180 $this->assertSame(['skipped' => 0, 'imported' => 0, 'queued' => 2], $wallabagV1Import->getSummary());
239 181
240 $this->assertNotEmpty($redisMock->lpop('wallabag_v1')); 182 $this->assertNotEmpty($redisMock->lpop('wallabag_v1'));
241 } 183 }
@@ -243,7 +185,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
243 public function testImportBadFile() 185 public function testImportBadFile()
244 { 186 {
245 $wallabagV1Import = $this->getWallabagV1Import(); 187 $wallabagV1Import = $this->getWallabagV1Import();
246 $wallabagV1Import->setFilepath(__DIR__.'/../fixtures/wallabag-v1.jsonx'); 188 $wallabagV1Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v1.jsonx');
247 189
248 $res = $wallabagV1Import->import(); 190 $res = $wallabagV1Import->import();
249 191
@@ -251,13 +193,13 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
251 193
252 $records = $this->logHandler->getRecords(); 194 $records = $this->logHandler->getRecords();
253 $this->assertContains('WallabagImport: unable to read file', $records[0]['message']); 195 $this->assertContains('WallabagImport: unable to read file', $records[0]['message']);
254 $this->assertEquals('ERROR', $records[0]['level_name']); 196 $this->assertSame('ERROR', $records[0]['level_name']);
255 } 197 }
256 198
257 public function testImportUserNotDefined() 199 public function testImportUserNotDefined()
258 { 200 {
259 $wallabagV1Import = $this->getWallabagV1Import(true); 201 $wallabagV1Import = $this->getWallabagV1Import(true);
260 $wallabagV1Import->setFilepath(__DIR__.'/../fixtures/wallabag-v1.json'); 202 $wallabagV1Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v1.json');
261 203
262 $res = $wallabagV1Import->import(); 204 $res = $wallabagV1Import->import();
263 205
@@ -265,6 +207,64 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
265 207
266 $records = $this->logHandler->getRecords(); 208 $records = $this->logHandler->getRecords();
267 $this->assertContains('WallabagImport: user is not defined', $records[0]['message']); 209 $this->assertContains('WallabagImport: user is not defined', $records[0]['message']);
268 $this->assertEquals('ERROR', $records[0]['level_name']); 210 $this->assertSame('ERROR', $records[0]['level_name']);
211 }
212
213 private function getWallabagV1Import($unsetUser = false, $dispatched = 0)
214 {
215 $this->user = new User();
216
217 $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
218 ->disableOriginalConstructor()
219 ->getMock();
220
221 $this->uow = $this->getMockBuilder('Doctrine\ORM\UnitOfWork')
222 ->disableOriginalConstructor()
223 ->getMock();
224
225 $this->em
226 ->expects($this->any())
227 ->method('getUnitOfWork')
228 ->willReturn($this->uow);
229
230 $this->uow
231 ->expects($this->any())
232 ->method('getScheduledEntityInsertions')
233 ->willReturn([]);
234
235 $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy')
236 ->disableOriginalConstructor()
237 ->getMock();
238
239 $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
240 ->disableOriginalConstructor()
241 ->getMock();
242
243 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
244 ->disableOriginalConstructor()
245 ->getMock();
246
247 $dispatcher
248 ->expects($this->exactly($dispatched))
249 ->method('dispatch');
250
251 $wallabag = new WallabagV1Import(
252 $this->em,
253 $this->contentProxy,
254 $this->tagsAssigner,
255 $dispatcher,
256 $this->fetchingErrorMessageTitle,
257 $this->fetchingErrorMessage
258 );
259
260 $this->logHandler = new TestHandler();
261 $logger = new Logger('test', [$this->logHandler]);
262 $wallabag->setLogger($logger);
263
264 if (false === $unsetUser) {
265 $wallabag->setUser($this->user);
266 }
267
268 return $wallabag;
269 } 269 }
270} 270}
diff --git a/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php b/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php
index 5cc04aa5..fab50a45 100644
--- a/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php
@@ -2,14 +2,14 @@
2 2
3namespace Tests\Wallabag\ImportBundle\Import; 3namespace Tests\Wallabag\ImportBundle\Import;
4 4
5use Wallabag\ImportBundle\Import\WallabagV2Import; 5use M6Web\Component\RedisMock\RedisMockFactory;
6use Wallabag\UserBundle\Entity\User;
7use Wallabag\CoreBundle\Entity\Entry;
8use Wallabag\ImportBundle\Redis\Producer;
9use Monolog\Logger;
10use Monolog\Handler\TestHandler; 6use Monolog\Handler\TestHandler;
7use Monolog\Logger;
11use Simpleue\Queue\RedisQueue; 8use Simpleue\Queue\RedisQueue;
12use M6Web\Component\RedisMock\RedisMockFactory; 9use Wallabag\CoreBundle\Entity\Entry;
10use Wallabag\ImportBundle\Import\WallabagV2Import;
11use Wallabag\ImportBundle\Redis\Producer;
12use Wallabag\UserBundle\Entity\User;
13 13
14class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase 14class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
15{ 15{
@@ -20,70 +20,19 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
20 protected $tagsAssigner; 20 protected $tagsAssigner;
21 protected $uow; 21 protected $uow;
22 22
23 private function getWallabagV2Import($unsetUser = false, $dispatched = 0)
24 {
25 $this->user = new User();
26
27 $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
28 ->disableOriginalConstructor()
29 ->getMock();
30
31 $this->uow = $this->getMockBuilder('Doctrine\ORM\UnitOfWork')
32 ->disableOriginalConstructor()
33 ->getMock();
34
35 $this->em
36 ->expects($this->any())
37 ->method('getUnitOfWork')
38 ->willReturn($this->uow);
39
40 $this->uow
41 ->expects($this->any())
42 ->method('getScheduledEntityInsertions')
43 ->willReturn([]);
44
45 $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy')
46 ->disableOriginalConstructor()
47 ->getMock();
48
49 $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
50 ->disableOriginalConstructor()
51 ->getMock();
52
53 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
54 ->disableOriginalConstructor()
55 ->getMock();
56
57 $dispatcher
58 ->expects($this->exactly($dispatched))
59 ->method('dispatch');
60
61 $wallabag = new WallabagV2Import($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
62
63 $this->logHandler = new TestHandler();
64 $logger = new Logger('test', [$this->logHandler]);
65 $wallabag->setLogger($logger);
66
67 if (false === $unsetUser) {
68 $wallabag->setUser($this->user);
69 }
70
71 return $wallabag;
72 }
73
74 public function testInit() 23 public function testInit()
75 { 24 {
76 $wallabagV2Import = $this->getWallabagV2Import(); 25 $wallabagV2Import = $this->getWallabagV2Import();
77 26
78 $this->assertEquals('wallabag v2', $wallabagV2Import->getName()); 27 $this->assertSame('wallabag v2', $wallabagV2Import->getName());
79 $this->assertNotEmpty($wallabagV2Import->getUrl()); 28 $this->assertNotEmpty($wallabagV2Import->getUrl());
80 $this->assertEquals('import.wallabag_v2.description', $wallabagV2Import->getDescription()); 29 $this->assertSame('import.wallabag_v2.description', $wallabagV2Import->getDescription());
81 } 30 }
82 31
83 public function testImport() 32 public function testImport()
84 { 33 {
85 $wallabagV2Import = $this->getWallabagV2Import(false, 2); 34 $wallabagV2Import = $this->getWallabagV2Import(false, 2);
86 $wallabagV2Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2.json'); 35 $wallabagV2Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v2.json');
87 36
88 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') 37 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
89 ->disableOriginalConstructor() 38 ->disableOriginalConstructor()
@@ -106,13 +55,13 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
106 $res = $wallabagV2Import->import(); 55 $res = $wallabagV2Import->import();
107 56
108 $this->assertTrue($res); 57 $this->assertTrue($res);
109 $this->assertEquals(['skipped' => 4, 'imported' => 2, 'queued' => 0], $wallabagV2Import->getSummary()); 58 $this->assertSame(['skipped' => 4, 'imported' => 2, 'queued' => 0], $wallabagV2Import->getSummary());
110 } 59 }
111 60
112 public function testImportAndMarkAllAsRead() 61 public function testImportAndMarkAllAsRead()
113 { 62 {
114 $wallabagV2Import = $this->getWallabagV2Import(false, 2); 63 $wallabagV2Import = $this->getWallabagV2Import(false, 2);
115 $wallabagV2Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2-read.json'); 64 $wallabagV2Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v2-read.json');
116 65
117 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') 66 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
118 ->disableOriginalConstructor() 67 ->disableOriginalConstructor()
@@ -144,13 +93,13 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
144 93
145 $this->assertTrue($res); 94 $this->assertTrue($res);
146 95
147 $this->assertEquals(['skipped' => 0, 'imported' => 2, 'queued' => 0], $wallabagV2Import->getSummary()); 96 $this->assertSame(['skipped' => 0, 'imported' => 2, 'queued' => 0], $wallabagV2Import->getSummary());
148 } 97 }
149 98
150 public function testImportWithRabbit() 99 public function testImportWithRabbit()
151 { 100 {
152 $wallabagV2Import = $this->getWallabagV2Import(); 101 $wallabagV2Import = $this->getWallabagV2Import();
153 $wallabagV2Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2.json'); 102 $wallabagV2Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v2.json');
154 103
155 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') 104 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
156 ->disableOriginalConstructor() 105 ->disableOriginalConstructor()
@@ -180,13 +129,13 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
180 $res = $wallabagV2Import->setMarkAsRead(true)->import(); 129 $res = $wallabagV2Import->setMarkAsRead(true)->import();
181 130
182 $this->assertTrue($res); 131 $this->assertTrue($res);
183 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 6], $wallabagV2Import->getSummary()); 132 $this->assertSame(['skipped' => 0, 'imported' => 0, 'queued' => 6], $wallabagV2Import->getSummary());
184 } 133 }
185 134
186 public function testImportWithRedis() 135 public function testImportWithRedis()
187 { 136 {
188 $wallabagV2Import = $this->getWallabagV2Import(); 137 $wallabagV2Import = $this->getWallabagV2Import();
189 $wallabagV2Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2.json'); 138 $wallabagV2Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v2.json');
190 139
191 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') 140 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
192 ->disableOriginalConstructor() 141 ->disableOriginalConstructor()
@@ -214,7 +163,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
214 $res = $wallabagV2Import->setMarkAsRead(true)->import(); 163 $res = $wallabagV2Import->setMarkAsRead(true)->import();
215 164
216 $this->assertTrue($res); 165 $this->assertTrue($res);
217 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 6], $wallabagV2Import->getSummary()); 166 $this->assertSame(['skipped' => 0, 'imported' => 0, 'queued' => 6], $wallabagV2Import->getSummary());
218 167
219 $this->assertNotEmpty($redisMock->lpop('wallabag_v2')); 168 $this->assertNotEmpty($redisMock->lpop('wallabag_v2'));
220 } 169 }
@@ -222,7 +171,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
222 public function testImportBadFile() 171 public function testImportBadFile()
223 { 172 {
224 $wallabagV1Import = $this->getWallabagV2Import(); 173 $wallabagV1Import = $this->getWallabagV2Import();
225 $wallabagV1Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2.jsonx'); 174 $wallabagV1Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v2.jsonx');
226 175
227 $res = $wallabagV1Import->import(); 176 $res = $wallabagV1Import->import();
228 177
@@ -230,13 +179,13 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
230 179
231 $records = $this->logHandler->getRecords(); 180 $records = $this->logHandler->getRecords();
232 $this->assertContains('WallabagImport: unable to read file', $records[0]['message']); 181 $this->assertContains('WallabagImport: unable to read file', $records[0]['message']);
233 $this->assertEquals('ERROR', $records[0]['level_name']); 182 $this->assertSame('ERROR', $records[0]['level_name']);
234 } 183 }
235 184
236 public function testImportUserNotDefined() 185 public function testImportUserNotDefined()
237 { 186 {
238 $wallabagV1Import = $this->getWallabagV2Import(true); 187 $wallabagV1Import = $this->getWallabagV2Import(true);
239 $wallabagV1Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2.json'); 188 $wallabagV1Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v2.json');
240 189
241 $res = $wallabagV1Import->import(); 190 $res = $wallabagV1Import->import();
242 191
@@ -244,24 +193,24 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
244 193
245 $records = $this->logHandler->getRecords(); 194 $records = $this->logHandler->getRecords();
246 $this->assertContains('WallabagImport: user is not defined', $records[0]['message']); 195 $this->assertContains('WallabagImport: user is not defined', $records[0]['message']);
247 $this->assertEquals('ERROR', $records[0]['level_name']); 196 $this->assertSame('ERROR', $records[0]['level_name']);
248 } 197 }
249 198
250 public function testImportEmptyFile() 199 public function testImportEmptyFile()
251 { 200 {
252 $wallabagV2Import = $this->getWallabagV2Import(); 201 $wallabagV2Import = $this->getWallabagV2Import();
253 $wallabagV2Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2-empty.json'); 202 $wallabagV2Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v2-empty.json');
254 203
255 $res = $wallabagV2Import->import(); 204 $res = $wallabagV2Import->import();
256 205
257 $this->assertFalse($res); 206 $this->assertFalse($res);
258 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 0], $wallabagV2Import->getSummary()); 207 $this->assertSame(['skipped' => 0, 'imported' => 0, 'queued' => 0], $wallabagV2Import->getSummary());
259 } 208 }
260 209
261 public function testImportWithExceptionFromGraby() 210 public function testImportWithExceptionFromGraby()
262 { 211 {
263 $wallabagV2Import = $this->getWallabagV2Import(false, 2); 212 $wallabagV2Import = $this->getWallabagV2Import(false, 2);
264 $wallabagV2Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2.json'); 213 $wallabagV2Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v2.json');
265 214
266 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') 215 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
267 ->disableOriginalConstructor() 216 ->disableOriginalConstructor()
@@ -284,6 +233,57 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
284 $res = $wallabagV2Import->import(); 233 $res = $wallabagV2Import->import();
285 234
286 $this->assertTrue($res); 235 $this->assertTrue($res);
287 $this->assertEquals(['skipped' => 4, 'imported' => 2, 'queued' => 0], $wallabagV2Import->getSummary()); 236 $this->assertSame(['skipped' => 4, 'imported' => 2, 'queued' => 0], $wallabagV2Import->getSummary());
237 }
238
239 private function getWallabagV2Import($unsetUser = false, $dispatched = 0)
240 {
241 $this->user = new User();
242
243 $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
244 ->disableOriginalConstructor()
245 ->getMock();
246
247 $this->uow = $this->getMockBuilder('Doctrine\ORM\UnitOfWork')
248 ->disableOriginalConstructor()
249 ->getMock();
250
251 $this->em
252 ->expects($this->any())
253 ->method('getUnitOfWork')
254 ->willReturn($this->uow);
255
256 $this->uow
257 ->expects($this->any())
258 ->method('getScheduledEntityInsertions')
259 ->willReturn([]);
260
261 $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy')
262 ->disableOriginalConstructor()
263 ->getMock();
264
265 $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
266 ->disableOriginalConstructor()
267 ->getMock();
268
269 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
270 ->disableOriginalConstructor()
271 ->getMock();
272
273 $dispatcher
274 ->expects($this->exactly($dispatched))
275 ->method('dispatch');
276
277 $wallabag = new WallabagV2Import($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
278
279 $this->logHandler = new TestHandler();
280 $logger = new Logger('test', [$this->logHandler]);
281 $wallabag->setLogger($logger);
282
283 if (false === $unsetUser) {
284 $wallabag->setUser($this->user);
285 }
286
287 return $wallabag;
288 } 288 }
289} 289}
diff --git a/tests/Wallabag/UserBundle/Controller/ManageControllerTest.php b/tests/Wallabag/UserBundle/Controller/ManageControllerTest.php
index b46256a6..adc2cf09 100644
--- a/tests/Wallabag/UserBundle/Controller/ManageControllerTest.php
+++ b/tests/Wallabag/UserBundle/Controller/ManageControllerTest.php
@@ -12,7 +12,7 @@ class ManageControllerTest extends WallabagCoreTestCase
12 12
13 $client->request('GET', '/users/list'); 13 $client->request('GET', '/users/list');
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,16 +23,16 @@ class ManageControllerTest extends WallabagCoreTestCase
23 23
24 // Create a new user in the database 24 // Create a new user in the database
25 $crawler = $client->request('GET', '/users/list'); 25 $crawler = $client->request('GET', '/users/list');
26 $this->assertEquals(200, $client->getResponse()->getStatusCode(), 'Unexpected HTTP status code for GET /users/'); 26 $this->assertSame(200, $client->getResponse()->getStatusCode(), 'Unexpected HTTP status code for GET /users/');
27 $crawler = $client->click($crawler->selectLink('user.list.create_new_one')->link()); 27 $crawler = $client->click($crawler->selectLink('user.list.create_new_one')->link());
28 28
29 // Fill in the form and submit it 29 // Fill in the form and submit it
30 $form = $crawler->selectButton('user.form.save')->form(array( 30 $form = $crawler->selectButton('user.form.save')->form([
31 'new_user[username]' => 'test_user', 31 'new_user[username]' => 'test_user',
32 'new_user[email]' => 'test@test.io', 32 'new_user[email]' => 'test@test.io',
33 'new_user[plainPassword][first]' => 'testtest', 33 'new_user[plainPassword][first]' => 'testtest',
34 'new_user[plainPassword][second]' => 'testtest', 34 'new_user[plainPassword][second]' => 'testtest',
35 )); 35 ]);
36 36
37 $client->submit($form); 37 $client->submit($form);
38 $client->followRedirect(); 38 $client->followRedirect();
@@ -44,12 +44,12 @@ class ManageControllerTest extends WallabagCoreTestCase
44 // Edit the user 44 // Edit the user
45 $crawler = $client->click($crawler->selectLink('user.list.edit_action')->last()->link()); 45 $crawler = $client->click($crawler->selectLink('user.list.edit_action')->last()->link());
46 46
47 $form = $crawler->selectButton('user.form.save')->form(array( 47 $form = $crawler->selectButton('user.form.save')->form([
48 'user[name]' => 'Foo User', 48 'user[name]' => 'Foo User',
49 'user[username]' => 'test_user', 49 'user[username]' => 'test_user',
50 'user[email]' => 'test@test.io', 50 'user[email]' => 'test@test.io',
51 'user[enabled]' => true, 51 'user[enabled]' => true,
52 )); 52 ]);
53 53
54 $client->submit($form); 54 $client->submit($form);
55 $crawler = $client->followRedirect(); 55 $crawler = $client->followRedirect();
@@ -73,10 +73,10 @@ class ManageControllerTest extends WallabagCoreTestCase
73 $this->logInAs('admin'); 73 $this->logInAs('admin');
74 $client = $this->getClient(); 74 $client = $this->getClient();
75 75
76 $crawler = $client->request('GET', '/users/'.$this->getLoggedInUserId().'/edit'); 76 $crawler = $client->request('GET', '/users/' . $this->getLoggedInUserId() . '/edit');
77 $disabled = $crawler->selectButton('user.form.delete')->extract('disabled'); 77 $disabled = $crawler->selectButton('user.form.delete')->extract('disabled');
78 78
79 $this->assertEquals('disabled', $disabled[0]); 79 $this->assertSame('disabled', $disabled[0]);
80 } 80 }
81 81
82 public function testUserSearch() 82 public function testUserSearch()
diff --git a/tests/Wallabag/UserBundle/EventListener/AuthenticationFailureListenerTest.php b/tests/Wallabag/UserBundle/EventListener/AuthenticationFailureListenerTest.php
index 6191ea13..9e33cdca 100644
--- a/tests/Wallabag/UserBundle/EventListener/AuthenticationFailureListenerTest.php
+++ b/tests/Wallabag/UserBundle/EventListener/AuthenticationFailureListenerTest.php
@@ -2,14 +2,14 @@
2 2
3namespace Tests\Wallabag\UserBundle\EventListener; 3namespace Tests\Wallabag\UserBundle\EventListener;
4 4
5use Monolog\Handler\TestHandler;
6use Monolog\Logger;
5use Symfony\Component\EventDispatcher\EventDispatcher; 7use Symfony\Component\EventDispatcher\EventDispatcher;
6use Symfony\Component\HttpFoundation\Request; 8use Symfony\Component\HttpFoundation\Request;
7use Wallabag\UserBundle\EventListener\AuthenticationFailureListener;
8use Monolog\Logger;
9use Monolog\Handler\TestHandler;
10use Symfony\Component\HttpFoundation\RequestStack; 9use Symfony\Component\HttpFoundation\RequestStack;
11use Symfony\Component\Security\Core\AuthenticationEvents; 10use Symfony\Component\Security\Core\AuthenticationEvents;
12use Symfony\Component\Security\Core\Event\AuthenticationFailureEvent; 11use Symfony\Component\Security\Core\Event\AuthenticationFailureEvent;
12use Wallabag\UserBundle\EventListener\AuthenticationFailureListener;
13 13
14class AuthenticationFailureListenerTest extends \PHPUnit_Framework_TestCase 14class AuthenticationFailureListenerTest extends \PHPUnit_Framework_TestCase
15{ 15{
diff --git a/tests/Wallabag/UserBundle/EventListener/CreateConfigListenerTest.php b/tests/Wallabag/UserBundle/EventListener/CreateConfigListenerTest.php
index 01796ded..e5a145b8 100644
--- a/tests/Wallabag/UserBundle/EventListener/CreateConfigListenerTest.php
+++ b/tests/Wallabag/UserBundle/EventListener/CreateConfigListenerTest.php
@@ -8,8 +8,8 @@ use Symfony\Component\EventDispatcher\EventDispatcher;
8use Symfony\Component\HttpFoundation\Request; 8use Symfony\Component\HttpFoundation\Request;
9use Symfony\Component\HttpFoundation\Response; 9use Symfony\Component\HttpFoundation\Response;
10use Wallabag\CoreBundle\Entity\Config; 10use Wallabag\CoreBundle\Entity\Config;
11use Wallabag\UserBundle\EventListener\CreateConfigListener;
12use Wallabag\UserBundle\Entity\User; 11use Wallabag\UserBundle\Entity\User;
12use Wallabag\UserBundle\EventListener\CreateConfigListener;
13 13
14class CreateConfigListenerTest extends \PHPUnit_Framework_TestCase 14class CreateConfigListenerTest extends \PHPUnit_Framework_TestCase
15{ 15{
diff --git a/tests/Wallabag/UserBundle/Mailer/AuthCodeMailerTest.php b/tests/Wallabag/UserBundle/Mailer/AuthCodeMailerTest.php
index 21412da6..7381ccf1 100644
--- a/tests/Wallabag/UserBundle/Mailer/AuthCodeMailerTest.php
+++ b/tests/Wallabag/UserBundle/Mailer/AuthCodeMailerTest.php
@@ -68,8 +68,8 @@ TWIG;
68 68
69 $msg = $this->spool->getMessages()[0]; 69 $msg = $this->spool->getMessages()[0];
70 $this->assertArrayHasKey('test@wallabag.io', $msg->getTo()); 70 $this->assertArrayHasKey('test@wallabag.io', $msg->getTo());
71 $this->assertEquals(['nobody@test.io' => 'wallabag test'], $msg->getFrom()); 71 $this->assertSame(['nobody@test.io' => 'wallabag test'], $msg->getFrom());
72 $this->assertEquals('subject', $msg->getSubject()); 72 $this->assertSame('subject', $msg->getSubject());
73 $this->assertContains('text body http://0.0.0.0/support', $msg->toString()); 73 $this->assertContains('text body http://0.0.0.0/support', $msg->toString());
74 $this->assertContains('html body 666666', $msg->toString()); 74 $this->assertContains('html body 666666', $msg->toString());
75 } 75 }