aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ApiBundle/Tests/Controller
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-04-12 11:36:01 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-04-12 12:25:29 +0200
commit4094ea47712efbe58624ff74daeb1f77c9b0edcf (patch)
tree3d2c168092d0208e6ba888de969252a54bf0c6c1 /src/Wallabag/ApiBundle/Tests/Controller
parent7eccbda99f16dc39ee01a0c81ab88293e9b268fd (diff)
downloadwallabag-4094ea47712efbe58624ff74daeb1f77c9b0edcf.tar.gz
wallabag-4094ea47712efbe58624ff74daeb1f77c9b0edcf.tar.zst
wallabag-4094ea47712efbe58624ff74daeb1f77c9b0edcf.zip
Convert array + phpDoc
Thanks for https://github.com/thomasbachem/php-short-array-syntax-converter
Diffstat (limited to 'src/Wallabag/ApiBundle/Tests/Controller')
-rw-r--r--src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php b/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php
index 04875f29..839ff386 100644
--- a/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php
+++ b/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php
@@ -13,7 +13,7 @@ class WallabagRestControllerTest extends WallabagApiTestCase
13 $entry = $this->client->getContainer() 13 $entry = $this->client->getContainer()
14 ->get('doctrine.orm.entity_manager') 14 ->get('doctrine.orm.entity_manager')
15 ->getRepository('WallabagCoreBundle:Entry') 15 ->getRepository('WallabagCoreBundle:Entry')
16 ->findOneBy(array('user' => 1, 'isArchived' => false)); 16 ->findOneBy(['user' => 1, 'isArchived' => false]);
17 17
18 if (!$entry) { 18 if (!$entry) {
19 $this->markTestSkipped('No content found in db.'); 19 $this->markTestSkipped('No content found in db.');
@@ -44,7 +44,7 @@ class WallabagRestControllerTest extends WallabagApiTestCase
44 $entry = $this->client->getContainer() 44 $entry = $this->client->getContainer()
45 ->get('doctrine.orm.entity_manager') 45 ->get('doctrine.orm.entity_manager')
46 ->getRepository('WallabagCoreBundle:Entry') 46 ->getRepository('WallabagCoreBundle:Entry')
47 ->findOneBy(array('user' => 2, 'isArchived' => false)); 47 ->findOneBy(['user' => 2, 'isArchived' => false]);
48 48
49 if (!$entry) { 49 if (!$entry) {
50 $this->markTestSkipped('No content found in db.'); 50 $this->markTestSkipped('No content found in db.');
@@ -79,7 +79,7 @@ class WallabagRestControllerTest extends WallabagApiTestCase
79 79
80 public function testGetStarredEntries() 80 public function testGetStarredEntries()
81 { 81 {
82 $this->client->request('GET', '/api/entries', array('star' => 1, 'sort' => 'updated')); 82 $this->client->request('GET', '/api/entries', ['star' => 1, 'sort' => 'updated']);
83 83
84 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 84 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
85 85
@@ -101,7 +101,7 @@ class WallabagRestControllerTest extends WallabagApiTestCase
101 101
102 public function testGetArchiveEntries() 102 public function testGetArchiveEntries()
103 { 103 {
104 $this->client->request('GET', '/api/entries', array('archive' => 1)); 104 $this->client->request('GET', '/api/entries', ['archive' => 1]);
105 105
106 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 106 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
107 107
@@ -149,10 +149,10 @@ class WallabagRestControllerTest extends WallabagApiTestCase
149 149
150 public function testPostEntry() 150 public function testPostEntry()
151 { 151 {
152 $this->client->request('POST', '/api/entries.json', array( 152 $this->client->request('POST', '/api/entries.json', [
153 'url' => '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', 153 'url' => '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',
154 'tags' => 'google', 154 'tags' => 'google',
155 )); 155 ]);
156 156
157 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 157 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
158 158
@@ -168,11 +168,11 @@ class WallabagRestControllerTest extends WallabagApiTestCase
168 168
169 public function testPostSameEntry() 169 public function testPostSameEntry()
170 { 170 {
171 $this->client->request('POST', '/api/entries.json', array( 171 $this->client->request('POST', '/api/entries.json', [
172 'url' => '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', 172 'url' => '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',
173 'archive' => '1', 173 'archive' => '1',
174 'tags' => 'google, apple', 174 'tags' => 'google, apple',
175 )); 175 ]);
176 176
177 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 177 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
178 178
@@ -187,11 +187,11 @@ class WallabagRestControllerTest extends WallabagApiTestCase
187 187
188 public function testPostArchivedAndStarredEntry() 188 public function testPostArchivedAndStarredEntry()
189 { 189 {
190 $this->client->request('POST', '/api/entries.json', array( 190 $this->client->request('POST', '/api/entries.json', [
191 'url' => 'http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', 191 'url' => 'http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html',
192 'archive' => '1', 192 'archive' => '1',
193 'starred' => '1', 193 'starred' => '1',
194 )); 194 ]);
195 195
196 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 196 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
197 197
@@ -206,11 +206,11 @@ class WallabagRestControllerTest extends WallabagApiTestCase
206 206
207 public function testPostArchivedAndStarredEntryWithoutQuotes() 207 public function testPostArchivedAndStarredEntryWithoutQuotes()
208 { 208 {
209 $this->client->request('POST', '/api/entries.json', array( 209 $this->client->request('POST', '/api/entries.json', [
210 'url' => 'http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', 210 'url' => 'http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html',
211 'archive' => 0, 211 'archive' => 0,
212 'starred' => 1, 212 'starred' => 1,
213 )); 213 ]);
214 214
215 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 215 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
216 216
@@ -236,12 +236,12 @@ class WallabagRestControllerTest extends WallabagApiTestCase
236 // hydrate the tags relations 236 // hydrate the tags relations
237 $nbTags = count($entry->getTags()); 237 $nbTags = count($entry->getTags());
238 238
239 $this->client->request('PATCH', '/api/entries/'.$entry->getId().'.json', array( 239 $this->client->request('PATCH', '/api/entries/'.$entry->getId().'.json', [
240 'title' => 'New awesome title', 240 'title' => 'New awesome title',
241 'tags' => 'new tag '.uniqid(), 241 'tags' => 'new tag '.uniqid(),
242 'starred' => '1', 242 'starred' => '1',
243 'archive' => '0', 243 'archive' => '0',
244 )); 244 ]);
245 245
246 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 246 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
247 247
@@ -268,12 +268,12 @@ class WallabagRestControllerTest extends WallabagApiTestCase
268 // hydrate the tags relations 268 // hydrate the tags relations
269 $nbTags = count($entry->getTags()); 269 $nbTags = count($entry->getTags());
270 270
271 $this->client->request('PATCH', '/api/entries/'.$entry->getId().'.json', array( 271 $this->client->request('PATCH', '/api/entries/'.$entry->getId().'.json', [
272 'title' => 'New awesome title', 272 'title' => 'New awesome title',
273 'tags' => 'new tag '.uniqid(), 273 'tags' => 'new tag '.uniqid(),
274 'starred' => 1, 274 'starred' => 1,
275 'archive' => 0, 275 'archive' => 0,
276 )); 276 ]);
277 277
278 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 278 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
279 279
@@ -298,9 +298,9 @@ class WallabagRestControllerTest extends WallabagApiTestCase
298 $this->markTestSkipped('No content found in db.'); 298 $this->markTestSkipped('No content found in db.');
299 } 299 }
300 300
301 $tags = array(); 301 $tags = [];
302 foreach ($entry->getTags() as $tag) { 302 foreach ($entry->getTags() as $tag) {
303 $tags[] = array('id' => $tag->getId(), 'label' => $tag->getLabel(), 'slug' => $tag->getSlug()); 303 $tags[] = ['id' => $tag->getId(), 'label' => $tag->getLabel(), 'slug' => $tag->getSlug()];
304 } 304 }
305 305
306 $this->client->request('GET', '/api/entries/'.$entry->getId().'/tags'); 306 $this->client->request('GET', '/api/entries/'.$entry->getId().'/tags');
@@ -323,7 +323,7 @@ class WallabagRestControllerTest extends WallabagApiTestCase
323 323
324 $newTags = 'tag1,tag2,tag3'; 324 $newTags = 'tag1,tag2,tag3';
325 325
326 $this->client->request('POST', '/api/entries/'.$entry->getId().'/tags', array('tags' => $newTags)); 326 $this->client->request('POST', '/api/entries/'.$entry->getId().'/tags', ['tags' => $newTags]);
327 327
328 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 328 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
329 329
@@ -337,7 +337,7 @@ class WallabagRestControllerTest extends WallabagApiTestCase
337 ->getRepository('WallabagCoreBundle:Entry') 337 ->getRepository('WallabagCoreBundle:Entry')
338 ->find($entry->getId()); 338 ->find($entry->getId());
339 339
340 $tagsInDB = array(); 340 $tagsInDB = [];
341 foreach ($entryDB->getTags()->toArray() as $tag) { 341 foreach ($entryDB->getTags()->toArray() as $tag) {
342 $tagsInDB[$tag->getId()] = $tag->getLabel(); 342 $tagsInDB[$tag->getId()] = $tag->getLabel();
343 } 343 }