public function itExportsAnonUser() { expect($this->user_xml_exporter)->exportUserByMail()->once(); $changeset = mock('Tracker_Artifact_Changeset'); stub($changeset)->getSubmittedBy()->returns(null); stub($changeset)->getEmail()->returns('*****@*****.**'); $this->exporter->exportFullHistory($this->artifact_xml, $changeset); }
/** * Add to $artifacts_xml the xml structure of an artifact */ public function exportFullHistory(SimpleXMLElement $artifacts_xml, Tracker_Artifact $artifact) { $artifact_xml = $artifacts_xml->addChild('artifact'); $artifact_xml->addAttribute('id', $artifact->getId()); foreach ($artifact->getChangesets() as $changeset) { $this->changeset_exporter->exportFullHistory($artifact_xml, $changeset); } }
public function itExportsTheComments() { $user = aUser()->withId(101)->withLdapId('ldap_01')->withUserName('user_01')->build(); stub($this->user_manager)->getUserById(101)->returns($user); expect($this->values_exporter)->exportChangedFields($this->artifact_xml, '*', $this->artifact, $this->values)->once(); expect($this->comment)->exportToXML()->once(); $this->exporter->exportFullHistory($this->artifact_xml, $this->changeset); }
public function itExportsTheFullHistory() { $changeset_01 = mock('Tracker_Artifact_Changeset'); $changeset_02 = mock('Tracker_Artifact_Changeset'); $changeset_03 = mock('Tracker_Artifact_Changeset'); $artifacts_xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?> <tracker> <artifacts/> </tracker>'); $changesets = array($changeset_01, $changeset_02, $changeset_03); $artifact = anArtifact()->withId(101)->withChangesets($changesets)->build(); $this->changeset_exporter->expectCallCount('exportFullHistory', 3); $this->exporter->exportFullHistory($artifacts_xml, $artifact); }
public function itRemovesNullValuesInChangesetValues() { $value = mock('Tracker_Artifact_ChangesetValue'); expect($this->values_exporter)->exportChangedFields('*', '*', '*', array(101 => $value))->once(); $changeset = stub('Tracker_Artifact_Changeset')->getValues()->returns(array(101 => $value, 102 => null)); $this->exporter->exportFullHistory($this->artifact_xml, $changeset); }