Lines Matching refs:ann

42         $ann = ['author' => 'alice'];
43 $this->assertTrue($h->canEditAnnotation($ann, 'alice', false), 'author may edit');
44 $this->assertFalse($h->canEditAnnotation($ann, 'bob', false), 'non-author may not edit');
45 $this->assertTrue($h->canEditAnnotation($ann, 'bob', true), 'admin may edit anyone');
46 $this->assertFalse($h->canEditAnnotation($ann, '', true), 'anonymous never edits');
74 $ann = $h->createAnnotation($id, ['exact' => 'hello world'], 'alice', 'A comment');
75 $this->assertIsArray($ann);
76 $this->assertNotEmpty($ann['id']);
77 $this->assertEquals('open', $ann['status']);
78 $this->assertEquals('alice', $ann['author']);
81 $this->assertEquals($ann['id'], $h->getAnnotation($id, $ann['id'])['id']);
101 …$ann = $h->createAnnotation($id, ['exact' => str_repeat('q', 2000)], 'alice', str_repeat('x', 2000…
102 $this->assertIsArray($ann);
103 $this->assertEquals(10000, mb_strlen($ann['body']), 'body capped at MAX_BODY');
104 $this->assertEquals(1000, mb_strlen($ann['anchor']['exact']), 'quote capped at MAX_QUOTE');
111 $ann = $h->createAnnotation($id, ['exact' => " foo\n\t bar "], 'alice', 'b');
112 $this->assertEquals('foo bar', $ann['anchor']['exact']);
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']);
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');
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');
159 $ann = $h->createAnnotation($id, ['exact' => 'foo'], 'alice', 'b');
161 $reply = $h->addReply($id, $ann['id'], 'bob', 'a reply');
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']);