]> source.dussan.org Git - nextcloud-server.git/commitdiff
Added functions to check etag of elements
authorSergio Bertolin <sbertolin@solidgear.es>
Thu, 13 Oct 2016 13:16:30 +0000 (13:16 +0000)
committerRoeland Jago Douma <roeland@famdouma.nl>
Wed, 2 Nov 2016 07:49:57 +0000 (08:49 +0100)
build/integration/features/bootstrap/WebDav.php

index cdb1fc3fdfd3ab87db40098785c4e8990391fddd..c59d035d1e730d3153d256e2aeffcd1ad0a78ac2 100644 (file)
@@ -42,6 +42,8 @@ trait WebDav {
        private $davPath = "remote.php/webdav";
        /** @var ResponseInterface */
        private $response;
+       /** @var array */
+       private $storedETAG = NULL;
 
        /**
         * @Given /^using dav path "([^"]*)"$/
@@ -599,4 +601,33 @@ trait WebDav {
        public function asGetsPropertiesOfFileWith($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]);
+       }
 }