diff --git a/.gitignore b/.gitignore
index 0f6d809d95..a8f281df2e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,6 +29,9 @@ vendor
vendor-bin/**/vendor
vendor-bin/**/composer.lock
+# API acceptance tests - auto-generated files
+.php-cs-fixer.cache
+
# drone CI is in .drone.star, do not let someone accidentally commit a local .drone.yml
.drone.yml
diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php
new file mode 100644
index 0000000000..101395d991
--- /dev/null
+++ b/.php-cs-fixer.dist.php
@@ -0,0 +1,16 @@
+exclude($excludeDirs)
+ ->in(__DIR__);
+
+$config = new OC\CodingStandard\Config();
+$config->setFinder($finder);
+return $config;
diff --git a/Makefile b/Makefile
index 690da2f6ad..258d2f66c0 100644
--- a/Makefile
+++ b/Makefile
@@ -32,6 +32,12 @@ OCIS_MODULES = \
web \
webdav
+# bin file definitions
+PHP_CS_FIXER=php -d zend.enable_gc=0 vendor-bin/owncloud-codestyle/vendor/bin/php-cs-fixer
+PHP_CODESNIFFER=vendor-bin/php_codesniffer/vendor/bin/phpcs
+PHAN=php -d zend.enable_gc=0 vendor-bin/phan/vendor/bin/phan
+PHPSTAN=php -d zend.enable_gc=0 vendor-bin/phpstan/vendor/bin/phpstan
+
ifneq (, $(shell which go 2> /dev/null)) # suppress `command not found warnings` for non go targets in CI
include .bingo/Variables.mk
endif
@@ -64,6 +70,10 @@ help:
@echo -e "\tsee ./tests/acceptance/docker/Makefile"
@echo -e "\tor run ${YELLOW}make -C tests/acceptance/docker help${RESET}"
@echo
+ @echo -e "${GREEN}Tools for developing tests:\n${RESET}"
+ @echo -e "\tmake test-php-style\t\t${BLUE}run PHP code style checks${RESET}"
+ @echo -e "\tmake test-php-style-fix\t\t${BLUE}run PHP code style checks and fix any issues found${RESET}"
+ @echo
.PHONY: clean-tests
clean-tests:
@@ -194,3 +204,25 @@ l10n-write:
.PHONY: ci-format
ci-format: $(BUILDIFIER)
$(BUILDIFIER) --mode=fix .drone.star
+
+.PHONY: test-php-style
+test-php-style: vendor-bin/owncloud-codestyle/vendor vendor-bin/php_codesniffer/vendor
+ $(PHP_CS_FIXER) fix -v --diff --allow-risky yes --dry-run
+ $(PHP_CODESNIFFER) --cache --runtime-set ignore_warnings_on_exit --standard=phpcs.xml tests/acceptance
+
+.PHONY: test-php-style-fix
+test-php-style-fix: vendor-bin/owncloud-codestyle/vendor
+ $(PHP_CS_FIXER) fix -v --diff --allow-risky yes
+
+
+vendor-bin/owncloud-codestyle/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/owncloud-codestyle/composer.lock
+ composer bin owncloud-codestyle install --no-progress
+
+vendor-bin/owncloud-codestyle/composer.lock: vendor-bin/owncloud-codestyle/composer.json
+ @echo owncloud-codestyle composer.lock is not up to date.
+
+vendor-bin/php_codesniffer/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/php_codesniffer/composer.lock
+ composer bin php_codesniffer install --no-progress
+
+vendor-bin/php_codesniffer/composer.lock: vendor-bin/php_codesniffer/composer.json
+ @echo php_codesniffer composer.lock is not up to date.
diff --git a/deployments/examples/oc10_ocis_parallel/config/oc10/oidc.config.php b/deployments/examples/oc10_ocis_parallel/config/oc10/oidc.config.php
index caa33a0bf0..5de9f9d3e6 100644
--- a/deployments/examples/oc10_ocis_parallel/config/oc10/oidc.config.php
+++ b/deployments/examples/oc10_ocis_parallel/config/oc10/oidc.config.php
@@ -2,22 +2,21 @@
# reference: https://doc.owncloud.com/server/admin_manual/configuration/user/oidc/
-function getOIDCConfigFromEnv()
-{
- $config = [
- 'openid-connect' => [
- 'provider-url' => getenv('IDP_OIDC_ISSUER'),
- 'client-id' => 'oc10',
- 'client-secret' => getenv('IDP_OIDC_CLIENT_SECRET'),
- 'loginButtonName' => 'OpenId Connect',
- 'search-attribute' => 'preferred_username',
- 'mode' => 'userid',
- 'autoRedirectOnLoginPage' => true,
- 'insecure' => true,
- 'post_logout_redirect_uri' => 'https://' . getenv('CLOUD_DOMAIN'),
- ],
- ];
- return $config;
+function getOIDCConfigFromEnv() {
+ $config = [
+ 'openid-connect' => [
+ 'provider-url' => getenv('IDP_OIDC_ISSUER'),
+ 'client-id' => 'oc10',
+ 'client-secret' => getenv('IDP_OIDC_CLIENT_SECRET'),
+ 'loginButtonName' => 'OpenId Connect',
+ 'search-attribute' => 'preferred_username',
+ 'mode' => 'userid',
+ 'autoRedirectOnLoginPage' => true,
+ 'insecure' => true,
+ 'post_logout_redirect_uri' => 'https://' . getenv('CLOUD_DOMAIN'),
+ ],
+ ];
+ return $config;
}
$CONFIG = getOIDCConfigFromEnv();
diff --git a/deployments/examples/oc10_ocis_parallel/config/oc10/web.config.php b/deployments/examples/oc10_ocis_parallel/config/oc10/web.config.php
index dca68d440b..484a01d16e 100644
--- a/deployments/examples/oc10_ocis_parallel/config/oc10/web.config.php
+++ b/deployments/examples/oc10_ocis_parallel/config/oc10/web.config.php
@@ -2,14 +2,13 @@
# reference: https://owncloud.dev/clients/web/deployments/oc10-app/
-function getWebConfigFromEnv()
-{
- $config = [
- 'web.baseUrl' => 'https://' . getenv('CLOUD_DOMAIN') . '/index.php/apps/web',
- 'web.rewriteLinks' => getenv('OWNCLOUD_WEB_REWRITE_LINKS') == 'true',
+function getWebConfigFromEnv() {
+ $config = [
+ 'web.baseUrl' => 'https://' . getenv('CLOUD_DOMAIN') . '/index.php/apps/web',
+ 'web.rewriteLinks' => getenv('OWNCLOUD_WEB_REWRITE_LINKS') == 'true',
- ];
- return $config;
+ ];
+ return $config;
}
$CONFIG = getWebConfigFromEnv();
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 0000000000..a3b644170c
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,80 @@
+
+
+ ownCloud coding standard
+
+
+
+ */vendor/*
+ */3rdparty/*
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ */lib/storagewrapper.php
+
+
+
diff --git a/tests/acceptance/features/bootstrap/RevaContext.php b/tests/acceptance/features/bootstrap/RevaContext.php
index 7c1cfd7337..da6aa015ee 100644
--- a/tests/acceptance/features/bootstrap/RevaContext.php
+++ b/tests/acceptance/features/bootstrap/RevaContext.php
@@ -1,4 +1,24 @@
+ * @copyright Copyright (c) 2020 Phil Davis phil@jankaritech.com
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License,
+ * as published by the Free Software Foundation;
+ * either version 3 of the License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see
+ *
+ */
use Behat\Behat\Context\Context;
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
@@ -11,30 +31,29 @@ require_once 'bootstrap.php';
* Context for Reva specific steps
*/
class RevaContext implements Context {
+ /**
+ * @var FeatureContext
+ */
+ private $featureContext;
- /**
- * @var FeatureContext
- */
- private $featureContext;
-
- /**
- * @BeforeScenario
- *
- * @param BeforeScenarioScope $scope
- *
- * @return void
- * @throws Exception
- */
- public function setUpScenario(BeforeScenarioScope $scope): void {
- // Get the environment
- $environment = $scope->getEnvironment();
- // Get all the contexts you need in this context
- $this->featureContext = $environment->getContext('FeatureContext');
- SetupHelper::init(
- $this->featureContext->getAdminUsername(),
- $this->featureContext->getAdminPassword(),
- $this->featureContext->getBaseUrl(),
- $this->featureContext->getOcPath()
- );
- }
+ /**
+ * @BeforeScenario
+ *
+ * @param BeforeScenarioScope $scope
+ *
+ * @return void
+ * @throws Exception
+ */
+ public function setUpScenario(BeforeScenarioScope $scope): void {
+ // Get the environment
+ $environment = $scope->getEnvironment();
+ // Get all the contexts you need in this context
+ $this->featureContext = $environment->getContext('FeatureContext');
+ SetupHelper::init(
+ $this->featureContext->getAdminUsername(),
+ $this->featureContext->getAdminPassword(),
+ $this->featureContext->getBaseUrl(),
+ $this->featureContext->getOcPath()
+ );
+ }
}
diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php
index a888521a15..8c8232573f 100644
--- a/tests/acceptance/features/bootstrap/SpacesContext.php
+++ b/tests/acceptance/features/bootstrap/SpacesContext.php
@@ -1,5 +1,24 @@
+ * @copyright Copyright (c) 2021 Michael Barz mbarz@owncloud.com
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License,
+ * as published by the Free Software Foundation;
+ * either version 3 of the License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see
+ *
+ */
use Behat\Behat\Context\Context;
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
use Behat\Gherkin\Node\TableNode;
@@ -16,677 +35,692 @@ require_once 'bootstrap.php';
*/
class SpacesContext implements Context {
- /**
- * @var FeatureContext
- */
- private FeatureContext $featureContext;
+ /**
+ * @var FeatureContext
+ */
+ private FeatureContext $featureContext;
- /**
- * @var array
- */
- private array $availableSpaces;
+ /**
+ * @var array
+ */
+ private array $availableSpaces;
- /**
- * @return array
- */
- public function getAvailableSpaces(): array
- {
- return $this->availableSpaces;
- }
+ /**
+ * @return array
+ */
+ public function getAvailableSpaces(): array {
+ return $this->availableSpaces;
+ }
- /**
- * @param array $availableSpaces
- */
- public function setAvailableSpaces(array $availableSpaces): void
- {
- $this->availableSpaces = $availableSpaces;
- }
+ /**
+ * @param array $availableSpaces
+ *
+ * @return void
+ */
+ public function setAvailableSpaces(array $availableSpaces): void {
+ $this->availableSpaces = $availableSpaces;
+ }
- /**
- * response content parsed from XML to an array
- *
- * @var array
- */
- private array $responseXml = [];
+ /**
+ * response content parsed from XML to an array
+ *
+ * @var array
+ */
+ private array $responseXml = [];
- /**
- * @return array
- */
- public function getResponseXml(): array
- {
- return $this->responseXml;
- }
+ /**
+ * @return array
+ */
+ public function getResponseXml(): array {
+ return $this->responseXml;
+ }
- /**
- * @param array $responseXml
- */
- public function setResponseXml(array $responseXml): void
- {
- $this->responseXml = $responseXml;
- }
+ /**
+ * @param array $responseXml
+ *
+ * @return void
+ */
+ public function setResponseXml(array $responseXml): void {
+ $this->responseXml = $responseXml;
+ }
- /**
- * space id from last propfind request
- *
- * @var string
- */
- private string $responseSpaceId;
+ /**
+ * space id from last propfind request
+ *
+ * @var string
+ */
+ private string $responseSpaceId;
- /**
- * @param string $responseSpaceId
- */
- public function setResponseSpaceId(string $responseSpaceId): void
- {
- $this->responseSpaceId = $responseSpaceId;
- }
+ /**
+ * @param string $responseSpaceId
+ *
+ * @return void
+ */
+ public function setResponseSpaceId(string $responseSpaceId): void {
+ $this->responseSpaceId = $responseSpaceId;
+ }
- /**
- * @return string
- */
- public function getResponseSpaceId(): string
- {
- return $this->responseSpaceId;
- }
+ /**
+ * @return string
+ */
+ public function getResponseSpaceId(): string {
+ return $this->responseSpaceId;
+ }
- /**
- * Get SpaceId by Name
- *
- * @param $name string
- * @return string
- * @throws Exception
- */
- public function getSpaceIdByName(string $name): string
- {
- $response = json_decode($this->featureContext->getResponse()->getBody(), true, 512, JSON_THROW_ON_ERROR);
- if (isset($response['name']) && $response['name'] === $name) {
- return $response["id"];
- }
- foreach ($response["value"] as $spaceCandidate) {
- if ($spaceCandidate['name'] === $name) {
- return $spaceCandidate["id"];
- }
- }
- throw new Exception(__METHOD__ . " space with name $name not found");
- }
+ /**
+ * Get SpaceId by Name
+ *
+ * @param $name string
+ *
+ * @return string
+ *
+ * @throws Exception
+ */
+ public function getSpaceIdByName(string $name): string {
+ $response = json_decode($this->featureContext->getResponse()->getBody(), true, 512, JSON_THROW_ON_ERROR);
+ if (isset($response['name']) && $response['name'] === $name) {
+ return $response["id"];
+ }
+ foreach ($response["value"] as $spaceCandidate) {
+ if ($spaceCandidate['name'] === $name) {
+ return $spaceCandidate["id"];
+ }
+ }
+ throw new Exception(__METHOD__ . " space with name $name not found");
+ }
- /**
- * Get Space Array by name
- *
- * @param string $name
- * @return array
- * @throws Exception
- */
- public function getSpaceByName(string $name): array
- {
- $response = json_decode($this->featureContext->getResponse()->getBody(), true, 512, JSON_THROW_ON_ERROR);
- $spaceAsArray = $response;
- if (isset($response['name']) && $response['name'] === $name) {
- return $response;
- }
- foreach ($spaceAsArray["value"] as $spaceCandidate) {
- if ($spaceCandidate['name'] === $name) {
- return $spaceCandidate;
- }
- }
- return [];
- }
+ /**
+ * Get Space Array by name
+ *
+ * @param string $name
+ *
+ * @return array
+ *
+ * @throws Exception
+ */
+ public function getSpaceByName(string $name): array {
+ $response = json_decode($this->featureContext->getResponse()->getBody(), true, 512, JSON_THROW_ON_ERROR);
+ $spaceAsArray = $response;
+ if (isset($response['name']) && $response['name'] === $name) {
+ return $response;
+ }
+ foreach ($spaceAsArray["value"] as $spaceCandidate) {
+ if ($spaceCandidate['name'] === $name) {
+ return $spaceCandidate;
+ }
+ }
+ return [];
+ }
- /**
- * @BeforeScenario
- *
- * @param BeforeScenarioScope $scope
- *
- * @return void
- * @throws Exception
- */
- public function setUpScenario(BeforeScenarioScope $scope): void
- {
- // Get the environment
- $environment = $scope->getEnvironment();
- // Get all the contexts you need in this context
- $this->featureContext = $environment->getContext('FeatureContext');
- SetupHelper::init(
- $this->featureContext->getAdminUsername(),
- $this->featureContext->getAdminPassword(),
- $this->featureContext->getBaseUrl(),
- $this->featureContext->getOcPath()
- );
- }
+ /**
+ * @BeforeScenario
+ *
+ * @param BeforeScenarioScope $scope
+ *
+ * @return void
+ *
+ * @throws Exception
+ */
+ public function setUpScenario(BeforeScenarioScope $scope): void {
+ // Get the environment
+ $environment = $scope->getEnvironment();
+ // Get all the contexts you need in this context
+ $this->featureContext = $environment->getContext('FeatureContext');
+ SetupHelper::init(
+ $this->featureContext->getAdminUsername(),
+ $this->featureContext->getAdminPassword(),
+ $this->featureContext->getBaseUrl(),
+ $this->featureContext->getOcPath()
+ );
+ }
- /**
- * Send Graph List Spaces Request
- *
- * @param string $baseUrl
- * @param string $user
- * @param string $password
- * @param string $urlArguments
- * @param string $xRequestId
- * @param array $body
- * @param array $headers
- * @return ResponseInterface
- * @throws GuzzleException
- */
- public function listSpacesRequest(
- string $baseUrl,
- string $user,
- string $password,
- string $urlArguments,
- string $xRequestId = '',
- array $body = [],
- array $headers = []
- ): ResponseInterface {
- $fullUrl = $baseUrl;
- if (!str_ends_with($fullUrl, '/')) {
- $fullUrl .= '/';
- }
- $fullUrl .= "graph/v1.0/me/drives/" . $urlArguments;
+ /**
+ * Send Graph List Spaces Request
+ *
+ * @param string $baseUrl
+ * @param string $user
+ * @param string $password
+ * @param string $urlArguments
+ * @param string $xRequestId
+ * @param array $body
+ * @param array $headers
+ *
+ * @return ResponseInterface
+ *
+ * @throws GuzzleException
+ */
+ public function listSpacesRequest(
+ string $baseUrl,
+ string $user,
+ string $password,
+ string $urlArguments,
+ string $xRequestId = '',
+ array $body = [],
+ array $headers = []
+ ): ResponseInterface {
+ $fullUrl = $baseUrl;
+ if (!str_ends_with($fullUrl, '/')) {
+ $fullUrl .= '/';
+ }
+ $fullUrl .= "graph/v1.0/me/drives/" . $urlArguments;
- return HttpRequestHelper::get($fullUrl, $xRequestId, $user, $password, $headers, $body);
- }
+ return HttpRequestHelper::get($fullUrl, $xRequestId, $user, $password, $headers, $body);
+ }
- /**
- * Send Graph Create Space Request
- *
- * @param string $baseUrl
- * @param string $user
- * @param string $password
- * @param string $body
- * @param string $xRequestId
- * @param array $headers
- * @return ResponseInterface
- * @throws GuzzleException
- */
- public function sendCreateSpaceRequest(
- string $baseUrl,
- string $user,
- string $password,
- string $body,
- string $xRequestId = '',
- array $headers = []
- ): ResponseInterface
- {
- $fullUrl = $baseUrl;
- if (!str_ends_with($fullUrl, '/')) {
- $fullUrl .= '/';
- }
- $fullUrl .= "graph/v1.0/drives/";
+ /**
+ * Send Graph Create Space Request
+ *
+ * @param string $baseUrl
+ * @param string $user
+ * @param string $password
+ * @param string $body
+ * @param string $xRequestId
+ * @param array $headers
+ *
+ * @return ResponseInterface
+ *
+ * @throws GuzzleException
+ */
+ public function sendCreateSpaceRequest(
+ string $baseUrl,
+ string $user,
+ string $password,
+ string $body,
+ string $xRequestId = '',
+ array $headers = []
+ ): ResponseInterface {
+ $fullUrl = $baseUrl;
+ if (!str_ends_with($fullUrl, '/')) {
+ $fullUrl .= '/';
+ }
+ $fullUrl .= "graph/v1.0/drives/";
- return HttpRequestHelper::post($fullUrl, $xRequestId, $user, $password, $headers, $body);
- }
+ return HttpRequestHelper::post($fullUrl, $xRequestId, $user, $password, $headers, $body);
+ }
- /**
- * Send Propfind Request to Url
- *
- * @param string $fullUrl
- * @param string $user
- * @param string $password
- * @param string $xRequestId
- * @param array $headers
- * @return ResponseInterface
- * @throws GuzzleException
- */
- public function sendPropfindRequestToUrl(
- string $fullUrl,
- string $user,
- string $password,
- string $xRequestId = '',
- array $headers = []
- ): ResponseInterface
- {
- return HttpRequestHelper::sendRequest($fullUrl, $xRequestId, 'PROPFIND', $user, $password, $headers);
- }
+ /**
+ * Send Propfind Request to Url
+ *
+ * @param string $fullUrl
+ * @param string $user
+ * @param string $password
+ * @param string $xRequestId
+ * @param array $headers
+ *
+ * @return ResponseInterface
+ *
+ * @throws GuzzleException
+ */
+ public function sendPropfindRequestToUrl(
+ string $fullUrl,
+ string $user,
+ string $password,
+ string $xRequestId = '',
+ array $headers = []
+ ): ResponseInterface {
+ return HttpRequestHelper::sendRequest($fullUrl, $xRequestId, 'PROPFIND', $user, $password, $headers);
+ }
- /**
- * @When /^user "([^"]*)" lists all available spaces via the GraphApi$/
- *
- * @param string $user
- * @return void
- * @throws GuzzleException
- */
- public function theUserListsAllHisAvailableSpacesUsingTheGraphApi(string $user): void
- {
- $this->featureContext->setResponse(
- $this->listSpacesRequest(
- $this->featureContext->getBaseUrl(),
- $user,
- $this->featureContext->getPasswordForUser($user),
- "",
- ""
- )
- );
- $this->rememberTheAvailableSpaces();
- }
+ /**
+ * @When /^user "([^"]*)" lists all available spaces via the GraphApi$/
+ *
+ * @param string $user
+ *
+ * @return void
+ *
+ * @throws GuzzleException
+ */
+ public function theUserListsAllHisAvailableSpacesUsingTheGraphApi(string $user): void {
+ $this->featureContext->setResponse(
+ $this->listSpacesRequest(
+ $this->featureContext->getBaseUrl(),
+ $user,
+ $this->featureContext->getPasswordForUser($user),
+ "",
+ ""
+ )
+ );
+ $this->rememberTheAvailableSpaces();
+ }
- /**
- * @When /^user "([^"]*)" creates a space "([^"]*)" of type "([^"]*)" with the default quota using the GraphApi$/
- *
- * @param string $user
- * @param string $spaceName
- * @param string $spaceType
- *
- * @return void
- * @throws GuzzleException
- * @throws Exception
- */
- public function theUserCreatesASpaceUsingTheGraphApi(
- string $user,
- string $spaceName,
- string $spaceType): void
- {
- $space = ["Name" => $spaceName, "driveType" => $spaceType];
- $body = json_encode($space, JSON_THROW_ON_ERROR);
- $this->featureContext->setResponse(
- $this->sendCreateSpaceRequest(
- $this->featureContext->getBaseUrl(),
- $user,
- $this->featureContext->getPasswordForUser($user),
- $body,
- ""
- )
- );
- }
+ /**
+ * @When /^user "([^"]*)" creates a space "([^"]*)" of type "([^"]*)" with the default quota using the GraphApi$/
+ *
+ * @param string $user
+ * @param string $spaceName
+ * @param string $spaceType
+ *
+ * @return void
+ *
+ * @throws GuzzleException
+ * @throws Exception
+ */
+ public function theUserCreatesASpaceUsingTheGraphApi(
+ string $user,
+ string $spaceName,
+ string $spaceType
+ ): void {
+ $space = ["Name" => $spaceName, "driveType" => $spaceType];
+ $body = json_encode($space, JSON_THROW_ON_ERROR);
+ $this->featureContext->setResponse(
+ $this->sendCreateSpaceRequest(
+ $this->featureContext->getBaseUrl(),
+ $user,
+ $this->featureContext->getPasswordForUser($user),
+ $body,
+ ""
+ )
+ );
+ }
- /**
- * @When /^user "([^"]*)" creates a space "([^"]*)" of type "([^"]*)" with quota "([^"]*)" using the GraphApi$/
- *
- * @param string $user
- * @param string $spaceName
- * @param string $spaceType
- * @param int $quota
- *
- * @return void
- * @throws GuzzleException
- * @throws Exception
- */
- public function theUserCreatesASpaceWithQuotaUsingTheGraphApi(
- string $user,
- string $spaceName,
- string $spaceType,
- int $quota): void
- {
- $space = ["Name" => $spaceName, "driveType" => $spaceType, "quota" => ["total" => $quota]];
- $body = json_encode($space);
- $this->featureContext->setResponse(
- $this->sendCreateSpaceRequest(
- $this->featureContext->getBaseUrl(),
- $user,
- $this->featureContext->getPasswordForUser($user),
- $body,
- ""
- )
- );
- }
+ /**
+ * @When /^user "([^"]*)" creates a space "([^"]*)" of type "([^"]*)" with quota "([^"]*)" using the GraphApi$/
+ *
+ * @param string $user
+ * @param string $spaceName
+ * @param string $spaceType
+ * @param int $quota
+ *
+ * @return void
+ *
+ * @throws GuzzleException
+ * @throws Exception
+ */
+ public function theUserCreatesASpaceWithQuotaUsingTheGraphApi(
+ string $user,
+ string $spaceName,
+ string $spaceType,
+ int $quota
+ ): void {
+ $space = ["Name" => $spaceName, "driveType" => $spaceType, "quota" => ["total" => $quota]];
+ $body = json_encode($space);
+ $this->featureContext->setResponse(
+ $this->sendCreateSpaceRequest(
+ $this->featureContext->getBaseUrl(),
+ $user,
+ $this->featureContext->getPasswordForUser($user),
+ $body,
+ ""
+ )
+ );
+ }
- /**
- * @When /^the administrator gives "([^"]*)" the role "([^"]*)" using the settings api$/
- *
- * @param string $user
- * @param string $role
- *
- * @return void
- * @throws GuzzleException
- * @throws Exception
- */
- public function theAdministratorGivesUserTheRole(string $user, string $role): void
- {
- $admin = $this->featureContext->getAdminUsername();
- $password = $this->featureContext->getAdminPassword();
- $headers = [];
- $bundles = [];
- $accounts = [];
- $assignment = [];
+ /**
+ * @When /^the administrator gives "([^"]*)" the role "([^"]*)" using the settings api$/
+ *
+ * @param string $user
+ * @param string $role
+ *
+ * @return void
+ *
+ * @throws GuzzleException
+ * @throws Exception
+ */
+ public function theAdministratorGivesUserTheRole(string $user, string $role): void {
+ $admin = $this->featureContext->getAdminUsername();
+ $password = $this->featureContext->getAdminPassword();
+ $headers = [];
+ $bundles = [];
+ $accounts = [];
+ $assignment = [];
- $baseUrl = $this->featureContext->getBaseUrl();
- if (!str_ends_with($baseUrl, '/')) {
- $baseUrl .= '/';
- }
- // get the roles list first
- $fullUrl = $baseUrl . "api/v0/settings/roles-list";
- $this->featureContext->setResponse(HttpRequestHelper::post($fullUrl, "", $admin, $password, $headers, "{}"));
- if ($this->featureContext->getResponse()) {
- $rawBody = $this->featureContext->getResponse()->getBody()->getContents();
- if (isset(\json_decode($rawBody, true, 512, JSON_THROW_ON_ERROR)["bundles"])) {
- $bundles = \json_decode($rawBody, true, 512, JSON_THROW_ON_ERROR)["bundles"];
- }
- }
- $roleToAssign = "";
- foreach($bundles as $value) {
- // find the selected role
- if ($value["displayName"] === $role) {
- $roleToAssign = $value;
- }
- }
- Assert::assertNotEmpty($roleToAssign, "The selected role $role could not be found");
+ $baseUrl = $this->featureContext->getBaseUrl();
+ if (!str_ends_with($baseUrl, '/')) {
+ $baseUrl .= '/';
+ }
+ // get the roles list first
+ $fullUrl = $baseUrl . "api/v0/settings/roles-list";
+ $this->featureContext->setResponse(HttpRequestHelper::post($fullUrl, "", $admin, $password, $headers, "{}"));
+ if ($this->featureContext->getResponse()) {
+ $rawBody = $this->featureContext->getResponse()->getBody()->getContents();
+ if (isset(\json_decode($rawBody, true, 512, JSON_THROW_ON_ERROR)["bundles"])) {
+ $bundles = \json_decode($rawBody, true, 512, JSON_THROW_ON_ERROR)["bundles"];
+ }
+ }
+ $roleToAssign = "";
+ foreach ($bundles as $value) {
+ // find the selected role
+ if ($value["displayName"] === $role) {
+ $roleToAssign = $value;
+ }
+ }
+ Assert::assertNotEmpty($roleToAssign, "The selected role $role could not be found");
- // get the accounts list first
- $fullUrl = $baseUrl . "api/v0/accounts/accounts-list";
- $this->featureContext->setResponse(HttpRequestHelper::post($fullUrl, "", $admin, $password, $headers, "{}"));
- if ($this->featureContext->getResponse()) {
- $rawBody = $this->featureContext->getResponse()->getBody()->getContents();
- if (isset(\json_decode($rawBody, true, 512, JSON_THROW_ON_ERROR)["accounts"])) {
- $accounts = \json_decode($rawBody, true, 512, JSON_THROW_ON_ERROR)["accounts"];
- }
- }
- $accountToChange = "";
- foreach($accounts as $account) {
- // find the selected user
- if ($account["preferredName"] === $user) {
- $accountToChange = $account;
- }
- }
- Assert::assertNotEmpty($accountToChange, "The selected account $user does not exist");
+ // get the accounts list first
+ $fullUrl = $baseUrl . "api/v0/accounts/accounts-list";
+ $this->featureContext->setResponse(HttpRequestHelper::post($fullUrl, "", $admin, $password, $headers, "{}"));
+ if ($this->featureContext->getResponse()) {
+ $rawBody = $this->featureContext->getResponse()->getBody()->getContents();
+ if (isset(\json_decode($rawBody, true, 512, JSON_THROW_ON_ERROR)["accounts"])) {
+ $accounts = \json_decode($rawBody, true, 512, JSON_THROW_ON_ERROR)["accounts"];
+ }
+ }
+ $accountToChange = "";
+ foreach ($accounts as $account) {
+ // find the selected user
+ if ($account["preferredName"] === $user) {
+ $accountToChange = $account;
+ }
+ }
+ Assert::assertNotEmpty($accountToChange, "The selected account $user does not exist");
- // set the new role
- $fullUrl = $baseUrl . "api/v0/settings/assignments-add";
- $body = json_encode(["account_uuid" => $accountToChange["id"], "role_id" => $roleToAssign["id"]], JSON_THROW_ON_ERROR);
+ // set the new role
+ $fullUrl = $baseUrl . "api/v0/settings/assignments-add";
+ $body = json_encode(["account_uuid" => $accountToChange["id"], "role_id" => $roleToAssign["id"]], JSON_THROW_ON_ERROR);
- $this->featureContext->setResponse(HttpRequestHelper::post($fullUrl, "", $admin, $password, $headers, $body));
- if ($this->featureContext->getResponse()) {
- $rawBody = $this->featureContext->getResponse()->getBody()->getContents();
- if (isset(\json_decode($rawBody, true, 512, JSON_THROW_ON_ERROR)["assignment"])) {
- $assignment = \json_decode($rawBody, true, 512, JSON_THROW_ON_ERROR)["assignment"];
- }
- }
+ $this->featureContext->setResponse(HttpRequestHelper::post($fullUrl, "", $admin, $password, $headers, $body));
+ if ($this->featureContext->getResponse()) {
+ $rawBody = $this->featureContext->getResponse()->getBody()->getContents();
+ if (isset(\json_decode($rawBody, true, 512, JSON_THROW_ON_ERROR)["assignment"])) {
+ $assignment = \json_decode($rawBody, true, 512, JSON_THROW_ON_ERROR)["assignment"];
+ }
+ }
- Assert::assertEquals($accountToChange["id"], $assignment["accountUuid"]);
- Assert::assertEquals($roleToAssign["id"], $assignment["roleId"]);
- }
+ Assert::assertEquals($accountToChange["id"], $assignment["accountUuid"]);
+ Assert::assertEquals($roleToAssign["id"], $assignment["roleId"]);
+ }
+ /**
+ * Remember the available Spaces
+ *
+ * @return void
+ *
+ * @throws Exception
+ */
+ public function rememberTheAvailableSpaces(): void {
+ $rawBody = $this->featureContext->getResponse()->getBody()->getContents();
+ $drives = json_decode($rawBody, true, 512, JSON_THROW_ON_ERROR);
+ if (isset($drives["value"])) {
+ $drives = $drives["value"];
+ }
- /**
- * Remember the available Spaces
- *
- * @return void
- *
- * @throws Exception
- */
- public function rememberTheAvailableSpaces(): void
- {
- $rawBody = $this->featureContext->getResponse()->getBody()->getContents();
- $drives = json_decode($rawBody, true, 512, JSON_THROW_ON_ERROR);
- if (isset($drives["value"])) {
- $drives = $drives["value"];
- }
+ Assert::assertArrayHasKey(0, $drives, "No drives were found on that endpoint");
+ $spaces = [];
+ foreach ($drives as $drive) {
+ $spaces[$drive["name"]] = $drive;
+ }
+ $this->setAvailableSpaces($spaces);
+ Assert::assertNotEmpty($spaces, "No spaces have been found");
+ }
- Assert::assertArrayHasKey(0, $drives, "No drives were found on that endpoint");
- $spaces = [];
- foreach($drives as $drive) {
- $spaces[$drive["name"]] = $drive;
- }
- $this->setAvailableSpaces($spaces);
- Assert::assertNotEmpty($spaces, "No spaces have been found");
- }
+ /**
+ * @When /^user "([^"]*)" lists the content of the space with the name "([^"]*)" using the WebDav Api$/
+ *
+ * @param string $user
+ * @param string $name
+ *
+ * @return void
+ *
+ * @throws GuzzleException
+ */
+ public function theUserListsTheContentOfAPersonalSpaceRootUsingTheWebDAvApi(
+ string $user,
+ string $name
+ ): void {
+ $spaceId = $this->getAvailableSpaces()[$name]["id"];
+ $spaceWebDavUrl = $this->getAvailableSpaces()[$name]["root"]["webDavUrl"];
+ $this->featureContext->setResponse(
+ $this->sendPropfindRequestToUrl(
+ $spaceWebDavUrl,
+ $user,
+ $this->featureContext->getPasswordForUser($user),
+ "",
+ [],
+ )
+ );
+ $this->setResponseSpaceId($spaceId);
+ $this->setResponseXml(
+ HttpRequestHelper::parseResponseAsXml($this->featureContext->getResponse())
+ );
+ }
- /**
- * @When /^user "([^"]*)" lists the content of the space with the name "([^"]*)" using the WebDav Api$/
- *
- * @param string $user
- * @param string $name
- * @return void
- * @throws GuzzleException
- */
- public function theUserListsTheContentOfAPersonalSpaceRootUsingTheWebDAvApi(
- string $user,
- string $name
- ): void
- {
- $spaceId = $this->getAvailableSpaces()[$name]["id"];
- $spaceWebDavUrl = $this->getAvailableSpaces()[$name]["root"]["webDavUrl"];
- $this->featureContext->setResponse(
- $this->sendPropfindRequestToUrl(
- $spaceWebDavUrl,
- $user,
- $this->featureContext->getPasswordForUser($user),
- "",
- [],
- )
- );
- $this->setResponseSpaceId($spaceId);
- $this->setResponseXml(HttpRequestHelper::parseResponseAsXml($this->featureContext->getResponse())
- );
- }
+ /**
+ * @Then /^the (?:propfind|search) result of the space should (not|)\s?contain these (?:files|entries):$/
+ *
+ * @param string $shouldOrNot (not|)
+ * @param TableNode $expectedFiles
+ *
+ * @return void
+ *
+ * @throws Exception
+ */
+ public function thePropfindResultShouldContainEntries(
+ string $shouldOrNot,
+ TableNode $expectedFiles
+ ):void {
+ $this->propfindResultShouldContainEntries(
+ $shouldOrNot,
+ $expectedFiles,
+ );
+ }
- /**
- * @Then /^the (?:propfind|search) result of the space should (not|)\s?contain these (?:files|entries):$/
- *
- * @param string $shouldOrNot (not|)
- * @param TableNode $expectedFiles
- *
- * @return void
- * @throws Exception
- */
- public function thePropfindResultShouldContainEntries(
- string $shouldOrNot,
- TableNode $expectedFiles
- ):void {
- $this->propfindResultShouldContainEntries(
- $shouldOrNot,
- $expectedFiles,
- );
- }
+ /**
+ * @Then /^the json responded should contain a space "([^"]*)" with these key and value pairs:$/
+ *
+ * @param string $spaceName
+ * @param TableNode $table
+ *
+ * @return void
+ *
+ * @throws Exception
+ */
+ public function jsonRespondedShouldContain(
+ string $spaceName,
+ TableNode $table
+ ): void {
+ $this->featureContext->verifyTableNodeColumns($table, ['key', 'value']);
+ Assert::assertIsArray($spaceAsArray = $this->getSpaceByName($spaceName), "No space with name $spaceName found");
+ foreach ($table->getHash() as $row) {
+ // remember the original Space Array
+ $original = $spaceAsArray;
+ $row['value'] = $this->featureContext->substituteInLineCodes(
+ $row['value'],
+ $this->featureContext->getCurrentUser(),
+ [],
+ [
+ [
+ "code" => "%space_id%",
+ "function" =>
+ [$this, "getSpaceIdByName"],
+ "parameter" => [$spaceName]
+ ]
+ ]
+ );
+ $segments = explode("@@@", $row["key"]);
+ // traverse down in the array
+ foreach ($segments as $segment) {
+ $arrayKeyExists = \array_key_exists($segment, $spaceAsArray);
+ $key = $row["key"];
+ Assert::assertTrue($arrayKeyExists, "The key $key does not exist on the response");
+ if ($arrayKeyExists) {
+ $spaceAsArray = $spaceAsArray[$segment];
+ }
+ }
+ Assert::assertEquals($row["value"], $spaceAsArray);
+ // set the spaceArray to the point before traversing
+ $spaceAsArray = $original;
+ }
+ }
- /**
- * @Then /^the json responded should contain a space "([^"]*)" with these key and value pairs:$/
- *
- * @param string $spaceName
- * @param TableNode $table
- *
- * @return void
- * @throws Exception
- */
- public function jsonRespondedShouldContain(
- string $spaceName,
- TableNode $table
- ): void {
- $this->featureContext->verifyTableNodeColumns($table, ['key', 'value']);
- Assert::assertIsArray($spaceAsArray = $this->getSpaceByName($spaceName), "No space with name $spaceName found");
- foreach ($table->getHash() as $row) {
- // remember the original Space Array
- $original = $spaceAsArray;
- $row['value'] = $this->featureContext->substituteInLineCodes(
- $row['value'],
- $this->featureContext->getCurrentUser(),
- [],
- [
- [
- "code" => "%space_id%",
- "function" =>
- [$this, "getSpaceIdByName"],
- "parameter" => [$spaceName]
- ]
- ]
- );
- $segments = explode("@@@", $row["key"]);
- // traverse down in the array
- foreach ($segments as $segment) {
- $arrayKeyExists = array_key_exists($segment, $spaceAsArray);
- $key = $row["key"];
- Assert::assertTrue($arrayKeyExists, "The key $key does not exist on the response");
- if ($arrayKeyExists) {
- $spaceAsArray = $spaceAsArray[$segment];
- }
- }
- Assert::assertEquals($row["value"], $spaceAsArray);
- // set the spaceArray to the point before traversing
- $spaceAsArray = $original;
- }
- }
+ /**
+ * @param string $shouldOrNot (not|)
+ * @param TableNode $expectedFiles
+ *
+ * @return void
+ *
+ * @throws Exception
+ */
+ public function propfindResultShouldContainEntries(
+ string $shouldOrNot,
+ TableNode $expectedFiles
+ ): void {
+ $this->verifyTableNodeColumnsCount($expectedFiles, 1);
+ $elementRows = $expectedFiles->getRows();
+ $should = ($shouldOrNot !== "not");
- /**
- * @param string $shouldOrNot (not|)
- * @param TableNode $expectedFiles
- *
- * @return void
- * @throws Exception
- */
- public function propfindResultShouldContainEntries(
- string $shouldOrNot,
- TableNode $expectedFiles
- ): void {
- $this->verifyTableNodeColumnsCount($expectedFiles, 1);
- $elementRows = $expectedFiles->getRows();
- $should = ($shouldOrNot !== "not");
+ foreach ($elementRows as $expectedFile) {
+ $fileFound = $this->findEntryFromPropfindResponse(
+ $expectedFile[0]
+ );
+ if ($should) {
+ Assert::assertNotEmpty(
+ $fileFound,
+ "response does not contain the entry '$expectedFile[0]'"
+ );
+ } else {
+ Assert::assertFalse(
+ $fileFound,
+ "response does contain the entry '$expectedFile[0]' but should not"
+ );
+ }
+ }
+ }
- foreach ($elementRows as $expectedFile) {
- $fileFound = $this->findEntryFromPropfindResponse(
- $expectedFile[0]
- );
- if ($should) {
- Assert::assertNotEmpty(
- $fileFound,
- "response does not contain the entry '$expectedFile[0]'"
- );
- } else {
- Assert::assertFalse(
- $fileFound,
- "response does contain the entry '$expectedFile[0]' but should not"
- );
- }
- }
- }
+ /**
+ * Verify that the tableNode contains expected number of columns
+ *
+ * @param TableNode $table
+ * @param int $count
+ *
+ * @return void
+ *
+ * @throws Exception
+ */
+ public function verifyTableNodeColumnsCount(
+ TableNode $table,
+ int $count
+ ): void {
+ if (\count($table->getRows()) < 1) {
+ throw new Exception("Table should have at least one row.");
+ }
+ $rowCount = \count($table->getRows()[0]);
+ if ($count !== $rowCount) {
+ throw new Exception("Table expected to have $count rows but found $rowCount");
+ }
+ }
- /**
- * Verify that the tableNode contains expected number of columns
- *
- * @param TableNode $table
- * @param int $count
- *
- * @return void
- * @throws Exception
- */
- public function verifyTableNodeColumnsCount(
- TableNode $table,
- int $count
- ): void {
- if (\count($table->getRows()) < 1) {
- throw new Exception("Table should have at least one row.");
- }
- $rowCount = \count($table->getRows()[0]);
- if ($count !== $rowCount) {
- throw new Exception("Table expected to have $count rows but found $rowCount");
- }
- }
+ /**
+ * parses a PROPFIND response from $this->response into xml
+ * and returns found search results if found else returns false
+ *
+ * @param string|null $entryNameToSearch
+ *
+ * @return array
+ * string if $entryNameToSearch is given and is found
+ * array if $entryNameToSearch is not given
+ * boolean false if $entryNameToSearch is given and is not found
+ */
+ public function findEntryFromPropfindResponse(
+ string $entryNameToSearch = null
+ ): array {
+ $spaceId = $this->getResponseSpaceId();
+ //if we are using that step the second time in a scenario e.g. 'But ... should not'
+ //then don't parse the result again, because the result in a ResponseInterface
+ if (empty($this->getResponseXml())) {
+ $this->setResponseXml(
+ HttpRequestHelper::parseResponseAsXml($this->featureContext->getResponse())
+ );
+ }
+ Assert::assertNotEmpty($this->getResponseXml(), __METHOD__ . ' Response is empty');
+ Assert::assertNotEmpty($spaceId, __METHOD__ . ' SpaceId is empty');
- /**
- * parses a PROPFIND response from $this->response into xml
- * and returns found search results if found else returns false
- *
- * @param string|null $entryNameToSearch
- * @return array
- * string if $entryNameToSearch is given and is found
- * array if $entryNameToSearch is not given
- * boolean false if $entryNameToSearch is given and is not found
- */
- public function findEntryFromPropfindResponse(
- string $entryNameToSearch = null
- ): array {
- $spaceId = $this->getResponseSpaceId();
- //if we are using that step the second time in a scenario e.g. 'But ... should not'
- //then don't parse the result again, because the result in a ResponseInterface
- if (empty($this->getResponseXml())) {
- $this->setResponseXml(
- HttpRequestHelper::parseResponseAsXml($this->featureContext->getResponse())
- );
- }
- Assert::assertNotEmpty($this->getResponseXml(), __METHOD__ . ' Response is empty');
- Assert::assertNotEmpty($spaceId, __METHOD__ . ' SpaceId is empty');
+ // trim any leading "/" passed by the caller, we can just match the "raw" name
+ $trimmedEntryNameToSearch = \trim($entryNameToSearch, "/");
- // trim any leading "/" passed by the caller, we can just match the "raw" name
- $trimmedEntryNameToSearch = \trim($entryNameToSearch, "/");
+ // topWebDavPath should be something like /remote.php/webdav/ or
+ // /remote.php/dav/files/alice/
+ $topWebDavPath = "/" . "dav/spaces/" . $spaceId . "/";
- // topWebDavPath should be something like /remote.php/webdav/ or
- // /remote.php/dav/files/alice/
- $topWebDavPath = "/" . "dav/spaces/" . $spaceId . "/";
+ Assert::assertIsArray(
+ $this->responseXml,
+ __METHOD__ . " responseXml for space $spaceId is not an array"
+ );
+ Assert::assertArrayHasKey(
+ "value",
+ $this->responseXml,
+ __METHOD__ . " responseXml for space $spaceId does not have key 'value'"
+ );
+ $multistatusResults = $this->responseXml["value"];
+ $results = [];
+ if ($multistatusResults !== null) {
+ foreach ($multistatusResults as $multistatusResult) {
+ $entryPath = $multistatusResult['value'][0]['value'];
+ $entryName = \str_replace($topWebDavPath, "", $entryPath);
+ $entryName = \rawurldecode($entryName);
+ $entryName = \trim($entryName, "/");
+ if ($trimmedEntryNameToSearch === $entryName) {
+ return $multistatusResult;
+ }
+ $results[] = $entryName;
+ }
+ }
+ if ($entryNameToSearch === null) {
+ return $results;
+ }
+ return [];
+ }
- Assert::assertIsArray(
- $this->responseXml,
- __METHOD__ . " responseXml for space $spaceId is not an array"
- );
- Assert::assertArrayHasKey(
- "value",
- $this->responseXml,
- __METHOD__ . " responseXml for space $spaceId does not have key 'value'"
- );
- $multistatusResults = $this->responseXml["value"];
- $results = [];
- if ($multistatusResults !== null) {
- foreach ($multistatusResults as $multistatusResult) {
- $entryPath = $multistatusResult['value'][0]['value'];
- $entryName = \str_replace($topWebDavPath, "", $entryPath);
- $entryName = \rawurldecode($entryName);
- $entryName = \trim($entryName, "/");
- if ($trimmedEntryNameToSearch === $entryName) {
- return $multistatusResult;
- }
- $results[] = $entryName;
- }
- }
- if ($entryNameToSearch === null) {
- return $results;
- }
- return [];
- }
+ /**
+ * @When /^user "([^"]*)" creates a folder "([^"]*)" in space "([^"]*)" using the WebDav Api$/
+ *
+ * @param string $user
+ * @param string $folder
+ * @param string $spaceName
+ *
+ * @return void
+ *
+ * @throws GuzzleException
+ */
+ public function theUserCreatesAFolderUsingTheGraphApi(
+ string $user,
+ string $folder,
+ string $spaceName
+ ): void {
+ $this->featureContext->setResponse(
+ $this->sendCreateFolderRequest(
+ $this->featureContext->getBaseUrl(),
+ "MKCOL",
+ $user,
+ $this->featureContext->getPasswordForUser($user),
+ $folder,
+ $spaceName
+ )
+ );
+ }
- /**
- * @When /^user "([^"]*)" creates a folder "([^"]*)" in space "([^"]*)" using the WebDav Api$/
- *
- * @param string $user
- * @param string $folder
- * @param string $spaceName
- *
- * @return void
- * @throws GuzzleException
- */
- public function theUserCreatesAFolderUsingTheGraphApi(
- string $user,
- string $folder,
- string $spaceName
- ): void
- {
- $this->featureContext->setResponse(
- $this->sendCreateFolderRequest(
- $this->featureContext->getBaseUrl(),
- "MKCOL",
- $user,
- $this->featureContext->getPasswordForUser($user),
- $folder,
- $spaceName
- )
- );
- }
+ /**
+ * Send Graph Create Space Request
+ *
+ * @param string $baseUrl
+ * @param string $method
+ * @param string $user
+ * @param string $password
+ * @param string $folder
+ * @param string $spaceName
+ * @param string $xRequestId
+ * @param array $headers
+ *
+ * @return ResponseInterface
+ *
+ * @throws GuzzleException
+ */
+ public function sendCreateFolderRequest(
+ string $baseUrl,
+ string $method,
+ string $user,
+ string $password,
+ string $folder,
+ string $spaceName,
+ string $xRequestId = '',
+ array $headers = []
+ ): ResponseInterface {
+ $spaceId = $this->getAvailableSpaces()[$spaceName]["id"];
+ $fullUrl = $baseUrl;
+ if (!str_ends_with($fullUrl, '/')) {
+ $fullUrl .= '/';
+ }
+ $fullUrl .= "dav/spaces/" . $spaceId . '/' . $folder;
- /**
- * Send Graph Create Space Request
- *
- * @param string $baseUrl
- * @param string $method
- * @param string $user
- * @param string $password
- * @param string $folder
- * @param string $spaceName
- * @param string $xRequestId
- * @param array $headers
- * @return ResponseInterface
- * @throws GuzzleException
- */
- public function sendCreateFolderRequest(
- string $baseUrl,
- string $method,
- string $user,
- string $password,
- string $folder,
- string $spaceName,
- string $xRequestId = '',
- array $headers = []
- ): ResponseInterface
- {
- $spaceId = $this->getAvailableSpaces()[$spaceName]["id"];
- $fullUrl = $baseUrl;
- if (!str_ends_with($fullUrl, '/')) {
- $fullUrl .= '/';
- }
- $fullUrl .= "dav/spaces/" . $spaceId . '/' . $folder;
-
- return HttpRequestHelper::sendRequest($fullUrl, $xRequestId, $method, $user, $password, $headers);
- }
+ return HttpRequestHelper::sendRequest($fullUrl, $xRequestId, $method, $user, $password, $headers);
+ }
}
diff --git a/tests/acceptance/features/bootstrap/bootstrap.php b/tests/acceptance/features/bootstrap/bootstrap.php
index 1e2175b1ba..7d4158c2b0 100644
--- a/tests/acceptance/features/bootstrap/bootstrap.php
+++ b/tests/acceptance/features/bootstrap/bootstrap.php
@@ -1,14 +1,37 @@
+ * @copyright Copyright (c) 2020 Phil Davis phil@jankaritech.com
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License,
+ * as published by the Free Software Foundation;
+ * either version 3 of the License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see
+ *
+ */
+
$pathToCore = \getenv('PATH_TO_CORE');
if ($pathToCore === false) {
- $pathToCore = "../core";
+ $pathToCore = "../core";
}
require_once $pathToCore . '/tests/acceptance/features/bootstrap/bootstrap.php';
$classLoader = new \Composer\Autoload\ClassLoader();
$classLoader->addPsr4(
- "", $pathToCore . "/tests/acceptance/features/bootstrap", true
+ "",
+ $pathToCore . "/tests/acceptance/features/bootstrap",
+ true
);
$classLoader->register();
diff --git a/vendor-bin/behat/composer.json b/vendor-bin/behat/composer.json
index 6c68dad09a..94d4ddd6a4 100644
--- a/vendor-bin/behat/composer.json
+++ b/vendor-bin/behat/composer.json
@@ -17,6 +17,7 @@
"guzzlehttp/guzzle": "^7.4",
"phpunit/phpunit": "^9.5",
"laminas/laminas-ldap": "^2.10",
- "ankitpokhrel/tus-php": "^2.1"
+ "ankitpokhrel/tus-php": "^2.1",
+ "wapmorgan/unified-archive": "^1.1.3"
}
}
diff --git a/vendor-bin/owncloud-codestyle/composer.json b/vendor-bin/owncloud-codestyle/composer.json
new file mode 100644
index 0000000000..209f1ccb0b
--- /dev/null
+++ b/vendor-bin/owncloud-codestyle/composer.json
@@ -0,0 +1,5 @@
+{
+ "require": {
+ "owncloud/coding-standard": "^3.0"
+ }
+ }
diff --git a/vendor-bin/php_codesniffer/composer.json b/vendor-bin/php_codesniffer/composer.json
new file mode 100644
index 0000000000..8c95351b4d
--- /dev/null
+++ b/vendor-bin/php_codesniffer/composer.json
@@ -0,0 +1,8 @@
+{
+ "require": {
+ "squizlabs/php_codesniffer": "^3.5"
+ },
+ "conflict": {
+ "squizlabs/php_codesniffer": "3.5.1"
+ }
+}