diff options
Diffstat (limited to 'tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php')
-rw-r--r-- | tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php | 296 |
1 files changed, 148 insertions, 148 deletions
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 | } |