aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/AnnotationBundle
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/AnnotationBundle
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/AnnotationBundle')
-rw-r--r--src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php4
-rw-r--r--src/Wallabag/AnnotationBundle/Tests/Controller/AnnotationControllerTest.php26
-rw-r--r--src/Wallabag/AnnotationBundle/Tests/WallabagAnnotationTestCase.php6
3 files changed, 18 insertions, 18 deletions
diff --git a/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php b/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php
index 5f981eb5..ad083e31 100644
--- a/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php
+++ b/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php
@@ -30,7 +30,7 @@ class WallabagAnnotationController extends FOSRestController
30 ->getRepository('WallabagAnnotationBundle:Annotation') 30 ->getRepository('WallabagAnnotationBundle:Annotation')
31 ->findAnnotationsByPageId($entry->getId(), $this->getUser()->getId()); 31 ->findAnnotationsByPageId($entry->getId(), $this->getUser()->getId());
32 $total = count($annotationRows); 32 $total = count($annotationRows);
33 $annotations = array('total' => $total, 'rows' => $annotationRows); 33 $annotations = ['total' => $total, 'rows' => $annotationRows];
34 34
35 $json = $this->get('serializer')->serialize($annotations, 'json'); 35 $json = $this->get('serializer')->serialize($annotations, 'json');
36 36
@@ -141,6 +141,6 @@ class WallabagAnnotationController extends FOSRestController
141 */ 141 */
142 private function renderJsonResponse($json, $code = 200) 142 private function renderJsonResponse($json, $code = 200)
143 { 143 {
144 return new Response($json, $code, array('application/json')); 144 return new Response($json, $code, ['application/json']);
145 } 145 }
146} 146}
diff --git a/src/Wallabag/AnnotationBundle/Tests/Controller/AnnotationControllerTest.php b/src/Wallabag/AnnotationBundle/Tests/Controller/AnnotationControllerTest.php
index e972c2de..3eba7193 100644
--- a/src/Wallabag/AnnotationBundle/Tests/Controller/AnnotationControllerTest.php
+++ b/src/Wallabag/AnnotationBundle/Tests/Controller/AnnotationControllerTest.php
@@ -35,13 +35,13 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
35 ->getRepository('WallabagCoreBundle:Entry') 35 ->getRepository('WallabagCoreBundle:Entry')
36 ->findOneByUsernameAndNotArchived('admin'); 36 ->findOneByUsernameAndNotArchived('admin');
37 37
38 $headers = array('CONTENT_TYPE' => 'application/json'); 38 $headers = ['CONTENT_TYPE' => 'application/json'];
39 $content = json_encode(array( 39 $content = json_encode([
40 'text' => 'my annotation', 40 'text' => 'my annotation',
41 'quote' => 'my quote', 41 'quote' => 'my quote',
42 'ranges' => array('start' => '', 'startOffset' => 24, 'end' => '', 'endOffset' => 31), 42 'ranges' => ['start' => '', 'startOffset' => 24, 'end' => '', 'endOffset' => 31],
43 )); 43 ]);
44 $crawler = $this->client->request('POST', 'annotations/'.$entry->getId().'.json', array(), array(), $headers, $content); 44 $crawler = $this->client->request('POST', 'annotations/'.$entry->getId().'.json', [], [], $headers, $content);
45 45
46 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 46 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
47 47
@@ -69,11 +69,11 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
69 69
70 $this->logInAs('admin'); 70 $this->logInAs('admin');
71 71
72 $headers = array('CONTENT_TYPE' => 'application/json'); 72 $headers = ['CONTENT_TYPE' => 'application/json'];
73 $content = json_encode(array( 73 $content = json_encode([
74 'text' => 'a modified annotation', 74 'text' => 'a modified annotation',
75 )); 75 ]);
76 $crawler = $this->client->request('PUT', 'annotations/'.$annotation->getId().'.json', array(), array(), $headers, $content); 76 $crawler = $this->client->request('PUT', 'annotations/'.$annotation->getId().'.json', [], [], $headers, $content);
77 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 77 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
78 78
79 $content = json_decode($this->client->getResponse()->getContent(), true); 79 $content = json_decode($this->client->getResponse()->getContent(), true);
@@ -99,11 +99,11 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
99 99
100 $this->logInAs('admin'); 100 $this->logInAs('admin');
101 101
102 $headers = array('CONTENT_TYPE' => 'application/json'); 102 $headers = ['CONTENT_TYPE' => 'application/json'];
103 $content = json_encode(array( 103 $content = json_encode([
104 'text' => 'a modified annotation', 104 'text' => 'a modified annotation',
105 )); 105 ]);
106 $crawler = $this->client->request('DELETE', 'annotations/'.$annotation->getId().'.json', array(), array(), $headers, $content); 106 $crawler = $this->client->request('DELETE', 'annotations/'.$annotation->getId().'.json', [], [], $headers, $content);
107 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 107 $this->assertEquals(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);
diff --git a/src/Wallabag/AnnotationBundle/Tests/WallabagAnnotationTestCase.php b/src/Wallabag/AnnotationBundle/Tests/WallabagAnnotationTestCase.php
index 2deff6bf..a9035acc 100644
--- a/src/Wallabag/AnnotationBundle/Tests/WallabagAnnotationTestCase.php
+++ b/src/Wallabag/AnnotationBundle/Tests/WallabagAnnotationTestCase.php
@@ -26,10 +26,10 @@ abstract class WallabagAnnotationTestCase extends WebTestCase
26 { 26 {
27 $crawler = $this->client->request('GET', '/login'); 27 $crawler = $this->client->request('GET', '/login');
28 $form = $crawler->filter('button[type=submit]')->form(); 28 $form = $crawler->filter('button[type=submit]')->form();
29 $data = array( 29 $data = [
30 '_username' => $username, 30 '_username' => $username,
31 '_password' => 'mypassword', 31 '_password' => 'mypassword',
32 ); 32 ];
33 33
34 $this->client->submit($form, $data); 34 $this->client->submit($form, $data);
35 } 35 }
@@ -48,7 +48,7 @@ abstract class WallabagAnnotationTestCase extends WebTestCase
48 $loginManager = $container->get('fos_user.security.login_manager'); 48 $loginManager = $container->get('fos_user.security.login_manager');
49 $firewallName = $container->getParameter('fos_user.firewall_name'); 49 $firewallName = $container->getParameter('fos_user.firewall_name');
50 50
51 $this->user = $userManager->findUserBy(array('username' => 'admin')); 51 $this->user = $userManager->findUserBy(['username' => 'admin']);
52 $loginManager->loginUser($firewallName, $this->user); 52 $loginManager->loginUser($firewallName, $this->user);
53 53
54 // save the login token into the session and put it in a cookie 54 // save the login token into the session and put it in a cookie