From 4480dca3e36b975a3d321a24798c8738aa45cf95 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 Signed-off-by: Lukas Reschke --- 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 dbdfafcecdc..8a0472f81ec 100644 --- a/build/integration/features/bootstrap/Provisioning.php +++ b/build/integration/features/bootstrap/Provisioning.php @@ -704,6 +704,15 @@ trait Provisioning { $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 57ca638ec7f..fb1a078fd94 100644 --- a/build/integration/features/bootstrap/WebDav.php +++ b/build/integration/features/bootstrap/WebDav.php @@ -499,7 +499,8 @@ trait WebDav { 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 456d4fce1eac5b55886290bd22e5ce8537034011 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 Signed-off-by: Lukas Reschke --- build/integration/features/bootstrap/BasicStructure.php | 4 ++-- build/integration/features/bootstrap/WebDav.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build/integration/features/bootstrap/BasicStructure.php b/build/integration/features/bootstrap/BasicStructure.php index 46647f97e85..24428b6c9d9 100644 --- a/build/integration/features/bootstrap/BasicStructure.php +++ b/build/integration/features/bootstrap/BasicStructure.php @@ -343,8 +343,8 @@ trait BasicStructure { file_put_contents("../../data/$user/files" . "$filename", "$text"); } - public function createFileSpecificSize($name, $size){ - $file = fopen("data/" . "$name", 'w'); + public function createFileSpecificSize($name, $size) { + $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 fb1a078fd94..e0a80c7f525 100644 --- a/build/integration/features/bootstrap/WebDav.php +++ b/build/integration/features/bootstrap/WebDav.php @@ -496,9 +496,9 @@ trait WebDav { 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 d1b8e58c86a7d175c4383634ee342c183ffd039c 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 Signed-off-by: Lukas Reschke --- 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 e0a80c7f525..680d8f96e7c 100644 --- a/build/integration/features/bootstrap/WebDav.php +++ b/build/integration/features/bootstrap/WebDav.php @@ -499,8 +499,8 @@ trait WebDav { 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 aad088f3c09e9cedc64493a3b12333330a25e9e8 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 Signed-off-by: Lukas Reschke --- 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 8a0472f81ec..0055ff15de0 100644 --- a/build/integration/features/bootstrap/Provisioning.php +++ b/build/integration/features/bootstrap/Provisioning.php @@ -704,6 +704,10 @@ trait Provisioning { $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();