Culminacion del behat para export/import proyect y nueva funcion para en rest para guardar el proyecto exportado

This commit is contained in:
Wendy Nestor
2014-05-19 10:42:08 -04:00
parent 0bfd6b8310
commit 0b2033d210
3 changed files with 205 additions and 39 deletions

View File

@@ -1623,4 +1623,29 @@ class RestContext extends BehatContext
throw new \Exception("JSON Response does not have '$varName' property\n\n" );
}
}
/**
* @Given /^save exported process to "([^"]*)"$/
* @Given /^save exported process to "([^"]*)" as "([^"]*)"$/
*/
public function saveExportedProcessTo($destinationFolder, $exportedProcessFileName="")
{
if($exportedProcessFileName == ""){//Obtain name from XML
$exportedProcessFileName=$this->_data->xpath('//metadata/meta[@key="name"]');
$exportedProcessFileName = $exportedProcessFileName[0];
$exportedProcessFileName = "ExpBehat ".$exportedProcessFileName;
}
$exportedProcessFileName = $destinationFolder.str_replace(" ","_",$exportedProcessFileName).".pmx";
$this->printDebug("Exporting process to: $exportedProcessFileName");
file_put_contents($exportedProcessFileName, $this->_response->getBody(true));
}
}