diff options
Diffstat (limited to 'tests/Wallabag')
-rw-r--r-- | tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php b/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php index 81f9e9ec..8f87ccf3 100644 --- a/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php +++ b/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php | |||
@@ -84,7 +84,9 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase | |||
84 | $content = json_encode([ | 84 | $content = json_encode([ |
85 | 'text' => 'my annotation', | 85 | 'text' => 'my annotation', |
86 | 'quote' => 'my quote', | 86 | 'quote' => 'my quote', |
87 | 'ranges' => ['start' => '', 'startOffset' => 24, 'end' => '', 'endOffset' => 31], | 87 | 'ranges' => [ |
88 | ['start' => '', 'startOffset' => 24, 'end' => '', 'endOffset' => 31] | ||
89 | ], | ||
88 | ]); | 90 | ]); |
89 | $this->client->request('POST', $prefixUrl.'/'.$entry->getId().'.json', [], [], $headers, $content); | 91 | $this->client->request('POST', $prefixUrl.'/'.$entry->getId().'.json', [], [], $headers, $content); |
90 | 92 | ||
@@ -107,6 +109,36 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase | |||
107 | } | 109 | } |
108 | 110 | ||
109 | /** | 111 | /** |
112 | * @dataProvider dataForEachAnnotations | ||
113 | */ | ||
114 | public function testSetAnnotationWithQuoteTooLong($prefixUrl) | ||
115 | { | ||
116 | $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); | ||
117 | |||
118 | if ('annotations' === $prefixUrl) { | ||
119 | $this->logInAs('admin'); | ||
120 | } | ||
121 | |||
122 | /** @var Entry $entry */ | ||
123 | $entry = $em | ||
124 | ->getRepository('WallabagCoreBundle:Entry') | ||
125 | ->findOneByUsernameAndNotArchived('admin'); | ||
126 | |||
127 | $longQuote = str_repeat('a', 10001); | ||
128 | $headers = ['CONTENT_TYPE' => 'application/json']; | ||
129 | $content = json_encode([ | ||
130 | 'text' => 'my annotation', | ||
131 | 'quote' => $longQuote, | ||
132 | 'ranges' => [ | ||
133 | ['start' => '', 'startOffset' => 24, 'end' => '', 'endOffset' => 31] | ||
134 | ], | ||
135 | ]); | ||
136 | $this->client->request('POST', $prefixUrl.'/'.$entry->getId().'.json', [], [], $headers, $content); | ||
137 | |||
138 | $this->assertEquals(400, $this->client->getResponse()->getStatusCode()); | ||
139 | } | ||
140 | |||
141 | /** | ||
110 | * Test editing an existing annotation. | 142 | * Test editing an existing annotation. |
111 | * | 143 | * |
112 | * @dataProvider dataForEachAnnotations | 144 | * @dataProvider dataForEachAnnotations |