public function question_update_answerTags($questionId, $answerId, $tags) { return QuestionCommands::updateAnswerTags($this->projectId, $questionId, $answerId, $tags); }
public function testUpdateAnswerTags_ExistingAnswer_ChangePersists() { $environ = new MongoTestEnvironment(); $environ->clean(); $project = $environ->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->assertCount(1, $newAnswer->tags); $this->assertEquals('updatedTag', $newAnswer->tags[0]); $this->assertEquals('updatedTag', $dto[$answerId]['tags'][0]); }