From 2296026012f5b65de11375c84e114e5d432e4240 Mon Sep 17 00:00:00 2001 From: Sergio Bertolin Date: Thu, 22 Dec 2016 10:07:01 +0000 Subject: [PATCH 1/4] Added support for homes which doesn't have user's name --- build/integration/features/bootstrap/Provisioning.php | 9 +++++++++ build/integration/features/bootstrap/WebDav.php | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/build/integration/features/bootstrap/Provisioning.php b/build/integration/features/bootstrap/Provisioning.php index f4ac9f3346a3..b43d9d5f002e 100644 --- a/build/integration/features/bootstrap/Provisioning.php +++ b/build/integration/features/bootstrap/Provisioning.php @@ -637,6 +637,15 @@ public function userHasUnlimitedQuota($user) $this->userHasAQuotaOf($user, 'none'); } + public function getUserHome($user) { + $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/cloud/users/$user"; + $client = new Client(); + $options = []; + $options['auth'] = $this->adminUser; + $this->response = $client->get($fullUrl, $options); + return $this->response->xml()->data[0]->home; + } + /** * @BeforeScenario * @AfterScenario diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php index 97aaf4fffabc..53534ba2590e 100644 --- a/build/integration/features/bootstrap/WebDav.php +++ b/build/integration/features/bootstrap/WebDav.php @@ -444,7 +444,8 @@ public function userAddsAFileTo($user, $bytes, $destination){ PHPUnit_Framework_Assert::assertEquals(1, file_exists("data/$filename")); $this->userUploadsAFileTo($user, "data/$filename", $destination); $this->removeFile("data/", $filename); - PHPUnit_Framework_Assert::assertEquals(1, file_exists("../../data/$user/files$destination")); + $userHome = $this->getUserHome($user); + PHPUnit_Framework_Assert::assertEquals(1, file_exists($userHome . "/files$destination")); } /** From 7e9c516200d6023e129b2471afe728afb3ee8f7d Mon Sep 17 00:00:00 2001 From: Sergio Bertolin Date: Thu, 22 Dec 2016 10:17:01 +0000 Subject: [PATCH 2/4] Changed data directory for work one --- build/integration/features/bootstrap/BasicStructure.php | 2 +- build/integration/features/bootstrap/WebDav.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/integration/features/bootstrap/BasicStructure.php b/build/integration/features/bootstrap/BasicStructure.php index 5b245f33e230..a816c298449d 100644 --- a/build/integration/features/bootstrap/BasicStructure.php +++ b/build/integration/features/bootstrap/BasicStructure.php @@ -312,7 +312,7 @@ public function emptyTrashbin($user) { } public function createFileSpecificSize($name, $size){ - $file = fopen("data/" . "$name", 'w'); + $file = fopen("work/" . "$name", 'w'); fseek($file, $size - 1 ,SEEK_CUR); fwrite($file,'a'); // write a dummy char at SIZE position fclose($file); diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php index 53534ba2590e..8c6b7a092286 100644 --- a/build/integration/features/bootstrap/WebDav.php +++ b/build/integration/features/bootstrap/WebDav.php @@ -441,9 +441,9 @@ public function userUploadsAFileTo($user, $source, $destination) public function userAddsAFileTo($user, $bytes, $destination){ $filename = "filespecificSize.txt"; $this->createFileSpecificSize($filename, $bytes); - PHPUnit_Framework_Assert::assertEquals(1, file_exists("data/$filename")); - $this->userUploadsAFileTo($user, "data/$filename", $destination); - $this->removeFile("data/", $filename); + PHPUnit_Framework_Assert::assertEquals(1, file_exists("work/$filename")); + $this->userUploadsAFileTo($user, "work/$filename", $destination); + $this->removeFile("work/", $filename); $userHome = $this->getUserHome($user); PHPUnit_Framework_Assert::assertEquals(1, file_exists($userHome . "/files$destination")); } From 30627cfdbedf235c12eaf80faf00dcd8ef09aecd Mon Sep 17 00:00:00 2001 From: Sergio Bertolin Date: Thu, 22 Dec 2016 11:35:03 +0000 Subject: [PATCH 3/4] Using propfind instead of accessing the file system --- build/integration/features/bootstrap/WebDav.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php index 8c6b7a092286..dd05a5551748 100644 --- a/build/integration/features/bootstrap/WebDav.php +++ b/build/integration/features/bootstrap/WebDav.php @@ -444,8 +444,8 @@ public function userAddsAFileTo($user, $bytes, $destination){ PHPUnit_Framework_Assert::assertEquals(1, file_exists("work/$filename")); $this->userUploadsAFileTo($user, "work/$filename", $destination); $this->removeFile("work/", $filename); - $userHome = $this->getUserHome($user); - PHPUnit_Framework_Assert::assertEquals(1, file_exists($userHome . "/files$destination")); + $expectedElements = new \Behat\Gherkin\Node\TableNode([["$destination"]]); + $this->checkElementList($user, $expectedElements); } /** From 343bebd201e56caacaf9fe5e00781498cb03af8f Mon Sep 17 00:00:00 2001 From: Sergio Bertolin Date: Thu, 22 Dec 2016 11:58:36 +0000 Subject: [PATCH 4/4] Added phpdoc for getUserHome --- build/integration/features/bootstrap/Provisioning.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build/integration/features/bootstrap/Provisioning.php b/build/integration/features/bootstrap/Provisioning.php index b43d9d5f002e..7e8509f95f31 100644 --- a/build/integration/features/bootstrap/Provisioning.php +++ b/build/integration/features/bootstrap/Provisioning.php @@ -637,6 +637,10 @@ public function userHasUnlimitedQuota($user) $this->userHasAQuotaOf($user, 'none'); } + /** + * Returns home path of the given user + * @param string $user + */ public function getUserHome($user) { $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/cloud/users/$user"; $client = new Client();