/**
  * Reads a MultiParagraph from the XmlNode $sxeNode given by the element 'form'
  *
  * @param \SimpleXMLElement $sxeNode
  * @return LexMultiParagraph
  */
 public function readMultiParagraph($sxeNode)
 {
     // paragraph separator character U+2029
     $paraSeparator = mb_convert_encoding('
', 'UTF-8', 'HTML-ENTITIES');
     $multiParagraph = new LexMultiParagraph();
     $this->addAndPushSubnodeError(LiftImportNodeError::MULTIPARAGRAPH, $sxeNode->getName());
     /** @var \SimpleXMLElement $element */
     foreach ($sxeNode as $element) {
         switch ($element->getName()) {
             case 'form':
                 $inputSystemTag = (string) $element['lang'];
                 $multiParagraph->inputSystem = $inputSystemTag;
                 $value = self::sanitizeSpans(dom_import_simplexml($element->{'text'}[0]), $inputSystemTag, $this->currentNodeError());
                 foreach (explode($paraSeparator, $value) as $content) {
                     $paragraph = new LexParagraph();
                     if ($content) {
                         $paragraph->content = $content;
                     }
                     $multiParagraph->paragraphs->append($paragraph);
                 }
                 $this->project->addInputSystem($inputSystemTag);
                 break;
             default:
                 $this->currentNodeError()->addUnhandledElement($element->getName());
         }
     }
     array_pop($this->nodeErrors);
     return $multiParagraph;
 }
    $text2 = TextCommands::updateText($testProjectId, array('id' => '', 'title' => $constants['testText2Title'], 'content' => $constants['testText2Content']));
    $question1 = QuestionCommands::updateQuestion($testProjectId, array('id' => '', 'textRef' => $text1, 'title' => $constants['testText1Question1Title'], 'description' => $constants['testText1Question1Content']));
    $question2 = QuestionCommands::updateQuestion($testProjectId, array('id' => '', 'textRef' => $text1, 'title' => $constants['testText1Question2Title'], 'description' => $constants['testText1Question2Content']));
    $template1 = QuestionTemplateCommands::updateTemplate($testProjectId, array('id' => '', 'title' => 'first template', 'description' => 'not particularly interesting'));
    $template2 = QuestionTemplateCommands::updateTemplate($testProjectId, array('id' => '', 'title' => 'second template', 'description' => 'not entirely interesting'));
    $answer1 = QuestionCommands::updateAnswer($testProjectId, $question1, array('id' => '', 'content' => $constants['testText1Question1Answer']), $managerUserId);
    $answer1Id = array_keys($answer1)[0];
    $answer2 = QuestionCommands::updateAnswer($testProjectId, $question2, array('id' => '', 'content' => $constants['testText1Question2Answer']), $managerUserId);
    $answer2Id = array_keys($answer2)[0];
    $comment1 = QuestionCommands::updateComment($testProjectId, $question1, $answer1Id, array('id' => '', 'content' => $constants['testText1Question1Answer1Comment']), $managerUserId);
    $comment2 = QuestionCommands::updateComment($testProjectId, $question2, $answer2Id, array('id' => '', 'content' => $constants['testText1Question2Answer2Comment']), $managerUserId);
} elseif ($site == 'languageforge') {
    // Set up LanguageForge E2E test envrionment here
    ProjectCommands::updateUserRole($testProjectId, $observerUserId, LexRoles::OBSERVER);
    $testProjectModel = new LexProjectModel($testProjectId);
    $testProjectModel->addInputSystem('th-fonipa', 'tipa', 'Thai');
    $testProjectModel->config->entry->fields[LexConfig::LEXEME]->inputSystems[] = 'th-fonipa';
    $testProjectModel->addInputSystem('th-Zxxx-x-audio', 'taud', 'Thai Voice');
    $testProjectModel->config->entry->fields[LexConfig::LEXEME]->inputSystems[] = 'th-Zxxx-x-audio';
    $testProjectId = $testProjectModel->write();
    // setup to mimic file upload
    $fileName = $constants['testEntry1']['lexeme']['th-Zxxx-x-audio']['value'];
    $file = array();
    $file['name'] = $fileName;
    $_FILES['file'] = $file;
    // put a copy of the test file in tmp
    $tmpFilePath = sys_get_temp_dir() . "/CopyOf{$fileName}";
    copy(TestPath . "php/common/{$fileName}", $tmpFilePath);
    $response = LexUploadCommands::uploadAudioFile($testProjectId, 'audio', $tmpFilePath);
    // cleanup tmp file if it still exists
    if (file_exists($tmpFilePath) and !is_dir($tmpFilePath)) {