示例#1
0
文件: comment.php 项目: kenwi/core
 public function testResetId()
 {
     $comment = new \OC\Comments\Comment();
     $comment->setId('c23');
     $comment->setId('');
     $this->assertSame('', $comment->getId());
 }
示例#2
0
 public function testSettersValidInput()
 {
     $comment = new \OC\Comments\Comment();
     $id = 'comment23';
     $parentId = 'comment11.5';
     $childrenCount = 6;
     $message = 'I like to comment comment';
     $verb = 'comment';
     $actor = ['type' => 'user', 'id' => 'alice'];
     $creationDT = new \DateTime();
     $latestChildDT = new \DateTime('yesterday');
     $object = ['type' => 'file', 'id' => 'file64'];
     $comment->setId($id)->setParentId($parentId)->setChildrenCount($childrenCount)->setMessage($message)->setVerb($verb)->setActor($actor['type'], $actor['id'])->setCreationDateTime($creationDT)->setLatestChildDateTime($latestChildDT)->setObject($object['type'], $object['id']);
     $this->assertSame($id, $comment->getId());
     $this->assertSame($parentId, $comment->getParentId());
     $this->assertSame($childrenCount, $comment->getChildrenCount());
     $this->assertSame($message, $comment->getMessage());
     $this->assertSame($verb, $comment->getVerb());
     $this->assertSame($actor['type'], $comment->getActorType());
     $this->assertSame($actor['id'], $comment->getActorId());
     $this->assertSame($creationDT, $comment->getCreationDateTime());
     $this->assertSame($latestChildDT, $comment->getLatestChildDateTime());
     $this->assertSame($object['type'], $comment->getObjectType());
     $this->assertSame($object['id'], $comment->getObjectId());
 }