public function testUpdateAnswerTags_ExistingAnswer_ChangePersists()
 {
     $e = new MongoTestEnvironment();
     $e->clean();
     $project = $e->createProject(SF_TESTPROJECT, SF_TESTPROJECTCODE);
     $text = new TextModel($project);
     $text->title = "Text 1";
     $usx = MongoTestEnvironment::usxSample();
     $text->content = $usx;
     $textId = $text->write();
     $question = new QuestionModel($project);
     $question->textRef->id = $textId;
     $questionId = $question->write();
     $answer = new AnswerModel();
     $answer->content = "the answer";
     $answer->tags[] = 'originalTag';
     $answerId = $question->writeAnswer($answer);
     $tagsArray = array('updatedTag');
     $dto = QuestionCommands::updateAnswerTags($project->id->asString(), $questionId, $answerId, $tagsArray);
     $question->read($questionId);
     $newAnswer = $question->readAnswer($answerId);
     $this->assertEqual(count($newAnswer->tags), 1);
     $this->assertEqual($newAnswer->tags[0], 'updatedTag');
     $this->assertEqual($dto[$answerId]['tags'][0], 'updatedTag');
 }
Пример #2
0
 public function question_update_answerTags($questionId, $answerId, $tags)
 {
     return QuestionCommands::updateAnswerTags($this->_projectId, $questionId, $answerId, $tags);
 }