aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/AnnotationBundle
diff options
context:
space:
mode:
authorJérémy Benoist <j0k3r@users.noreply.github.com>2017-07-03 13:39:54 +0200
committerGitHub <noreply@github.com>2017-07-03 13:39:54 +0200
commit71e1cbc8eb5928d393b0772055d6b711e90a09b3 (patch)
tree71795eadcf13fda9198b8cd9a3da26d51826bbd9 /tests/Wallabag/AnnotationBundle
parent822c877949aff8ae57677671115f8f4fc69588d5 (diff)
parent38520658addc217f127b0627ea28dcf8d6e6178c (diff)
downloadwallabag-71e1cbc8eb5928d393b0772055d6b711e90a09b3.tar.gz
wallabag-71e1cbc8eb5928d393b0772055d6b711e90a09b3.tar.zst
wallabag-71e1cbc8eb5928d393b0772055d6b711e90a09b3.zip
Merge pull request #3258 from wallabag/cs-fixer
Add a real configuration for CS-Fixer
Diffstat (limited to 'tests/Wallabag/AnnotationBundle')
-rw-r--r--tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php44
-rw-r--r--tests/Wallabag/AnnotationBundle/WallabagAnnotationTestCase.php2
2 files changed, 23 insertions, 23 deletions
diff --git a/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php b/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php
index 3c94382c..96474468 100644
--- a/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php
+++ b/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php
@@ -49,12 +49,12 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
49 $this->logInAs('admin'); 49 $this->logInAs('admin');
50 } 50 }
51 51
52 $this->client->request('GET', $prefixUrl.'/'.$entry->getId().'.json'); 52 $this->client->request('GET', $prefixUrl . '/' . $entry->getId() . '.json');
53 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 53 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
54 54
55 $content = json_decode($this->client->getResponse()->getContent(), true); 55 $content = json_decode($this->client->getResponse()->getContent(), true);
56 $this->assertGreaterThanOrEqual(1, $content['total']); 56 $this->assertGreaterThanOrEqual(1, $content['total']);
57 $this->assertEquals($annotation->getText(), $content['rows'][0]['text']); 57 $this->assertSame($annotation->getText(), $content['rows'][0]['text']);
58 58
59 // we need to re-fetch the annotation becase after the flush, it has been "detached" from the entity manager 59 // we need to re-fetch the annotation becase after the flush, it has been "detached" from the entity manager
60 $annotation = $em->getRepository('WallabagAnnotationBundle:Annotation')->findAnnotationById($annotation->getId()); 60 $annotation = $em->getRepository('WallabagAnnotationBundle:Annotation')->findAnnotationById($annotation->getId());
@@ -88,16 +88,16 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
88 ['start' => '', 'startOffset' => 24, 'end' => '', 'endOffset' => 31], 88 ['start' => '', 'startOffset' => 24, 'end' => '', 'endOffset' => 31],
89 ], 89 ],
90 ]); 90 ]);
91 $this->client->request('POST', $prefixUrl.'/'.$entry->getId().'.json', [], [], $headers, $content); 91 $this->client->request('POST', $prefixUrl . '/' . $entry->getId() . '.json', [], [], $headers, $content);
92 92
93 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 93 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
94 94
95 $content = json_decode($this->client->getResponse()->getContent(), true); 95 $content = json_decode($this->client->getResponse()->getContent(), true);
96 96
97 $this->assertEquals('Big boss', $content['user']); 97 $this->assertSame('Big boss', $content['user']);
98 $this->assertEquals('v1.0', $content['annotator_schema_version']); 98 $this->assertSame('v1.0', $content['annotator_schema_version']);
99 $this->assertEquals('my annotation', $content['text']); 99 $this->assertSame('my annotation', $content['text']);
100 $this->assertEquals('my quote', $content['quote']); 100 $this->assertSame('my quote', $content['quote']);
101 101
102 /** @var Annotation $annotation */ 102 /** @var Annotation $annotation */
103 $annotation = $this->client->getContainer() 103 $annotation = $this->client->getContainer()
@@ -105,7 +105,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
105 ->getRepository('WallabagAnnotationBundle:Annotation') 105 ->getRepository('WallabagAnnotationBundle:Annotation')
106 ->findLastAnnotationByPageId($entry->getId(), 1); 106 ->findLastAnnotationByPageId($entry->getId(), 1);
107 107
108 $this->assertEquals('my annotation', $annotation->getText()); 108 $this->assertSame('my annotation', $annotation->getText());
109 } 109 }
110 110
111 /** 111 /**
@@ -133,9 +133,9 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
133 ['start' => '', 'startOffset' => 24, 'end' => '', 'endOffset' => 31], 133 ['start' => '', 'startOffset' => 24, 'end' => '', 'endOffset' => 31],
134 ], 134 ],
135 ]); 135 ]);
136 $this->client->request('POST', $prefixUrl.'/'.$entry->getId().'.json', [], [], $headers, $content); 136 $this->client->request('POST', $prefixUrl . '/' . $entry->getId() . '.json', [], [], $headers, $content);
137 137
138 $this->assertEquals(400, $this->client->getResponse()->getStatusCode()); 138 $this->assertSame(400, $this->client->getResponse()->getStatusCode());
139 } 139 }
140 140
141 /** 141 /**
@@ -166,21 +166,21 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
166 $content = json_encode([ 166 $content = json_encode([
167 'text' => 'a modified annotation', 167 'text' => 'a modified annotation',
168 ]); 168 ]);
169 $this->client->request('PUT', $prefixUrl.'/'.$annotation->getId().'.json', [], [], $headers, $content); 169 $this->client->request('PUT', $prefixUrl . '/' . $annotation->getId() . '.json', [], [], $headers, $content);
170 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 170 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
171 171
172 $content = json_decode($this->client->getResponse()->getContent(), true); 172 $content = json_decode($this->client->getResponse()->getContent(), true);
173 173
174 $this->assertEquals('Big boss', $content['user']); 174 $this->assertSame('Big boss', $content['user']);
175 $this->assertEquals('v1.0', $content['annotator_schema_version']); 175 $this->assertSame('v1.0', $content['annotator_schema_version']);
176 $this->assertEquals('a modified annotation', $content['text']); 176 $this->assertSame('a modified annotation', $content['text']);
177 $this->assertEquals('my quote', $content['quote']); 177 $this->assertSame('my quote', $content['quote']);
178 178
179 /** @var Annotation $annotationUpdated */ 179 /** @var Annotation $annotationUpdated */
180 $annotationUpdated = $em 180 $annotationUpdated = $em
181 ->getRepository('WallabagAnnotationBundle:Annotation') 181 ->getRepository('WallabagAnnotationBundle:Annotation')
182 ->findOneById($annotation->getId()); 182 ->findOneById($annotation->getId());
183 $this->assertEquals('a modified annotation', $annotationUpdated->getText()); 183 $this->assertSame('a modified annotation', $annotationUpdated->getText());
184 184
185 $em->remove($annotationUpdated); 185 $em->remove($annotationUpdated);
186 $em->flush(); 186 $em->flush();
@@ -218,12 +218,12 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
218 $content = json_encode([ 218 $content = json_encode([
219 'text' => 'a modified annotation', 219 'text' => 'a modified annotation',
220 ]); 220 ]);
221 $this->client->request('DELETE', $prefixUrl.'/'.$annotation->getId().'.json', [], [], $headers, $content); 221 $this->client->request('DELETE', $prefixUrl . '/' . $annotation->getId() . '.json', [], [], $headers, $content);
222 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 222 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
223 223
224 $content = json_decode($this->client->getResponse()->getContent(), true); 224 $content = json_decode($this->client->getResponse()->getContent(), true);
225 225
226 $this->assertEquals('This is my annotation /o/', $content['text']); 226 $this->assertSame('This is my annotation /o/', $content['text']);
227 227
228 $annotationDeleted = $em 228 $annotationDeleted = $em
229 ->getRepository('WallabagAnnotationBundle:Annotation') 229 ->getRepository('WallabagAnnotationBundle:Annotation')
diff --git a/tests/Wallabag/AnnotationBundle/WallabagAnnotationTestCase.php b/tests/Wallabag/AnnotationBundle/WallabagAnnotationTestCase.php
index ef3f1324..105e8add 100644
--- a/tests/Wallabag/AnnotationBundle/WallabagAnnotationTestCase.php
+++ b/tests/Wallabag/AnnotationBundle/WallabagAnnotationTestCase.php
@@ -52,7 +52,7 @@ abstract class WallabagAnnotationTestCase extends WebTestCase
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
55 $container->get('session')->set('_security_'.$firewallName, serialize($container->get('security.token_storage')->getToken())); 55 $container->get('session')->set('_security_' . $firewallName, serialize($container->get('security.token_storage')->getToken()));
56 $container->get('session')->save(); 56 $container->get('session')->save();
57 57
58 $session = $container->get('session'); 58 $session = $container->get('session');