Added functions to check etag of elements

This commit is contained in:
Sergio Bertolin 2016-10-13 13:16:30 +00:00 committed by Roeland Jago Douma
parent 19af06cdea
commit a3c3ec9dd7
No known key found for this signature in database
GPG Key ID: 1E152838F164D13B
1 changed files with 31 additions and 0 deletions

View File

@ -42,6 +42,8 @@ trait WebDav {
private $davPath = "remote.php/webdav"; private $davPath = "remote.php/webdav";
/** @var ResponseInterface */ /** @var ResponseInterface */
private $response; private $response;
/** @var array */
private $storedETAG = NULL;
/** /**
* @Given /^using dav path "([^"]*)"$/ * @Given /^using dav path "([^"]*)"$/
@ -599,4 +601,33 @@ trait WebDav {
public function asGetsPropertiesOfFileWith($user, $path, $propertiesTable) { public function asGetsPropertiesOfFileWith($user, $path, $propertiesTable) {
$this->asGetsPropertiesOfFolderWith($user, $path, $propertiesTable); $this->asGetsPropertiesOfFolderWith($user, $path, $propertiesTable);
} }
/**
* @Given user :user stores etag of element :path
*/
public function userStoresEtagOfElement($user, $path){
$propertiesTable = new \Behat\Gherkin\Node\TableNode([['{DAV:}getetag']]);
$this->asGetsPropertiesOfFolderWith($user, $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, $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, $path, $propertiesTable);
PHPUnit_Framework_Assert::assertNotEquals($this->response['{DAV:}getetag'], $this->storedETAG[$user][$path]);
}
} }