public function testLiftImportMerge_FlexAllFields_HasAllFields() { $liftFilePath = $this->environ->createTestLiftFile(self::liftAllFlexFields, 'LiftAllFlexFields.lift'); $project = $this->environ->createProject(SF_TESTPROJECT, SF_TESTPROJECTCODE); $mergeRule = LiftMergeRule::IMPORT_WINS; $skipSameModTime = false; LiftImport::get()->merge($liftFilePath, $project, $mergeRule, $skipSameModTime); $entryList = new LexEntryListModel($project); $entryList->read(); $entries = $entryList->entries; $this->assertEqual($entryList->count, 2); $entriesByGuid = $this->environ->indexItemsBy($entries, 'guid'); $entry0 = new LexEntryModel($project, $entriesByGuid['0a18bb95-0eb2-422e-bf7e-c1fd90274670']['id']); $entry1 = new LexEntryModel($project, $entriesByGuid['dc4106ac-13fd-4ae0-a32b-b737f413d515']['id']); $this->assertEqual($entry0->guid, '0a18bb95-0eb2-422e-bf7e-c1fd90274670'); $this->assertEqual($entry0->lexeme['th'], 'คาม'); $this->assertEqual($entry0->citationForm['th'], 'คาม'); $this->assertEqual($entry0->etymology['th'], 'คาม'); $this->assertEqual($entry0->etymology['en'], 'A Etymology'); $this->assertEqual($entry0->etymologyGloss['en'], 'A Etymology Gloss'); $this->assertEqual($entry0->etymologyComment['en'], 'A Etymology Comment'); $this->assertEqual($entry0->pronunciation['th'], 'คาม'); $this->assertEqual($entry0->morphologyType, 'stem'); $this->assertEqual($entry0->literalMeaning['en'], 'A Literal Meaning'); /* @var $sense00 Sense */ $sense00 = $entry0->senses[0]; $this->assertEqual($sense00->partOfSpeech->value, 'Noun'); $this->assertEqual($sense00->gloss['en']->value, 'A Word'); $this->assertEqual($sense00->definition['en']->value, 'A Word Defn'); $expected = LexiconMultiValueField::createFromArray(array('9.1.3.1 Physical, non-physical')); $this->assertEqual($sense00->semanticDomain, $expected); $expected = LexiconMultiValueField::createFromArray(array('901')); $this->assertEqual($sense00->anthropologyCategories, $expected); $expected = LexiconMultiValueField::createFromArray(array('applied linguistics')); $this->assertEqual($sense00->academicDomains, $expected); $expected = new LexiconField('primary'); $this->assertEqual($sense00->senseType, $expected); $expected = LexiconMultiValueField::createFromArray(array('Tentative')); $this->assertEqual($sense00->status, $expected); $expected = LexiconMultiValueField::createFromArray(array('colloquial')); $this->assertEqual($sense00->usages, $expected); $expected = new Picture(); $expected->fileName = 'Desert.jpg'; $expected->caption['th'] = 'รูป'; $expected->caption['en'] = 'image'; $expected->caption['fr'] = 'photo'; $this->assertEqual($sense00->pictures[0], $expected); /* @var $example000 Example */ $example000 = $sense00->examples[0]; $this->assertEqual($example000->sentence['th'], 'ใหท่ มี'); $this->assertEqual($example000->translation['en']->value, 'A Translation'); }
public function testLiftImportMerge_MultiPara_ParagraphMarkerFound() { $liftFilePath = $this->environ->createTestLiftFile(self::liftOneEntryMultiParaV0_13, 'LiftOneEntryMultiParaV0_13.lift'); $project = $this->environ->createProject(SF_TESTPROJECT, SF_TESTPROJECTCODE); $mergeRule = LiftMergeRule::IMPORT_WINS; $skipSameModTime = false; $importer = LiftImport::get()->merge($liftFilePath, $project, $mergeRule, $skipSameModTime); $entryList = new LexEntryListModel($project); $entryList->read(); $entry0 = $entryList->entries[0]; $this->assertEqual($entryList->count, 1); $this->assertTrue(array_key_exists('customField_entry_Cust_MultiPara', $entry0['customFields']), 'custom field MultiPara exists'); $this->assertEqual($entry0['customFields']['customField_entry_Cust_MultiPara']['en']['value'], '<p>First paragraph with <span lang="th">ไทย</span></p><p>Second Paragraph</p>', 'custom field MultiPara has paragraph separator character U+2029 replaced by paragraph markup and native language spans removed'); }