From 9ab17c95c0746cced8a4f36bec58dc98ee229ef3 Mon Sep 17 00:00:00 2001 From: Sergio Bertolin Date: Mon, 27 Mar 2017 10:27:23 +0000 Subject: Added test about checking file id after a move --- build/integration/features/bootstrap/WebDav.php | 35 +++++++++++++++++++++-- build/integration/features/webdav-related.feature | 12 ++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) (limited to 'build') diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php index 3a018a2d0fa..9242b80ac13 100644 --- a/build/integration/features/bootstrap/WebDav.php +++ b/build/integration/features/bootstrap/WebDav.php @@ -45,8 +45,10 @@ trait WebDav { private $usingOldDavPath = true; /** @var ResponseInterface */ private $response; - /** @var map with user as key and another map as value, which has path as key and etag as value */ - private $storedETAG = NULL; + /** @var array map with user as key and another map as value, which has path as key and etag as value */ + private $storedETAG = null; + /** @var int */ + private $storedFileID = null; /** * @Given /^using dav path "([^"]*)"$/ @@ -749,4 +751,33 @@ trait WebDav { } + /** + * @param string $user + * @param string $path + * @return int + */ + private function getFileIdForPath($user, $path) { + $propertiesTable = new \Behat\Gherkin\Node\TableNode([["{http://owncloud.org/ns}fileid"]]); + $this->asGetsPropertiesOfFolderWith($user, 'file', $path, $propertiesTable); + return (int) $this->response['{http://owncloud.org/ns}fileid']; + } + + /** + * @Given /^User "([^"]*)" stores id of file "([^"]*)"$/ + * @param string $user + * @param string $path + */ + public function userStoresFileIdForPath($user, $path) { + $this->storedFileID = $this->getFileIdForPath($user, $path); + } + + /** + * @Given /^User "([^"]*)" checks id of file "([^"]*)"$/ + * @param string $user + * @param string $path + */ + public function userChecksFileIdForPath($user, $path) { + $currentFileID = $this->getFileIdForPath($user, $path); + PHPUnit_Framework_Assert::assertEquals($currentFileID, $this->storedFileID); + } } diff --git a/build/integration/features/webdav-related.feature b/build/integration/features/webdav-related.feature index 6aee59036d3..457d92d52a6 100644 --- a/build/integration/features/webdav-related.feature +++ b/build/integration/features/webdav-related.feature @@ -517,3 +517,15 @@ Feature: webdav-related | /textfile2.txt | | /textfile3.txt | | /textfile4.txt | + + Scenario: Checking file id after a move using new endpoint + Given using new dav path + And user "user0" exists + And user "user0" creates a new chunking upload with id "chunking-42" + And user "user0" uploads new chunk file "1" with "AAAAA" to id "chunking-42" + And user "user0" uploads new chunk file "2" with "BBBBB" to id "chunking-42" + And user "user0" uploads new chunk file "3" with "CCCCC" to id "chunking-42" + And user "user0" moves new chunk file with id "chunking-42" to "/myChunkedFile.txt" + And User "user0" stores id of file "/myChunkedFile.txt" + When User "user0" moves file "/myChunkedFile.txt" to "/FOLDER/myChunkedFile.txt" + Then User "user0" checks id of file "/FOLDER/myChunkedFile.txt" -- cgit v1.2.3