Commit 4e47895f authored by Sergio Bertolin's avatar Sergio Bertolin
Browse files

Added functions to check etag of elements

parent 6b8e8edc
......@@ -16,6 +16,8 @@ trait WebDav {
private $usingOldDavPath = true;
/** @var ResponseInterface */
private $response;
/** @var array */
private $storedETAG = NULL;
/**
* @Given /^using dav path "([^"]*)"$/
......@@ -585,4 +587,33 @@ trait WebDav {
return $response;
}
/**
* @Given user :user stores etag of element :path
*/
public function userStoresEtagOfElement($user, $path){
$propertiesTable = new \Behat\Gherkin\Node\TableNode([['{DAV:}getetag']]);
$this->asGetsPropertiesOfFolderWith($user, NULL, $path, $propertiesTable);
$pathETAG[$path] = $this->response['{DAV:}getetag'];
$this->storedETAG[$user]= $pathETAG;
print_r($this->storedETAG[$user][$path]);
}
/**
* @Then etag of element :path of user :user has not changed
*/
public function checkIfETAGHasNotChanged($path, $user){
$propertiesTable = new \Behat\Gherkin\Node\TableNode([['{DAV:}getetag']]);
$this->asGetsPropertiesOfFolderWith($user, NULL, $path, $propertiesTable);
PHPUnit_Framework_Assert::assertEquals($this->response['{DAV:}getetag'], $this->storedETAG[$user][$path]);
}
/**
* @Then etag of element :path of user :user has changed
*/
public function checkIfETAGHasChanged($path, $user){
$propertiesTable = new \Behat\Gherkin\Node\TableNode([['{DAV:}getetag']]);
$this->asGetsPropertiesOfFolderWith($user, NULL, $path, $propertiesTable);
PHPUnit_Framework_Assert::assertNotEquals($this->response['{DAV:}getetag'], $this->storedETAG[$user][$path]);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment