From 9be7f4d19d34976ca5c584bfc122ab7b6ac854ac Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 11 Mar 2016 10:04:06 +0100 Subject: [PATCH 01/16] Fix docs --- .../features/bootstrap/Sharing.php | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/build/integration/features/bootstrap/Sharing.php b/build/integration/features/bootstrap/Sharing.php index da2e9ca109..79c5a69883 100644 --- a/build/integration/features/bootstrap/Sharing.php +++ b/build/integration/features/bootstrap/Sharing.php @@ -22,7 +22,8 @@ trait Sharing{ /** * @Given /^as "([^"]*)" creating a share with$/ - * @param \Behat\Gherkin\Node\TableNode|null $formData + * @param string $user + * @param \Behat\Gherkin\Node\TableNode|null $body */ public function asCreatingAShareWith($user, $body) { $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/apps/files_sharing/api/v1/shares"; @@ -54,7 +55,7 @@ trait Sharing{ /** * @When /^creating a share with$/ - * @param \Behat\Gherkin\Node\TableNode|null $formData + * @param \Behat\Gherkin\Node\TableNode|null $body */ public function creatingShare($body) { return $this->asCreatingAShareWith($this->currentUser, $body); @@ -247,6 +248,8 @@ trait Sharing{ /** * @Then /^File "([^"]*)" should be included in the response$/ + * + * @param string $filename */ public function checkSharedFileInResponse($filename){ PHPUnit_Framework_Assert::assertEquals(True, $this->isFieldInResponse('file_target', "/$filename")); @@ -254,6 +257,8 @@ trait Sharing{ /** * @Then /^File "([^"]*)" should not be included in the response$/ + * + * @param string $filename */ public function checkSharedFileNotInResponse($filename){ PHPUnit_Framework_Assert::assertEquals(False, $this->isFieldInResponse('file_target', "/$filename")); @@ -261,6 +266,8 @@ trait Sharing{ /** * @Then /^User "([^"]*)" should be included in the response$/ + * + * @param string $user */ public function checkSharedUserInResponse($user){ PHPUnit_Framework_Assert::assertEquals(True, $this->isFieldInResponse('share_with', "$user")); @@ -268,6 +275,8 @@ trait Sharing{ /** * @Then /^User "([^"]*)" should not be included in the response$/ + * + * @param string $user */ public function checkSharedUserNotInResponse($user){ PHPUnit_Framework_Assert::assertEquals(False, $this->isFieldInResponse('share_with', "$user")); @@ -285,6 +294,10 @@ trait Sharing{ /** * @Given /^file "([^"]*)" of user "([^"]*)" is shared with user "([^"]*)"$/ + * + * @param string $filepath + * @param string $user1 + * @param string $user2 */ public function assureFileIsShared($filepath, $user1, $user2){ $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares" . "?path=$filepath"; @@ -307,6 +320,10 @@ trait Sharing{ /** * @Given /^file "([^"]*)" of user "([^"]*)" is shared with group "([^"]*)"$/ + * + * @param string $filepath + * @param string $user + * @param string $group */ public function assureFileIsSharedWithGroup($filepath, $user, $group){ $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares" . "?path=$filepath"; @@ -367,7 +384,7 @@ trait Sharing{ /** * @Then /^Share fields of last share match with$/ - * @param \Behat\Gherkin\Node\TableNode|null $formData + * @param \Behat\Gherkin\Node\TableNode|null $body */ public function checkShareFields($body){ if ($body instanceof \Behat\Gherkin\Node\TableNode) { From 985b11876f8acb2aaacf55e1b4c7f6b71a0a2e1f Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 11 Mar 2016 10:04:25 +0100 Subject: [PATCH 02/16] asCreatingAShareWith has no return --- build/integration/features/bootstrap/Sharing.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/integration/features/bootstrap/Sharing.php b/build/integration/features/bootstrap/Sharing.php index 79c5a69883..8e6eea6be5 100644 --- a/build/integration/features/bootstrap/Sharing.php +++ b/build/integration/features/bootstrap/Sharing.php @@ -58,7 +58,7 @@ trait Sharing{ * @param \Behat\Gherkin\Node\TableNode|null $body */ public function creatingShare($body) { - return $this->asCreatingAShareWith($this->currentUser, $body); + $this->asCreatingAShareWith($this->currentUser, $body); } /** From 95a751865381be61943056b5fccdf7c222462227 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 11 Mar 2016 10:05:26 +0100 Subject: [PATCH 03/16] Remove hardcoded api versions --- build/integration/features/bootstrap/Sharing.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/integration/features/bootstrap/Sharing.php b/build/integration/features/bootstrap/Sharing.php index 8e6eea6be5..13f9589393 100644 --- a/build/integration/features/bootstrap/Sharing.php +++ b/build/integration/features/bootstrap/Sharing.php @@ -26,7 +26,7 @@ trait Sharing{ * @param \Behat\Gherkin\Node\TableNode|null $body */ public function asCreatingAShareWith($user, $body) { - $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/apps/files_sharing/api/v1/shares"; + $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares"; $client = new Client(); $options = []; if ($user === 'admin') { @@ -402,7 +402,7 @@ trait Sharing{ * @Then As :user remove all shares from the file named :fileName */ public function asRemoveAllSharesFromTheFileNamed($user, $fileName) { - $url = $this->baseUrl.'v2.php/apps/files_sharing/api/v1/shares?format=json'; + $url = $this->baseUrl . "v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares?format=json"; $client = new \GuzzleHttp\Client(); $res = $client->get( $url, @@ -422,7 +422,7 @@ trait Sharing{ if (stripslashes($data['path']) === $fileName) { $id = $data['id']; $client->delete( - $this->baseUrl.'v2.php/apps/files_sharing/api/v1/shares/'.$id, + $this->baseUrl . "v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares/{$id}", [ 'auth' => [ $user, From 5f7502de6cbae156ae9bef5fb8db7390e9b5aa21 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 11 Mar 2016 10:05:54 +0100 Subject: [PATCH 04/16] Fix type in class name --- build/integration/features/bootstrap/Sharing.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/integration/features/bootstrap/Sharing.php b/build/integration/features/bootstrap/Sharing.php index 13f9589393..dede98157d 100644 --- a/build/integration/features/bootstrap/Sharing.php +++ b/build/integration/features/bootstrap/Sharing.php @@ -456,7 +456,7 @@ trait Sharing{ public function shareIdsShouldMatch() { if ($this->savedShareId !== $this->lastShareData['data']['id']) { - throw new \Excetion('Expected the same link share to be returned'); + throw new \Exception('Expected the same link share to be returned'); } } } From 62b77d8ed0cc1ea8d328f8c26e2ff69da0171a6d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 11 Mar 2016 10:23:38 +0100 Subject: [PATCH 05/16] API version needs to be on basic because we use it there --- .../features/bootstrap/BasicStructure.php | 16 +++++++++++----- .../features/bootstrap/Provisioning.php | 7 ------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/build/integration/features/bootstrap/BasicStructure.php b/build/integration/features/bootstrap/BasicStructure.php index 0084597836..47358d2ccf 100644 --- a/build/integration/features/bootstrap/BasicStructure.php +++ b/build/integration/features/bootstrap/BasicStructure.php @@ -1,7 +1,5 @@ apiVersion = $version; + } + /** * @Given /^As an "([^"]*)"$/ */ @@ -248,7 +257,6 @@ trait BasicStructure { mkdir("../../core/skeleton/PARENT/CHILD", 0777, true); } file_put_contents("../../core/skeleton/PARENT/CHILD/" . "child.txt", "ownCloud test text file\n"); - } /** @@ -269,8 +277,6 @@ trait BasicStructure { if (is_dir("../../core/skeleton/PARENT")) { rmdir("../../core/skeleton/PARENT"); } - - } } diff --git a/build/integration/features/bootstrap/Provisioning.php b/build/integration/features/bootstrap/Provisioning.php index 6d710b2016..a3359ac96d 100644 --- a/build/integration/features/bootstrap/Provisioning.php +++ b/build/integration/features/bootstrap/Provisioning.php @@ -24,13 +24,6 @@ trait Provisioning { /** @var array */ private $createdGroups = []; - /** - * @Given /^using api version "([^"]*)"$/ - */ - public function usingApiVersion($version) { - $this->apiVersion = $version; - } - /** * @Given /^user "([^"]*)" exists$/ */ From 26e974d85980c44c476af1dfc5b56368f4d98f09 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 11 Mar 2016 10:23:11 +0100 Subject: [PATCH 06/16] Fix inheritance of members --- .../bootstrap/CapabilitiesContext.php | 2 -- .../features/bootstrap/Provisioning.php | 35 +++++++++++++++---- .../features/bootstrap/Sharing.php | 7 ++-- 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/build/integration/features/bootstrap/CapabilitiesContext.php b/build/integration/features/bootstrap/CapabilitiesContext.php index 83d5f5fd2f..0eb6353a89 100644 --- a/build/integration/features/bootstrap/CapabilitiesContext.php +++ b/build/integration/features/bootstrap/CapabilitiesContext.php @@ -15,8 +15,6 @@ require __DIR__ . '/../../vendor/autoload.php'; class CapabilitiesContext implements Context, SnippetAcceptingContext { use BasicStructure; - use Provisioning; - use Sharing; /** * @Given /^parameter "([^"]*)" of app "([^"]*)" is set to "([^"]*)"$/ diff --git a/build/integration/features/bootstrap/Provisioning.php b/build/integration/features/bootstrap/Provisioning.php index a3359ac96d..bf84058c05 100644 --- a/build/integration/features/bootstrap/Provisioning.php +++ b/build/integration/features/bootstrap/Provisioning.php @@ -1,16 +1,12 @@ baseUrl . "v2.php/cloud/users/$user/groups"; @@ -160,7 +160,6 @@ trait Provisioning { } $this->response = $client->get($fullUrl, $options); - $groups = array($group); $respondedArray = $this->getArrayOfGroupsResponded($this->response); if (array_key_exists($group, $respondedArray)) { @@ -172,6 +171,8 @@ trait Provisioning { /** * @Given /^user "([^"]*)" belongs to group "([^"]*)"$/ + * @param string $user + * @param string $group */ public function assureUserBelongsToGroup($user, $group){ if (!$this->userBelongsToGroup($user, $group)){ @@ -186,6 +187,8 @@ trait Provisioning { /** * @Given /^user "([^"]*)" does not belong to group "([^"]*)"$/ + * @param string $user + * @param string $group */ public function userDoesNotBelongToGroup($user, $group) { $fullUrl = $this->baseUrl . "v2.php/cloud/users/$user/groups"; @@ -202,8 +205,9 @@ trait Provisioning { PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode()); } - /** + /** * @When /^creating the group "([^"]*)"$/ + * @param string $group */ public function creatingTheGroup($group) { $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/cloud/groups"; @@ -227,6 +231,7 @@ trait Provisioning { /** * @When /^Deleting the user "([^"]*)"$/ + * @param string $user */ public function deletingTheUser($user) { $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/cloud/users/$user"; @@ -241,6 +246,7 @@ trait Provisioning { /** * @When /^Deleting the group "([^"]*)"$/ + * @param string $group */ public function deletingTheGroup($group) { $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/cloud/groups/$group"; @@ -255,6 +261,8 @@ trait Provisioning { /** * @Given /^Add user "([^"]*)" to the group "([^"]*)"$/ + * @param string $user + * @param string $group */ public function addUserToGroup($user, $group) { $this->userExists($user); @@ -265,6 +273,8 @@ trait Provisioning { /** * @When /^User "([^"]*)" is added to the group "([^"]*)"$/ + * @param string $user + * @param string $group */ public function addingUserToGroup($user, $group) { $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/cloud/users/$user/groups"; @@ -293,6 +303,7 @@ trait Provisioning { /** * @Given /^group "([^"]*)" exists$/ + * @param string $group */ public function assureGroupExists($group) { try { @@ -309,6 +320,7 @@ trait Provisioning { /** * @Given /^group "([^"]*)" does not exist$/ + * @param string $group */ public function groupDoesNotExist($group) { try { @@ -332,6 +344,8 @@ trait Provisioning { /** * @Given /^user "([^"]*)" is subadmin of group "([^"]*)"$/ + * @param string $user + * @param string $group */ public function userIsSubadminOfGroup($user, $group) { $fullUrl = $this->baseUrl . "v2.php/cloud/groups/$group/subadmins"; @@ -350,6 +364,8 @@ trait Provisioning { /** * @Given /^user "([^"]*)" is not a subadmin of group "([^"]*)"$/ + * @param string $user + * @param string $group */ public function userIsNotSubadminOfGroup($user, $group) { $fullUrl = $this->baseUrl . "v2.php/cloud/groups/$group/subadmins"; @@ -477,6 +493,7 @@ trait Provisioning { /** * @Given /^app "([^"]*)" is disabled$/ + * @param string $app */ public function appIsDisabled($app) { $fullUrl = $this->baseUrl . "v2.php/cloud/apps?filter=disabled"; @@ -494,6 +511,7 @@ trait Provisioning { /** * @Given /^app "([^"]*)" is enabled$/ + * @param string $app */ public function appIsEnabled($app) { $fullUrl = $this->baseUrl . "v2.php/cloud/apps?filter=enabled"; @@ -511,6 +529,8 @@ trait Provisioning { /** * @Given user :user has a quota of :quota + * @param string $user + * @param string $quota */ public function userHasAQuotaOf($user, $quota) { @@ -525,6 +545,7 @@ trait Provisioning { /** * @Given user :user has unlimited quota + * @param string $user */ public function userHasUnlimitedQuota($user) { diff --git a/build/integration/features/bootstrap/Sharing.php b/build/integration/features/bootstrap/Sharing.php index dede98157d..5932194d14 100644 --- a/build/integration/features/bootstrap/Sharing.php +++ b/build/integration/features/bootstrap/Sharing.php @@ -1,7 +1,5 @@ lastShareData->data[0]->id; + $share_id = (string) $this->lastShareData->data[0]->id; $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares/$share_id"; $client = new Client(); $options = []; @@ -133,7 +132,7 @@ trait Sharing{ * @param \Behat\Gherkin\Node\TableNode|null $body */ public function updatingLastShare($body) { - $share_id = $this->lastShareData->data[0]->id; + $share_id = (string) $this->lastShareData->data[0]->id; $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares/$share_id"; $client = new Client(); $options = []; From cdc5470f7ec177df78463fe7a16270695593e3cb Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 11 Mar 2016 10:25:35 +0100 Subject: [PATCH 07/16] Fix the use of traits --- build/integration/features/bootstrap/FeatureContext.php | 2 -- build/integration/features/bootstrap/FederationContext.php | 2 -- 2 files changed, 4 deletions(-) diff --git a/build/integration/features/bootstrap/FeatureContext.php b/build/integration/features/bootstrap/FeatureContext.php index 78ff4e7833..065985b22c 100644 --- a/build/integration/features/bootstrap/FeatureContext.php +++ b/build/integration/features/bootstrap/FeatureContext.php @@ -12,8 +12,6 @@ require __DIR__ . '/../../vendor/autoload.php'; * Features context. */ class FeatureContext implements Context, SnippetAcceptingContext { - use BasicStructure; - use Provisioning; use Sharing; use WebDav; } diff --git a/build/integration/features/bootstrap/FederationContext.php b/build/integration/features/bootstrap/FederationContext.php index 279b5206de..931c3d45ec 100644 --- a/build/integration/features/bootstrap/FederationContext.php +++ b/build/integration/features/bootstrap/FederationContext.php @@ -12,8 +12,6 @@ require __DIR__ . '/../../vendor/autoload.php'; */ class FederationContext implements Context, SnippetAcceptingContext { - use BasicStructure; - use Provisioning; use Sharing; /** From 6381c22a7dfb28fd0ff6e5df2c77491845e6a30d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 11 Mar 2016 10:30:40 +0100 Subject: [PATCH 08/16] Remove trailing spaces --- build/integration/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/integration/composer.json b/build/integration/composer.json index a9516391a4..9e5335c4b2 100644 --- a/build/integration/composer.json +++ b/build/integration/composer.json @@ -4,6 +4,6 @@ "behat/behat": "^3.0", "guzzlehttp/guzzle": "~5.0", "jarnaiz/behat-junit-formatter": "^1.3", - "sabre/dav": "3.0.x-dev" + "sabre/dav": "3.0.x-dev" } } From 0f214017d2d819cc54e7fc37c327e6f5c8dc2f2d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 11 Mar 2016 10:37:21 +0100 Subject: [PATCH 09/16] Docs for BasicStructure --- .../features/bootstrap/BasicStructure.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/build/integration/features/bootstrap/BasicStructure.php b/build/integration/features/bootstrap/BasicStructure.php index 47358d2ccf..4ff7403bb1 100644 --- a/build/integration/features/bootstrap/BasicStructure.php +++ b/build/integration/features/bootstrap/BasicStructure.php @@ -62,6 +62,7 @@ trait BasicStructure { /** * @Given /^As an "([^"]*)"$/ + * @param string $user */ public function asAn($user) { $this->currentUser = $user; @@ -69,6 +70,7 @@ trait BasicStructure { /** * @Given /^Using server "([^"]*)"$/ + * @param string $server */ public function usingServer($server) { if ($server === 'LOCAL'){ @@ -84,6 +86,8 @@ trait BasicStructure { /** * @When /^sending "([^"]*)" to "([^"]*)"$/ + * @param string $verb + * @param string $url */ public function sendingTo($verb, $url) { $this->sendingToWith($verb, $url, null); @@ -101,6 +105,8 @@ trait BasicStructure { /** * This function is needed to use a vertical fashion in the gherkin tables. + * @param array $arrayOfArrays + * @return array */ public function simplifyArray($arrayOfArrays){ $a = array_map(function($subArray) { return $subArray[0]; }, $arrayOfArrays); @@ -109,6 +115,9 @@ trait BasicStructure { /** * @When /^sending "([^"]*)" to "([^"]*)" with$/ + * @param string $verb + * @param string $url + * @param \Behat\Gherkin\Node\TableNode $body */ public function sendingToWith($verb, $url, $body) { $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php" . $url; @@ -139,6 +148,7 @@ trait BasicStructure { /** * @Then /^the OCS status code should be "([^"]*)"$/ + * @param int $statusCode */ public function theOCSStatusCodeShouldBe($statusCode) { PHPUnit_Framework_Assert::assertEquals($statusCode, $this->getOCSResponse($this->response)); @@ -146,6 +156,7 @@ trait BasicStructure { /** * @Then /^the HTTP status code should be "([^"]*)"$/ + * @param int $statusCode */ public function theHTTPStatusCodeShouldBe($statusCode) { PHPUnit_Framework_Assert::assertEquals($statusCode, $this->response->getStatusCode()); @@ -160,6 +171,7 @@ trait BasicStructure { /** * @Given Logging in using web as :user + * @param string $user */ public function loggingInUsingWebAs($user) { $loginUrl = substr($this->baseUrl, 0, -5); @@ -192,6 +204,8 @@ trait BasicStructure { /** * @When Sending a :method to :url with requesttoken + * @param string $method + * @param string $url */ public function sendingAToWithRequesttoken($method, $url) { $baseUrl = substr($this->baseUrl, 0, -5); @@ -214,6 +228,8 @@ trait BasicStructure { /** * @When Sending a :method to :url without requesttoken + * @param string $method + * @param string $url */ public function sendingAToWithoutRequesttoken($method, $url) { $baseUrl = substr($this->baseUrl, 0, -5); From b4affa4d273df89c9e45da2ecebae4663b927a56 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 11 Mar 2016 10:39:42 +0100 Subject: [PATCH 10/16] Add docs for CalDavContext --- build/integration/features/bootstrap/CalDavContext.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/build/integration/features/bootstrap/CalDavContext.php b/build/integration/features/bootstrap/CalDavContext.php index 88711f3aa7..30c50630b3 100644 --- a/build/integration/features/bootstrap/CalDavContext.php +++ b/build/integration/features/bootstrap/CalDavContext.php @@ -71,6 +71,8 @@ class CalDavContext implements \Behat\Behat\Context\Context { /** * @When :user requests calendar :calendar + * @param string $user + * @param string $calendar */ public function requestsCalendar($user, $calendar) { $davUrl = $this->baseUrl . '/remote.php/dav/calendars/'.$calendar; @@ -93,6 +95,8 @@ class CalDavContext implements \Behat\Behat\Context\Context { /** * @Then The CalDAV HTTP status code should be :code + * @param int $code + * @throws \Exception */ public function theCaldavHttpStatusCodeShouldBe($code) { if((int)$code !== $this->response->getStatusCode()) { @@ -115,6 +119,8 @@ class CalDavContext implements \Behat\Behat\Context\Context { /** * @Then The exception is :message + * @param string $message + * @throws \Exception */ public function theExceptionIs($message) { $result = $this->responseXml['value'][0]['value']; @@ -132,6 +138,8 @@ class CalDavContext implements \Behat\Behat\Context\Context { /** * @Then The error message is :message + * @param string $message + * @throws \Exception */ public function theErrorMessageIs($message) { $result = $this->responseXml['value'][1]['value']; @@ -149,6 +157,8 @@ class CalDavContext implements \Behat\Behat\Context\Context { /** * @Given :user creates a calendar named :name + * @param string $user + * @param string $name */ public function createsACalendarNamed($user, $name) { $davUrl = $this->baseUrl . '/remote.php/dav/calendars/'.$user.'/'.$name; From 2faf520504d982a40dd94fdc3bb23b4987f135c2 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 11 Mar 2016 10:42:57 +0100 Subject: [PATCH 11/16] Fix issues in CardDav --- .../features/bootstrap/CardDavContext.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/build/integration/features/bootstrap/CardDavContext.php b/build/integration/features/bootstrap/CardDavContext.php index 251d76d083..d317ba5193 100644 --- a/build/integration/features/bootstrap/CardDavContext.php +++ b/build/integration/features/bootstrap/CardDavContext.php @@ -73,6 +73,10 @@ class CardDavContext implements \Behat\Behat\Context\Context { /** * @When :user requests addressbook :addressBook with statuscode :statusCode + * @param string $user + * @param string $addressBook + * @param int $statusCode + * @throws \Exception */ public function requestsAddressbookWithStatuscode($user, $addressBook, $statusCode) { $davUrl = $this->baseUrl . '/remote.php/dav/addressbooks/users/'.$addressBook; @@ -112,6 +116,10 @@ class CardDavContext implements \Behat\Behat\Context\Context { /** * @Given :user creates an addressbook named :addressBook with statuscode :statusCode + * @param string $user + * @param string $addressBook + * @param int $statusCode + * @throws \Exception */ public function createsAnAddressbookNamedWithStatuscode($user, $addressBook, $statusCode) { $davUrl = $this->baseUrl . '/remote.php/dav/addressbooks/users/'.$user.'/'.$addressBook; @@ -121,9 +129,7 @@ class CardDavContext implements \Behat\Behat\Context\Context { 'MKCOL', $davUrl, [ - 'body' => ' ' @@ -158,6 +164,8 @@ class CardDavContext implements \Behat\Behat\Context\Context { /** * @When The CardDAV exception is :message + * @param string $message + * @throws \Exception */ public function theCarddavExceptionIs($message) { $result = $this->responseXml['value'][0]['value']; @@ -175,6 +183,8 @@ class CardDavContext implements \Behat\Behat\Context\Context { /** * @When The CardDAV error message is :arg1 + * @param string $message + * @throws \Exception */ public function theCarddavErrorMessageIs($message) { $result = $this->responseXml['value'][1]['value']; From c604046e3e0a1156d2cff108edf9f16aa7791394 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 11 Mar 2016 10:47:07 +0100 Subject: [PATCH 12/16] Fix checksumsContext --- .../features/bootstrap/ChecksumsContext.php | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/build/integration/features/bootstrap/ChecksumsContext.php b/build/integration/features/bootstrap/ChecksumsContext.php index a5d20ba965..af8f9e5590 100644 --- a/build/integration/features/bootstrap/ChecksumsContext.php +++ b/build/integration/features/bootstrap/ChecksumsContext.php @@ -2,7 +2,6 @@ require __DIR__ . '/../../vendor/autoload.php'; -use Behat\Gherkin\Node\TableNode; use GuzzleHttp\Client; use GuzzleHttp\Message\ResponseInterface; @@ -50,6 +49,10 @@ class ChecksumsContext implements \Behat\Behat\Context\Context { /** * @When user :user uploads file :source to :destination with checksum :checksum + * @param string $user + * @param string $source + * @param string $destination + * @param string $checksum */ public function userUploadsFileToWithChecksum($user, $source, $destination, $checksum) { @@ -76,6 +79,8 @@ class ChecksumsContext implements \Behat\Behat\Context\Context { /** * @Then The webdav response should have a status code :statusCode + * @param int $statusCode + * @throws \Exception */ public function theWebdavResponseShouldHaveAStatusCode($statusCode) { if((int)$statusCode !== $this->response->getStatusCode()) { @@ -85,6 +90,8 @@ class ChecksumsContext implements \Behat\Behat\Context\Context { /** * @When user :user request the checksum of :path via propfind + * @param string $user + * @param string $path */ public function userRequestTheChecksumOfViaPropfind($user, $path) { @@ -109,6 +116,8 @@ class ChecksumsContext implements \Behat\Behat\Context\Context { /** * @Then The webdav checksum should match :checksum + * @param string $checksum + * @throws \Exception */ public function theWebdavChecksumShouldMatch($checksum) { @@ -128,6 +137,8 @@ class ChecksumsContext implements \Behat\Behat\Context\Context { /** * @When user :user downloads the file :path + * @param string $user + * @param string $path */ public function userDownloadsTheFile($user, $path) { @@ -144,6 +155,8 @@ class ChecksumsContext implements \Behat\Behat\Context\Context { /** * @Then The header checksum should match :checksum + * @param string $checksum + * @throws \Exception */ public function theHeaderChecksumShouldMatch($checksum) { @@ -154,6 +167,9 @@ class ChecksumsContext implements \Behat\Behat\Context\Context { /** * @Given User :user copied file :source to :destination + * @param string $user + * @param string $source + * @param string $destination */ public function userCopiedFileTo($user, $source, $destination) { @@ -204,6 +220,12 @@ class ChecksumsContext implements \Behat\Behat\Context\Context { /** * @Given user :user uploads chunk file :num of :total with :data to :destination with checksum :checksum + * @param string $user + * @param int $num + * @param int $total + * @param string $data + * @param string $destination + * @param string $checksum */ public function userUploadsChunkFileOfWithToWithChecksum($user, $num, $total, $data, $destination, $checksum) { From d78357c210376b320a93ae5886e4e624993db30f Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 11 Mar 2016 10:52:38 +0100 Subject: [PATCH 13/16] Fix comments --- .../features/bootstrap/CommentsContext.php | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/build/integration/features/bootstrap/CommentsContext.php b/build/integration/features/bootstrap/CommentsContext.php index d720bb8dcd..e74e9580dc 100644 --- a/build/integration/features/bootstrap/CommentsContext.php +++ b/build/integration/features/bootstrap/CommentsContext.php @@ -45,7 +45,7 @@ class CommentsContext implements \Behat\Behat\Context\Context { } /** @AfterScenario */ - public function teardownScenario(\Behat\Behat\Hook\Scope\AfterScenarioScope $scope) { + public function teardownScenario() { $client = new \GuzzleHttp\Client(); try { $client->delete( @@ -66,6 +66,7 @@ class CommentsContext implements \Behat\Behat\Context\Context { } /** + * @param string $path * @return int */ private function getFileIdForPath($path) { @@ -90,6 +91,11 @@ class CommentsContext implements \Behat\Behat\Context\Context { /** * @When :user posts a comment with content :content on the file named :fileName it should return :statusCode + * @param string $user + * @param string $content + * @param string $fileName + * @param int $statusCode + * @throws \Exception */ public function postsACommentWithContentOnTheFileNamedItShouldReturn($user, $content, $fileName, $statusCode) { $fileId = $this->getFileIdForPath($fileName); @@ -123,6 +129,10 @@ class CommentsContext implements \Behat\Behat\Context\Context { /** * @Then As :user load all the comments of the file named :fileName it should return :statusCode + * @param string $user + * @param string $fileName + * @param int $statusCode + * @throws \Exception */ public function asLoadloadAllTheCommentsOfTheFileNamedItShouldReturn($user, $fileName, $statusCode) { $fileId = $this->getFileIdForPath($fileName); @@ -135,7 +145,7 @@ class CommentsContext implements \Behat\Behat\Context\Context { $url, [ 'body' => ' - + 200 0 @@ -167,6 +177,11 @@ class CommentsContext implements \Behat\Behat\Context\Context { /** * @Given As :user sending :verb to :url with + * @param string $user + * @param string $verb + * @param string $url + * @param \Behat\Gherkin\Node\TableNode $body + * @throws \Exception */ public function asUserSendingToWith($user, $verb, $url, \Behat\Gherkin\Node\TableNode $body) { $client = new \GuzzleHttp\Client(); @@ -179,6 +194,9 @@ class CommentsContext implements \Behat\Behat\Context\Context { /** * @Then As :user delete the created comment it should return :statusCode + * @param string $user + * @param int $statusCode + * @throws \Exception */ public function asDeleteTheCreatedCommentItShouldReturn($user, $statusCode) { $url = $this->baseUrl.'/remote.php/dav/comments/files/'.$this->fileId.'/'.$this->commentId; @@ -208,6 +226,9 @@ class CommentsContext implements \Behat\Behat\Context\Context { /** * @Then the response should contain a property :key with value :value + * @param string $key + * @param string $value + * @throws \Exception */ public function theResponseShouldContainAPropertyWithValue($key, $value) { $keys = $this->response[0]['value'][2]['value'][0]['value']; @@ -226,6 +247,8 @@ class CommentsContext implements \Behat\Behat\Context\Context { /** * @Then the response should contain only :number comments + * @param int $number + * @throws \Exception */ public function theResponseShouldContainOnlyComments($number) { if(count($this->response) !== (int)$number) { @@ -235,6 +258,10 @@ class CommentsContext implements \Behat\Behat\Context\Context { /** * @Then As :user edit the last created comment and set text to :text it should return :statusCode + * @param string $user + * @param string $text + * @param int $statusCode + * @throws \Exception */ public function asEditTheLastCreatedCommentAndSetTextToItShouldReturn($user, $text, $statusCode) { $client = new \GuzzleHttp\Client(); From 957a13d8796c0ca7c7f80fc26d5f74f4f7c9f4c8 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 11 Mar 2016 10:53:28 +0100 Subject: [PATCH 14/16] Remove unnecessary imports --- build/integration/features/bootstrap/FeatureContext.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/build/integration/features/bootstrap/FeatureContext.php b/build/integration/features/bootstrap/FeatureContext.php index 065985b22c..4345cef8ee 100644 --- a/build/integration/features/bootstrap/FeatureContext.php +++ b/build/integration/features/bootstrap/FeatureContext.php @@ -2,8 +2,6 @@ use Behat\Behat\Context\Context; use Behat\Behat\Context\SnippetAcceptingContext; -use GuzzleHttp\Client; -use GuzzleHttp\Message\ResponseInterface; require __DIR__ . '/../../vendor/autoload.php'; From 6ff3d23b246903436c063afd37354dd9411e36ac Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 11 Mar 2016 11:06:38 +0100 Subject: [PATCH 15/16] Fix docs of Tags --- .../features/bootstrap/TagsContext.php | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/build/integration/features/bootstrap/TagsContext.php b/build/integration/features/bootstrap/TagsContext.php index 5e1f62ba83..10d0b9ae54 100644 --- a/build/integration/features/bootstrap/TagsContext.php +++ b/build/integration/features/bootstrap/TagsContext.php @@ -98,6 +98,10 @@ class TagsContext implements \Behat\Behat\Context\Context { /** * @When :user creates a :type tag with name :name + * @param string $user + * @param string $type + * @param string $name + * @throws \Exception */ public function createsATagWithName($user, $type, $name) { $userVisible = 'true'; @@ -136,6 +140,8 @@ class TagsContext implements \Behat\Behat\Context\Context { /** * @Then The response should have a status code :statusCode + * @param int $statusCode + * @throws \Exception */ public function theResponseShouldHaveAStatusCode($statusCode) { if((int)$statusCode !== $this->response->getStatusCode()) { @@ -199,6 +205,9 @@ class TagsContext implements \Behat\Behat\Context\Context { /** * @Then The following tags should exist for :user + * @param string $user + * @param TableNode $table + * @throws \Exception */ public function theFollowingTagsShouldExistFor($user, TableNode $table) { $tags = $this->requestTagsForUser($user); @@ -231,6 +240,9 @@ class TagsContext implements \Behat\Behat\Context\Context { /** * @Then :count tags should exist for :user + * @param int $count + * @param string $user + * @throws \Exception */ public function tagsShouldExistFor($count, $user) { if((int)$count !== count($this->requestTagsForUser($user))) { @@ -256,6 +268,10 @@ class TagsContext implements \Behat\Behat\Context\Context { /** * @When :user edits the tag with name :oldNmae and sets its name to :newName + * @param string $user + * @param string $oldName + * @param string $newName + * @throws \Exception */ public function editsTheTagWithNameAndSetsItsNameTo($user, $oldName, $newName) { $tagId = $this->findTagIdByName($oldName); @@ -290,6 +306,8 @@ class TagsContext implements \Behat\Behat\Context\Context { /** * @When :user deletes the tag with name :name + * @param string $user + * @param string $name */ public function deletesTheTagWithName($user, $name) { $tagId = $this->findTagIdByName($name); @@ -338,6 +356,10 @@ class TagsContext implements \Behat\Behat\Context\Context { /** * @When :taggingUser adds the tag :tagName to :fileName shared by :sharingUser + * @param string $taggingUser + * @param string $tagName + * @param string $fileName + * @param string $sharingUser */ public function addsTheTagToSharedBy($taggingUser, $tagName, $fileName, $sharingUser) { $fileId = $this->getFileIdForPath($fileName, $sharingUser); @@ -360,6 +382,10 @@ class TagsContext implements \Behat\Behat\Context\Context { /** * @Then :fileName shared by :sharingUser has the following tags + * @param string $fileName + * @param string $sharingUser + * @param TableNode $table + * @throws \Exception */ public function sharedByHasTheFollowingTags($fileName, $sharingUser, TableNode $table) { $loadedExpectedTags = $table->getTable(); @@ -406,6 +432,11 @@ class TagsContext implements \Behat\Behat\Context\Context { /** * @Then :fileName shared by :sharingUser has the following tags for :user + * @param string $fileName + * @param string $sharingUser + * @param string $user + * @param TableNode $table + * @throws \Exception */ public function sharedByHasTheFollowingTagsFor($fileName, $sharingUser, $user, TableNode $table) { $loadedExpectedTags = $table->getTable(); @@ -460,6 +491,10 @@ class TagsContext implements \Behat\Behat\Context\Context { /** * @When :user removes the tag :tagName from :fileName shared by :shareUser + * @param string $user + * @param string $tagName + * @param string $fileName + * @param string $shareUser */ public function removesTheTagFromSharedBy($user, $tagName, $fileName, $shareUser) { $tagId = $this->findTagIdByName($tagName); From 6d80efc2a4a920691930373c9221ba3655a1cf1d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 11 Mar 2016 11:14:49 +0100 Subject: [PATCH 16/16] Fix WebDav --- .../features/bootstrap/FeatureContext.php | 1 - .../integration/features/bootstrap/WebDav.php | 43 +++++++++++++++++-- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/build/integration/features/bootstrap/FeatureContext.php b/build/integration/features/bootstrap/FeatureContext.php index 4345cef8ee..21ca8d8729 100644 --- a/build/integration/features/bootstrap/FeatureContext.php +++ b/build/integration/features/bootstrap/FeatureContext.php @@ -10,6 +10,5 @@ require __DIR__ . '/../../vendor/autoload.php'; * Features context. */ class FeatureContext implements Context, SnippetAcceptingContext { - use Sharing; use WebDav; } diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php index 0430768022..95a05f4ed6 100644 --- a/build/integration/features/bootstrap/WebDav.php +++ b/build/integration/features/bootstrap/WebDav.php @@ -1,7 +1,5 @@ baseUrl, 0, -4) . $this->davPath; @@ -57,6 +60,9 @@ trait WebDav { /** * @When /^User "([^"]*)" moves file "([^"]*)" to "([^"]*)"$/ + * @param string $user + * @param string $fileSource + * @param string $fileDestination */ public function userMovesFile($user, $fileSource, $fileDestination){ $fullUrl = substr($this->baseUrl, 0, -4) . $this->davPath; @@ -66,15 +72,17 @@ trait WebDav { /** * @When /^Downloading file "([^"]*)" with range "([^"]*)"$/ + * @param string $fileSource + * @param string $range */ public function downloadFileWithRange($fileSource, $range){ - $fullUrl = substr($this->baseUrl, 0, -4) . $this->davPath; $headers['Range'] = $range; $this->response = $this->makeDavRequest($this->currentUser, "GET", $fileSource, $headers); } /** * @When /^Downloading last public shared file with range "([^"]*)"$/ + * @param string $range */ public function downloadPublicFileWithRange($range){ $token = $this->lastShareData->data->token; @@ -93,6 +101,7 @@ trait WebDav { /** * @Then /^Downloaded content should be "([^"]*)"$/ + * @param string $content */ public function downloadedContentShouldBe($content){ PHPUnit_Framework_Assert::assertEquals($content, (string)$this->response->getBody()); @@ -100,6 +109,9 @@ trait WebDav { /** * @Then /^Downloaded content when downloading file "([^"]*)" with range "([^"]*)" should be "([^"]*)"$/ + * @param string $fileSource + * @param string $range + * @param string $content */ public function downloadedContentWhenDownloadindShouldBe($fileSource, $range, $content){ $this->downloadFileWithRange($fileSource, $range); @@ -108,6 +120,7 @@ trait WebDav { /** * @When Downloading file :fileName + * @param string $fileName */ public function downloadingFile($fileName) { $this->response = $this->makeDavRequest($this->currentUser, 'GET', $fileName, []); @@ -115,6 +128,8 @@ trait WebDav { /** * @Then The following headers should be set + * @param \Behat\Gherkin\Node\TableNode $table + * @throws \Exception */ public function theFollowingHeadersShouldBeSet(\Behat\Gherkin\Node\TableNode $table) { foreach($table->getTable() as $header) { @@ -136,6 +151,8 @@ trait WebDav { /** * @Then Downloaded content should start with :start + * @param int $start + * @throws \Exception */ public function downloadedContentShouldStartWith($start) { if(strpos($this->response->getBody()->getContents(), $start) !== 0) { @@ -151,6 +168,8 @@ trait WebDav { /** * @Then /^as "([^"]*)" gets properties of folder "([^"]*)" with$/ + * @param string $user + * @param string $path * @param \Behat\Gherkin\Node\TableNode|null $propertiesTable */ public function asGetsPropertiesOfFolderWith($user, $path, $propertiesTable) { @@ -165,11 +184,14 @@ trait WebDav { /** * @Then the single response should contain a property :key with value :value + * @param string $key + * @param string $expectedValue + * @throws \Exception */ public function theSingleResponseShouldContainAPropertyWithValue($key, $expectedValue) { $keys = $this->response; if (!isset($keys[$key])) { - throw new \Exception("Cannot find property \"$key\" with \"$expectedalue\""); + throw new \Exception("Cannot find property \"$key\" with \"$expectedValue\""); } $value = $keys[$key]; @@ -208,6 +230,7 @@ trait WebDav { /** * @Then /^user "([^"]*)" should see following elements$/ + * @param string $user * @param \Behat\Gherkin\Node\TableNode|null $expectedElements */ public function checkElementList($user, $expectedElements){ @@ -226,6 +249,9 @@ trait WebDav { /** * @When User :user uploads file :source to :destination + * @param string $user + * @param string $source + * @param string $destination */ public function userUploadsAFileTo($user, $source, $destination) { @@ -240,6 +266,8 @@ trait WebDav { /** * @When User :user deletes file :file + * @param string $user + * @param string $file */ public function userDeletesFile($user, $file) { try { @@ -252,6 +280,8 @@ trait WebDav { /** * @Given User :user created a folder :destination + * @param string $user + * @param string $destination */ public function userCreatedAFolder($user, $destination){ try { @@ -264,6 +294,11 @@ trait WebDav { /** * @Given user :user uploads chunk file :num of :total with :data to :destination + * @param string $user + * @param int $num + * @param int $total + * @param string $data + * @param string $destination */ public function userUploadsChunkFileOfWithToWithChecksum($user, $num, $total, $data, $destination) {