Esempio n. 1
0
 public function exportChildren(SimpleXMLElement $xml)
 {
     while ($artifact_id = $this->children_collector->pop()) {
         $artifact = $this->artifact_factory->getArtifactById($artifact_id);
         if (!$artifact) {
             continue;
         }
         $last_changeset = $artifact->getLastChangeset();
         $this->artifact_xml_updater->exportSnapshotWithoutComments($xml, $last_changeset);
         $index_last_artifact = count($xml->artifact) - 1;
         $this->file_xml_updater->update($xml->artifact[$index_last_artifact]);
     }
 }
Esempio n. 2
0
 private function processCopy(Tracker_Artifact_Changeset $from_changeset, PFUser $current_user, array $submitted_values)
 {
     $xml_artifacts = $this->getXMLRootNode();
     $this->xml_exporter->exportSnapshotWithoutComments($xml_artifacts, $from_changeset);
     $this->file_updater->update($xml_artifacts->artifact);
     $this->xml_updater->update($this->tracker, $xml_artifacts->artifact, $submitted_values, $current_user, $_SERVER['REQUEST_TIME']);
     $this->children_xml_exporter->exportChildren($xml_artifacts);
     $extraction_path = '';
     $artifact = $this->xml_importer->importOneArtifactFromXML($this->tracker, $xml_artifacts->artifact[0], $extraction_path);
     if ($artifact) {
         $this->artifacts_imported_mapping->add($from_changeset->getArtifact()->getId(), $artifact->getId());
         $this->children_xml_importer->importChildren($this->artifacts_imported_mapping, $xml_artifacts, $extraction_path, $artifact, $current_user);
         $this->addSummaryCommentChangeset($artifact, $current_user, $from_changeset);
         $this->redirectToArtifact($artifact);
     } else {
         $this->logsErrorAndRedirectToTracker('plugin_tracker', 'error_create_copy', $from_changeset->getArtifact()->getId());
     }
 }
 public function itReplacesThePathWithTheNewTempraryPath()
 {
     $this->updater->update($this->artifact_xml);
     $this->assertEqual((string) $this->artifact_xml->file[0]->path, '/tmp/toto.txt');
     $this->assertEqual((string) $this->artifact_xml->file[1]->path, '/tmp/Spec.doc');
 }