diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2017-04-05 22:43:05 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2017-04-05 22:43:05 +0200 |
commit | 63288ebc501739abb4da657eac49d4165f690dd3 (patch) | |
tree | 74203bb3d18dfe3c9ef1ee5fbe812aa35042c370 /build/integration/features/bootstrap | |
parent | 00558de782e93d2f5b7d73c0197fdf38261003f9 (diff) | |
download | nextcloud-server-63288ebc501739abb4da657eac49d4165f690dd3.tar.gz nextcloud-server-63288ebc501739abb4da657eac49d4165f690dd3.zip |
Don't list on public calendar endpoints
There is no need to allow listing here.
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'build/integration/features/bootstrap')
-rw-r--r-- | build/integration/features/bootstrap/CalDavContext.php | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/build/integration/features/bootstrap/CalDavContext.php b/build/integration/features/bootstrap/CalDavContext.php index 4843dde135a..8c0348f37a8 100644 --- a/build/integration/features/bootstrap/CalDavContext.php +++ b/build/integration/features/bootstrap/CalDavContext.php @@ -89,7 +89,7 @@ class CalDavContext implements \Behat\Behat\Context\Context { 'auth' => [ $user, $password, - ] + ], ] ); $this->response = $this->client->send($request); @@ -184,4 +184,51 @@ class CalDavContext implements \Behat\Behat\Context\Context { $this->response = $this->client->send($request); } + /** + * @Then :user publicly shares the calendar named :name + * + * @param string $user + * @param string $name + */ + public function publiclySharesTheCalendarNamed($user, $name) { + $davUrl = $this->baseUrl . '/remote.php/dav/calendars/'.$user.'/'.$name; + $password = ($user === 'admin') ? 'admin' : '123456'; + + $request = $this->client->createRequest( + 'POST', + $davUrl, + [ + 'body' => '<cs:publish-calendar xmlns:cs="http://calendarserver.org/ns/"/>', + 'auth' => [ + $user, + $password, + ], + 'headers' => [ + 'Content-Type' => 'application/xml; charset=UTF-8', + ], + ] + ); + + $this->response = $this->client->send($request); + } + + /** + * @Then There should be :amount calendars in the response body + * + * @param string $amount + */ + public function t($amount) { + $jsonEncoded = json_encode($this->responseXml); + $arrayElement = json_decode($jsonEncoded, true); + $actual = count($arrayElement['value']) - 1; + if($actual !== (int)$amount) { + throw new InvalidArgumentException( + sprintf( + 'Expected %s got %s', + $amount, + $actual + ) + ); + } + } } |