public function testExportCommentsForText_QuestionArchived_NoneExported()
 {
     $project = self::$environ->createProject(SF_TESTPROJECT, SF_TESTPROJECTCODE);
     $text = new TextModel($project);
     $text->title = 'Text 1';
     $usx = MongoTestEnvironment::usxSample();
     $text->content = $usx;
     $textId = $text->write();
     $user1Id = self::$environ->createUser('user1', 'user1', '*****@*****.**');
     $user2Id = self::$environ->createUser('user2', 'user2', '*****@*****.**');
     $user3Id = self::$environ->createUser('user3', 'user3', '*****@*****.**');
     // Workflow is first to create a question
     $question = new QuestionModel($project);
     $question->title = 'the question';
     $question->description = 'question description';
     $question->textRef->id = $textId;
     $question->isArchived = true;
     $question->write();
     // Then to add an answer to a question
     $answer = new AnswerModel();
     $answer->content = 'first answer';
     $answer->score = 10;
     $answer->userRef->id = $user1Id;
     $answer->tags->exchangeArray(array('export', 'to review'));
     $answer->isToBeExported = true;
     $question->writeAnswer($answer);
     // Then to add an answer to a question
     $answer = new AnswerModel();
     $answer->content = 'second answer - very long';
     $answer->score = 2;
     $answer->userRef->id = $user2Id;
     $answer->tags->exchangeArray(array('to review'));
     $answer->isToBeExported = false;
     $question->writeAnswer($answer);
     // Then to add an answer to a question
     $answer = new AnswerModel();
     $answer->content = 'third answer - very very very very long';
     $answer->userRef->id = $user3Id;
     $answer->tags->exchangeArray(array('export'));
     $answer->isToBeExported = true;
     $question->writeAnswer($answer);
     $params = array('textId' => $textId, 'exportComments' => true, 'exportFlagged' => true, 'tags' => array());
     $download = ParatextExport::exportCommentsForText($project->id->asString(), $textId, $params);
     //        echo '<pre>' . print_r($download) . '</pre>';
     $this->assertNotRegExp('/<Contents>third answer - very very very very long \\(by user3/', $download['xml']);
     $this->assertNotRegExp('/<Contents>second answer/', $download['xml']);
     $this->assertNotRegExp('/<Contents>first answer/', $download['xml']);
 }
예제 #2
0
 public function text_exportComments($params)
 {
     return ParatextExport::exportCommentsForText($this->projectId, $params['textId'], $params);
 }