diff options
Diffstat (limited to 'build/integration/features')
-rw-r--r-- | build/integration/features/bootstrap/FilesDropContext.php | 28 | ||||
-rw-r--r-- | build/integration/features/bootstrap/WebDav.php | 6 |
2 files changed, 25 insertions, 9 deletions
diff --git a/build/integration/features/bootstrap/FilesDropContext.php b/build/integration/features/bootstrap/FilesDropContext.php index 1b9d598645f..00c2cd346df 100644 --- a/build/integration/features/bootstrap/FilesDropContext.php +++ b/build/integration/features/bootstrap/FilesDropContext.php @@ -15,7 +15,7 @@ class FilesDropContext implements Context, SnippetAcceptingContext { /** * @When Dropping file :path with :content */ - public function droppingFileWith($path, $content, $nickName = null) { + public function droppingFileWith($path, $content, $nickname = null) { $client = new Client(); $options = []; if (count($this->lastShareData->data->element) > 0) { @@ -28,11 +28,11 @@ class FilesDropContext implements Context, SnippetAcceptingContext { $fullUrl = str_replace('//', '/', $base . "/public.php/dav/files/$token/$path"); $options['headers'] = [ - 'X-REQUESTED-WITH' => 'XMLHttpRequest' + 'X-REQUESTED-WITH' => 'XMLHttpRequest', ]; - if ($nickName) { - $options['headers']['X-NC-NICKNAME'] = $nickName; + if ($nickname) { + $options['headers']['X-NC-NICKNAME'] = $nickname; } $options['body'] = \GuzzleHttp\Psr7\Utils::streamFor($content); @@ -48,15 +48,15 @@ class FilesDropContext implements Context, SnippetAcceptingContext { /** * @When Dropping file :path with :content as :nickName */ - public function droppingFileWithAs($path, $content, $nickName) { - $this->droppingFileWith($path, $content, $nickName); + public function droppingFileWithAs($path, $content, $nickname) { + $this->droppingFileWith($path, $content, $nickname); } /** * @When Creating folder :folder in drop */ - public function creatingFolderInDrop($folder) { + public function creatingFolderInDrop($folder, $nickname = null) { $client = new Client(); $options = []; if (count($this->lastShareData->data->element) > 0) { @@ -69,13 +69,25 @@ class FilesDropContext implements Context, SnippetAcceptingContext { $fullUrl = str_replace('//', '/', $base . "/public.php/dav/files/$token/$folder"); $options['headers'] = [ - 'X-REQUESTED-WITH' => 'XMLHttpRequest' + 'X-REQUESTED-WITH' => 'XMLHttpRequest', ]; + if ($nickname) { + $options['headers']['X-NC-NICKNAME'] = $nickname; + } + try { $this->response = $client->request('MKCOL', $fullUrl, $options); } catch (\GuzzleHttp\Exception\ClientException $e) { $this->response = $e->getResponse(); } } + + + /** + * @When Creating folder :folder in drop as :nickName + */ + public function creatingFolderInDropWithNickname($folder, $nickname) { + return $this->creatingFolderInDrop($folder, $nickname); + } } diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php index e71502b6b0c..e9e08844767 100644 --- a/build/integration/features/bootstrap/WebDav.php +++ b/build/integration/features/bootstrap/WebDav.php @@ -262,7 +262,11 @@ trait WebDav { 'Accept' => 'application/zip' ]; - $this->response = $client->request('GET', $fullUrl, $options); + try { + $this->response = $client->request('GET', $fullUrl, $options); + } catch (\GuzzleHttp\Exception\ClientException $e) { + $this->response = $e->getResponse(); + } } /** |