public function testImport()
 {
     $xml = simplexml_load_file(dirname(__FILE__) . '/_fixtures/ImportTrackerSemanticTitleTest.xml');
     $tracker = new MockTracker();
     $f1 = new MockTracker_FormElement_Field_Text();
     $f1->setReturnValue('getId', 111);
     $f2 = new MockTracker_FormElement_Field_Text();
     $f2->setReturnValue('getId', 112);
     $f3 = new MockTracker_FormElement_Field_Text();
     $f3->setReturnValue('getId', 113);
     $mapping = array('F9' => $f1, 'F13' => $f2, 'F16' => $f3);
     $semantic_title = Tracker_Semantic_TitleFactory::instance()->getInstanceFromXML($xml, $mapping, $tracker);
     $this->assertEqual($semantic_title->getShortName(), 'title');
     $this->assertEqual($semantic_title->getFieldId(), 112);
 }
 public function testExport()
 {
     $GLOBALS['Language'] = new MockBaseLanguage($this);
     $GLOBALS['Language']->setReturnValue('getText', 'Title', array('plugin_tracker_admin_semantic', 'title_label'));
     $GLOBALS['Language']->setReturnValue('getText', 'Define the title of an artifact', array('plugin_tracker_admin_semantic', 'title_description'));
     $xml = simplexml_load_file(dirname(__FILE__) . '/_fixtures/ImportTrackerSemanticTitleTest.xml');
     $tracker = new MockTracker();
     $f = new MockTracker_FormElement_Field_Text();
     $f->setReturnValue('getId', 102);
     $tst = new Tracker_Semantic_Title($tracker, $f);
     $root = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><tracker />');
     $array_mapping = array('F13' => '102');
     $tst->exportToXML($root, $array_mapping);
     $this->assertEqual((string) $xml->shortname, (string) $root->semantic->shortname);
     $this->assertEqual((string) $xml->label, (string) $root->semantic->label);
     $this->assertEqual((string) $xml->description, (string) $root->semantic->description);
     $this->assertEqual((string) $xml->field['REF'], (string) $root->semantic->field['REF']);
 }