public function testExportPropertiesToXMLDisplayTimeWhenDisplayTimeIsZero() { $xml_test = simplexml_load_file(dirname(__FILE__) . '/_fixtures/ImportTrackerFormElementDatePropertiesDisplayTimeZero.xml'); $date_field = new Tracker_FormElement_Field_DateTestVersion(); $properties = array('display_time' => array('type' => 'checkbox', 'value' => 0)); $date_field->setReturnReference('getProperties', $properties); $date_field->setReturnValue('getProperty', 0, array('display_time')); $root = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><tracker />'); $date_field->exportPropertiesToXML($root); $this->assertEqual((string) $xml_test->properties, (string) $root->properties); $this->assertEqual(count($root->properties->attributes()), 1); $attr = $root->properties->attributes(); $this->assertEqual('0', (string) $attr->display_time); }
function testExportPropertiesToXMLDefaultValueSpecificDate() { $xml_test = simplexml_load_file(dirname(__FILE__) . '/_fixtures/ImportTrackerFormElementDatePropertiesDefaultValueSpecificDateTest.xml'); $date_field = new Tracker_FormElement_Field_DateTestVersion(); $properties = array('default_value_type' => array('type' => 'radio', 'value' => 1, 'choices' => array('default_value_today' => array('radio_value' => 0, 'type' => 'label', 'value' => 'today'), 'default_value' => array('radio_value' => 1, 'type' => 'date', 'value' => '1234567890')))); $date_field->setReturnReference('getProperties', $properties); $root = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><tracker xmlns="http://codendi.org/tracker" />'); $date_field->exportPropertiesToXML($root); $this->assertEqual((string) $xml_test->properties, (string) $root->properties); $this->assertEqual(count($root->properties->attributes()), 1); $attr = $root->properties->attributes(); $this->assertEqual('1234567890', (string) $attr->default_value); }