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 testFieldDateShouldSendAMailWithAReadableDate() { $artifact = new MockTracker_Artifact(); $date = new Tracker_FormElement_Field_DateTestVersion(); $date->setReturnValue('formatDate', '2011-12-01', array(1322752769)); $value = new MockTracker_Artifact_ChangesetValue_Date(); $value->setReturnValue('getTimestamp', 1322752769); $this->assertEqual('2011-12-01', $date->fetchMailArtifactValue($artifact, $value, 'text')); $this->assertEqual('2011-12-01', $date->fetchMailArtifactValue($artifact, $value, 'html')); }