From 340b589292acc9d438e8339ada55ebb50ff8497e Mon Sep 17 00:00:00 2001 From: Sergio Bertolin Date: Wed, 29 Mar 2017 07:55:11 +0000 Subject: [PATCH] Making getShares more reusable --- .../features/bootstrap/Sharing.php | 23 +++++++++++-------- tests/integration/features/sharing-v1.feature | 2 +- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/tests/integration/features/bootstrap/Sharing.php b/tests/integration/features/bootstrap/Sharing.php index e4875b836f..034f98ff8a 100644 --- a/tests/integration/features/bootstrap/Sharing.php +++ b/tests/integration/features/bootstrap/Sharing.php @@ -512,14 +512,8 @@ trait Sharing { } } - /** - * @When /^user "([^"]*)" gets shares of (file|folder) "([^"]*)"$/ - * @param string $user - * @param string $type - * @param string $path - * @param \Behat\Gherkin\Node\TableNode|null $body - */ - public function getShares($user, $type, $path, $TableNode){ + /* Returns shares of a file or folders as an array of elements */ + public function getShares($user, $path) { $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares"; $fullUrl = $fullUrl . '?path=' . $path; @@ -533,7 +527,18 @@ trait Sharing { } $this->response = $client->send($client->createRequest("GET", $fullUrl, $options)); - $dataResponded = $this->response->xml()->data->element; + return $this->response->xml()->data->element; + } + + /** + * @When /^user "([^"]*)" checks public shares of (file|folder) "([^"]*)"$/ + * @param string $user + * @param string $type + * @param string $path + * @param \Behat\Gherkin\Node\TableNode|null $body + */ + public function checkPublicShares($user, $type, $path, $TableNode){ + $dataResponded = $this->getShares($user, $path); if ($TableNode instanceof \Behat\Gherkin\Node\TableNode) { $elementRows = $TableNode->getRows(); diff --git a/tests/integration/features/sharing-v1.feature b/tests/integration/features/sharing-v1.feature index 5fb514a06d..9f15d2127d 100644 --- a/tests/integration/features/sharing-v1.feature +++ b/tests/integration/features/sharing-v1.feature @@ -1198,7 +1198,7 @@ Feature: sharing | permissions | 1 | Then the OCS status code should be "100" And the HTTP status code should be "200" - And user "user0" gets shares of folder "/FOLDER" + And user "user0" checks public shares of folder "/FOLDER" | /FOLDER | 15 | sharedlink2 | | /FOLDER | 15 | sharedlink1 | | /FOLDER | 1 | sharedlink3 | -- GitLab