aboutsummaryrefslogtreecommitdiffstats
path: root/build/integration/features/bootstrap/ChecksumsContext.php
diff options
context:
space:
mode:
Diffstat (limited to 'build/integration/features/bootstrap/ChecksumsContext.php')
-rw-r--r--build/integration/features/bootstrap/ChecksumsContext.php40
1 files changed, 7 insertions, 33 deletions
diff --git a/build/integration/features/bootstrap/ChecksumsContext.php b/build/integration/features/bootstrap/ChecksumsContext.php
index 5661015e714..c8abf91127e 100644
--- a/build/integration/features/bootstrap/ChecksumsContext.php
+++ b/build/integration/features/bootstrap/ChecksumsContext.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -10,7 +11,7 @@ use GuzzleHttp\Client;
use GuzzleHttp\Message\ResponseInterface;
class ChecksumsContext implements \Behat\Behat\Context\Context {
- /** @var string */
+ /** @var string */
private $baseUrl;
/** @var Client */
private $client;
@@ -87,7 +88,7 @@ class ChecksumsContext implements \Behat\Behat\Context\Context {
*/
public function theWebdavResponseShouldHaveAStatusCode($statusCode) {
if ((int)$statusCode !== $this->response->getStatusCode()) {
- throw new \Exception("Expected $statusCode, got ".$this->response->getStatusCode());
+ throw new \Exception("Expected $statusCode, got " . $this->response->getStatusCode());
}
}
@@ -131,7 +132,7 @@ class ChecksumsContext implements \Behat\Behat\Context\Context {
$checksums = $parsed[0]['value'][1]['value'][0]['value'][0];
if ($checksums['value'][0]['value'] !== $checksum) {
- throw new \Exception("Expected $checksum, got ".$checksums['value'][0]['value']);
+ throw new \Exception("Expected $checksum, got " . $checksums['value'][0]['value']);
}
}
@@ -159,7 +160,7 @@ class ChecksumsContext implements \Behat\Behat\Context\Context {
*/
public function theHeaderChecksumShouldMatch($checksum) {
if ($this->response->getHeader('OC-Checksum')[0] !== $checksum) {
- throw new \Exception("Expected $checksum, got ".$this->response->getHeader('OC-Checksum')[0]);
+ throw new \Exception("Expected $checksum, got " . $this->response->getHeader('OC-Checksum')[0]);
}
}
@@ -199,7 +200,7 @@ class ChecksumsContext implements \Behat\Behat\Context\Context {
$status = $parsed[0]['value'][1]['value'][1]['value'];
if ($status !== 'HTTP/1.1 404 Not Found') {
- throw new \Exception("Expected 'HTTP/1.1 404 Not Found', got ".$status);
+ throw new \Exception("Expected 'HTTP/1.1 404 Not Found', got " . $status);
}
}
@@ -208,34 +209,7 @@ class ChecksumsContext implements \Behat\Behat\Context\Context {
*/
public function theOcChecksumHeaderShouldNotBeThere() {
if ($this->response->hasHeader('OC-Checksum')) {
- throw new \Exception("Expected no checksum header but got ".$this->response->getHeader('OC-Checksum')[0]);
+ throw new \Exception('Expected no checksum header but got ' . $this->response->getHeader('OC-Checksum')[0]);
}
}
-
- /**
- * @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) {
- $num -= 1;
- $this->response = $this->client->put(
- $this->baseUrl . '/remote.php/webdav' . $destination . '-chunking-42-'.$total.'-'.$num,
- [
- 'auth' => [
- $user,
- $this->getPasswordForUser($user)
- ],
- 'body' => $data,
- 'headers' => [
- 'OC-Checksum' => $checksum,
- 'OC-Chunked' => '1',
- ]
- ]
- );
- }
}