aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/ApiBundle/Controller
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/ApiBundle/Controller
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/ApiBundle/Controller')
-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
5 files changed, 208 insertions, 208 deletions
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}