public function testBadXml() { //PHASE 3 check for particular tag mismatch: unclosed x tag <x id="231"> $source_seg = <<<SRC <g id="pt235"><g id="pt236"> <x id="abc/></g></g> <g id="pt238"><g id="pt239">Elsa sur son ordinateur tape des lignes de code quand sa colocataire, Joy, entre dans sa chambre.</g></g> SRC; $target_seg = <<<TRG <g id="pt235"><g id="pt236"> </g></g> <g id="pt238"><g id="pt239">Elsa's on her computer typing lines of code when her roommate, Joy, enters the room.</g></g> TRG; $check = new QA($source_seg, $target_seg); $check->performTagCheckOnly(); $this->assertTrue($check->thereAreErrors()); $errors = $check->getErrors(); $this->assertCount(1, $errors); $this->assertAttributeEquals(1000, 'outcome', $errors[0]); $this->assertRegExp('/ 1 /', $check->getErrorsJSON()); $this->assertEquals('[{"outcome":1000,"debug":"Tag mismatch ( 1 )"}]', $check->getWarningsJSON()); $this->assertEquals('[{"outcome":1000,"debug":"Tag mismatch ( 1 )"}]', $check->getErrorsJSON()); }
$suggestion_source = $matches[0]['created_by']; $equivalentWordMapping = json_decode($payable_rates, true); $new_match_type = getNewMatchType($tm_match_type, $fast_match_type, $equivalentWordMapping, empty($matches[0]['memory_key'])); //echo "sid is $sid "; $eq_words = $equivalentWordMapping[$new_match_type] * $raw_wc / 100; $standard_words = $eq_words; if ($new_match_type == 'MT') { $standard_words = $equivalentWordMapping["NO_MATCH"] * $raw_wc / 100; } !empty($matches[0]['sentence_confidence']) ? $mt_qe = floatval($matches[0]['sentence_confidence']) : ($mt_qe = null); $check = new QA($text, $suggestion); $check->performTagCheckOnly(); //log::doLog($check->getErrors(true)); echo "--- (child {$my_pid}) : sid={$sid} --- \$tm_match_type={$tm_match_type}, \$fast_match_type={$fast_match_type}, \$new_match_type={$new_match_type}, \$equivalentWordMapping[\$new_match_type]=" . $equivalentWordMapping[$new_match_type] . ", \$raw_wc={$raw_wc},\$standard_words={$standard_words},\$eq_words={$eq_words}\n"; if ($check->thereAreErrors()) { $err_json = $check->getErrorsJSON(); } else { $err_json = ''; } echo "--- (child {$my_pid}) : sid={$sid} --- \$tm_match_type={$tm_match_type}, \$fast_match_type={$fast_match_type}, \$new_match_type={$new_match_type}, \$equivalentWordMapping[\$new_match_type]=" . $equivalentWordMapping[$new_match_type] . ", \$raw_wc={$raw_wc},\$standard_words={$standard_words},\$eq_words={$eq_words}\n"; $tm_data = array(); $tm_data['id_job'] = $jid; $tm_data['id_segment'] = $sid; $tm_data['suggestions_array'] = $suggestion_json; $tm_data['suggestion'] = $suggestion; $tm_data['suggestion_match'] = $suggestion_match; $tm_data['suggestion_source'] = $suggestion_source; $tm_data['match_type'] = $new_match_type; $tm_data['eq_word_count'] = $eq_words; $tm_data['standard_word_count'] = $standard_words; $tm_data['translation'] = $suggestion;