Modificacion en feature step, adhoc y adicion de nuevos escenarios en el feature project y project import export

This commit is contained in:
Wendy Nestor
2014-07-28 10:48:37 -04:00
parent 5487aa27c0
commit 464bd07af8
5 changed files with 182 additions and 36 deletions

View File

@@ -1629,8 +1629,56 @@ class RestContext extends BehatContext
}
if (!$swFound) {
//print_r($this->_data);
throw new \Exception("JSON Response does not have '$varName' property\n\n" );
$this->printDebug("JSON Response does not have '$sessionVarName' property\n\n");
//throw new \Exception("JSON Response does not have '$sessionVarName' property\n\n" );
}
}
/**
* @Given /^that "([^"]*)" property in object "([^"]*)" equals "([^"]*)"$/
*/
public function thatPropertyInObjectEquals($propertyName, $propertyParent, $value)
{
$data = $this->_data;
if (empty($data)) {
throw new Exception("Response is empty or was not JSON\n\n"
. $this->_response->getBody(true));
return;
}
if (!isset($data->$propertyParent)) {
throw new Exception("Response has not the property '$propertyParent'\n\n"
. $this->_response->getBody(true));
return;
}
$data = $data->$propertyParent;
if (!empty($data)) {
if (!is_object($data)) {
throw new Exception("the $propertyParent in Response data is not an object!\n\n" );
}
if (!isset($data->$propertyName)) {
throw new Exception("Property '"
. $propertyName . "' is not set!\n\n"
);
}
if (is_array($data->$propertyName)) {
throw new Exception("$propertyName is an array and we expected a value\n\n"
. $this->_response->getBody(true));
}
if ($data->$propertyName != $propertyValue) {
throw new \Exception('Property value mismatch! (given: '
. $propertyValue . ', match: '
. $data->$propertyName . ")\n\n"
);
}
} else {
throw new Exception("Response was not JSON\n\n"
. $this->_response->getBody(true));
}
}
/**
* @Given /^save exported process to "([^"]*)"$/