Пример #1
0
 public function testResetId()
 {
     $comment = new \OC\Comments\Comment();
     $comment->setId('c23');
     $comment->setId('');
     $this->assertSame('', $comment->getId());
 }
Пример #2
0
 public function testSaveAsChild()
 {
     $id = $this->addDatabaseEntry(0, 0);
     $manager = $this->getManager();
     for ($i = 0; $i < 3; $i++) {
         $comment = new \OC\Comments\Comment();
         $comment->setActor('user', 'alice')->setObject('file', 'file64')->setParentId(strval($id))->setMessage('full ack')->setVerb('comment')->setCreationDateTime(new \DateTime('+' . $i . ' minutes'));
         $manager->save($comment);
         $this->assertSame($comment->getTopmostParentId(), strval($id));
         $parentComment = $manager->get(strval($id));
         $this->assertSame($parentComment->getChildrenCount(), $i + 1);
         $this->assertEquals($parentComment->getLatestChildDateTime(), $comment->getCreationDateTime());
     }
 }
Пример #3
0
 /**
  * @expectedException \OCP\Comments\MessageTooLongException
  */
 public function testSetUberlongMessage()
 {
     $comment = new \OC\Comments\Comment();
     $msg = str_pad('', IComment::MAX_MESSAGE_LENGTH + 1, 'x');
     $comment->setMessage($msg);
 }
Пример #4
0
 public function testResetId()
 {
     $comment = new \OC\Comments\Comment();
     $comment->setId('c23');
     $comment->setId('');
 }