diff options
author | skjnldsv <skjnldsv@protonmail.com> | 2024-07-18 20:59:50 +0200 |
---|---|---|
committer | skjnldsv <skjnldsv@protonmail.com> | 2024-07-19 07:35:51 +0200 |
commit | 725736a754c81ccee17ba394de4da38f5bfa0e68 (patch) | |
tree | 3efb98cd93f84f15ed868f2b65c4338083994888 /build/integration/features/bootstrap/FilesDropContext.php | |
parent | 481551eebf08f55e4477b8afb5c3c15b94f6ce39 (diff) | |
download | nextcloud-server-725736a754c81ccee17ba394de4da38f5bfa0e68.tar.gz nextcloud-server-725736a754c81ccee17ba394de4da38f5bfa0e68.zip |
chore(integration): add file request tests
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Diffstat (limited to 'build/integration/features/bootstrap/FilesDropContext.php')
-rw-r--r-- | build/integration/features/bootstrap/FilesDropContext.php | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/build/integration/features/bootstrap/FilesDropContext.php b/build/integration/features/bootstrap/FilesDropContext.php index b611e55ea0f..1b9d598645f 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) { + public function droppingFileWith($path, $content, $nickName = null) { $client = new Client(); $options = []; if (count($this->lastShareData->data->element) > 0) { @@ -25,11 +25,16 @@ class FilesDropContext implements Context, SnippetAcceptingContext { } $base = substr($this->baseUrl, 0, -4); - $fullUrl = $base . "/public.php/dav/files/$token/$path"; + $fullUrl = str_replace('//', '/', $base . "/public.php/dav/files/$token/$path"); $options['headers'] = [ 'X-REQUESTED-WITH' => 'XMLHttpRequest' ]; + + if ($nickName) { + $options['headers']['X-NC-NICKNAME'] = $nickName; + } + $options['body'] = \GuzzleHttp\Psr7\Utils::streamFor($content); try { @@ -38,6 +43,15 @@ class FilesDropContext implements Context, SnippetAcceptingContext { $this->response = $e->getResponse(); } } + + + /** + * @When Dropping file :path with :content as :nickName + */ + public function droppingFileWithAs($path, $content, $nickName) { + $this->droppingFileWith($path, $content, $nickName); + } + /** * @When Creating folder :folder in drop @@ -52,7 +66,7 @@ class FilesDropContext implements Context, SnippetAcceptingContext { } $base = substr($this->baseUrl, 0, -4); - $fullUrl = $base . "/public.php/dav/files/$token/$folder"; + $fullUrl = str_replace('//', '/', $base . "/public.php/dav/files/$token/$folder"); $options['headers'] = [ 'X-REQUESTED-WITH' => 'XMLHttpRequest' |