예제 #1
0
 public function lex_commentReply_update($commentId, $data)
 {
     return LexCommentCommands::updateReply($this->projectId, $this->userId, $this->website, $commentId, $data);
 }
 public function testDeleteReply_ReplyDeleted()
 {
     $environ = new LexiconMongoTestEnvironment();
     $environ->clean();
     $project = $environ->createProject(SF_TESTPROJECT, SF_TESTPROJECTCODE);
     $userId = $environ->createUser('joe', 'joe', 'joe');
     $regarding = array('field' => 'lexeme', 'fieldValue' => 'Word 1', 'inputSystem' => 'th', 'word' => '', 'meaning' => '');
     $data = array('id' => '', 'content' => 'hi there!', 'regarding' => $regarding);
     $commentId = LexCommentCommands::updateComment($project->id->asString(), $userId, $environ->website, $data);
     $comment = new LexCommentModel($project, $commentId);
     $replyData = array('id' => '', 'content' => 'my first reply');
     // add two replies
     LexCommentCommands::updateReply($project->id->asString(), $userId, $environ->website, $commentId, $replyData);
     $replyId = LexCommentCommands::updateReply($project->id->asString(), $userId, $environ->website, $commentId, $replyData);
     $comment->read($commentId);
     $this->assertCount(2, $comment->replies);
     LexCommentCommands::deleteReply($project->id->asString(), $userId, $environ->website, $commentId, $replyId);
     $comment->read($commentId);
     $this->assertCount(1, $comment->replies);
 }