Lines Matching full:id

72         $id = 'anntest:crud';
74 $ann = $h->createAnnotation($id, ['exact' => 'hello world'], 'alice', 'A comment');
76 $this->assertNotEmpty($ann['id']);
80 $this->assertCount(1, $h->getAnnotations($id));
81 $this->assertEquals($ann['id'], $h->getAnnotation($id, $ann['id'])['id']);
82 $this->assertEquals(['total' => 1, 'open' => 1, 'resolved' => 0], $h->getStats($id));
88 $id = 'anntest:reject';
90 … $this->assertFalse($h->createAnnotation($id, ['exact' => 'x'], 'alice', ' '), 'empty body');
91 … $this->assertFalse($h->createAnnotation($id, ['exact' => ''], 'alice', 'body'), 'empty exact');
92 $this->assertFalse($h->createAnnotation($id, ['exact' => 'x'], '', 'body'), 'empty author');
93 $this->assertSame([], $h->getAnnotations($id), 'nothing was stored');
99 $id = 'anntest:caps';
101 …$ann = $h->createAnnotation($id, ['exact' => str_repeat('q', 2000)], 'alice', str_repeat('x', 2000…
110 $id = 'anntest:ws';
111 $ann = $h->createAnnotation($id, ['exact' => " foo\n\t bar "], 'alice', 'b');
118 $id = 'anntest:upd';
119 $ann = $h->createAnnotation($id, ['exact' => 'foo'], 'alice', 'first');
121 $this->assertTrue($h->updateAnnotationBody($id, $ann['id'], 'second'));
122 $this->assertEquals('second', $h->getAnnotation($id, $ann['id'])['body']);
123 $this->assertFalse($h->updateAnnotationBody($id, 'nope', 'x'), 'missing id → false');
124 $this->assertFalse($h->updateAnnotationBody($id, $ann['id'], ' '), 'empty body → false');
126 $this->assertTrue($h->deleteAnnotation($id, $ann['id']));
127 $this->assertNull($h->getAnnotation($id, $ann['id']));
128 $this->assertFalse($h->deleteAnnotation($id, $ann['id']), 'already gone → false');
134 $id = 'anntest:status';
135 $ann = $h->createAnnotation($id, ['exact' => 'foo'], 'alice', 'b');
137 $this->assertTrue($h->setStatus($id, $ann['id'], 'resolved', 'bob'));
138 $resolved = $h->getAnnotation($id, $ann['id']);
143 $this->assertTrue($h->setStatus($id, $ann['id'], 'open', 'bob'));
144 $reopened = $h->getAnnotation($id, $ann['id']);
148 … $this->assertFalse($h->setStatus($id, $ann['id'], 'bogus', 'bob'), 'invalid status → false');
158 $id = 'anntest:reply';
159 $ann = $h->createAnnotation($id, ['exact' => 'foo'], 'alice', 'b');
161 $reply = $h->addReply($id, $ann['id'], 'bob', 'a reply');
163 $this->assertNotEmpty($reply['id']);
164 $this->assertCount(1, $h->getAnnotation($id, $ann['id'])['replies']);
166 $this->assertTrue($h->updateReply($id, $ann['id'], $reply['id'], 'edited reply'));
167 … $this->assertEquals('edited reply', $h->getAnnotation($id, $ann['id'])['replies'][0]['body']);
169 $this->assertTrue($h->deleteReply($id, $ann['id'], $reply['id']));
170 $this->assertCount(0, $h->getAnnotation($id, $ann['id'])['replies']);
172 …$this->assertFalse($h->addReply($id, 'missing-ann', 'bob', 'x'), 'reply to missing annotation → fa…
182 $id = 'anntest:clearres';
183 $keep = $h->createAnnotation($id, ['exact' => 'one'], 'alice', 'b1');
184 $drop = $h->createAnnotation($id, ['exact' => 'two'], 'alice', 'b2');
185 $h->setStatus($id, $drop['id'], 'resolved', 'alice');
187 $this->assertEquals(1, $h->clearResolved($id));
188 $remaining = $h->getAnnotations($id);
190 $this->assertEquals($keep['id'], $remaining[0]['id']);
197 foreach ($ids as $id) {
198 $h->createAnnotation($id, ['exact' => 'keep open'], 'alice', 'open');
199 $done = $h->createAnnotation($id, ['exact' => 'mark done'], 'alice', 'done');
200 $h->setStatus($id, $done['id'], 'resolved', 'alice');
209 foreach ($ids as $id) {
210 $remaining = $h->getAnnotations($id);
211 $this->assertCount(1, $remaining, $id . ' keeps only the open annotation');
212 $this->assertEquals('open', $remaining[0]['body'], $id . ' kept the right annotation');
222 $id = 'anntest:orphan';
223 saveWikiText($id, 'Hello world, this is a wiki page about cats.', 'setup');
226 … $present = $h->createAnnotation($id, ['exact' => 'wiki page about cats'], 'alice', 'present');
227 $gone = $h->createAnnotation($id, ['exact' => 'text that is not here'], 'alice', 'gone');
230 return $a['id'];
231 }, $h->findOrphaned($id));
233 $this->assertContains($gone['id'], $orphanIds, 'a missing quote is orphaned');
234 $this->assertNotContains($present['id'], $orphanIds, 'a present quote is not orphaned');
236 $this->assertEquals(1, $h->clearOrphaned($id), 'only the orphan is cleared');
237 $remaining = $h->getAnnotations($id);
239 $this->assertEquals($present['id'], $remaining[0]['id']);
255 $h->deleteAnnotation('anntest:emptied', $gone['id']);
265 $id = 'anntest:counts';
266 saveWikiText($id, 'Hello world, this is a wiki page about cats.', 'setup');
269 $h->createAnnotation($id, ['exact' => 'wiki page about cats'], 'alice', 'present');
270 $h->createAnnotation($id, ['exact' => 'text that is not here'], 'alice', 'gone');
274 $h->pageCounts($id)
280 $id = 'anntest:countsres';
281 saveWikiText($id, 'Hello world, this is a wiki page about cats.', 'setup');
285 … $present = $h->createAnnotation($id, ['exact' => 'wiki page about cats'], 'alice', 'present');
286 $h->setStatus($id, $present['id'], 'resolved', 'alice');
288 $gone = $h->createAnnotation($id, ['exact' => 'text that is not here'], 'alice', 'gone');
289 $h->setStatus($id, $gone['id'], 'resolved', 'alice');
293 $h->pageCounts($id)
310 foreach ($ids as $id) {
311 saveWikiText($id, 'Hello world, this is a wiki page about cats.', 'setup');
312 $h->createAnnotation($id, ['exact' => 'wiki page about cats'], 'alice', 'present');
313 $h->createAnnotation($id, ['exact' => 'text that is not here'], 'alice', 'gone');
322 foreach ($ids as $id) {
323 $remaining = $h->getAnnotations($id);
324 $this->assertCount(1, $remaining, $id . ' keeps only the present annotation');
325 … $this->assertEquals('present', $remaining[0]['body'], $id . ' kept the right annotation');
326 $this->assertSame(0, $h->pageCounts($id)['orphaned'], $id . ' has no orphans left');