diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-04-13 09:43:14 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-04-13 09:43:14 +0200 |
commit | f2e5fdc3666a2a6525b4202ab48df05efeebaf5c (patch) | |
tree | f559474e248a33c472fe0b260641866be5c0def3 /src/Wallabag/AnnotationBundle | |
parent | a417b869237763ee115982d6367a82aa6174d74e (diff) | |
parent | 86732aa01cf0ad0fb5279f38ce75a9bedbbb66e1 (diff) | |
download | wallabag-f2e5fdc3666a2a6525b4202ab48df05efeebaf5c.tar.gz wallabag-f2e5fdc3666a2a6525b4202ab48df05efeebaf5c.tar.zst wallabag-f2e5fdc3666a2a6525b4202ab48df05efeebaf5c.zip |
Merge pull request #1916 from wallabag/cleanup
Convert array + phpDoc
Diffstat (limited to 'src/Wallabag/AnnotationBundle')
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 |