diff options
Diffstat (limited to 'build/integration/features/bootstrap/CommandLineContext.php')
-rw-r--r-- | build/integration/features/bootstrap/CommandLineContext.php | 48 |
1 files changed, 17 insertions, 31 deletions
diff --git a/build/integration/features/bootstrap/CommandLineContext.php b/build/integration/features/bootstrap/CommandLineContext.php index 2c434a1b89f..e7764356270 100644 --- a/build/integration/features/bootstrap/CommandLineContext.php +++ b/build/integration/features/bootstrap/CommandLineContext.php @@ -1,32 +1,13 @@ <?php + /** - * @copyright Copyright (c) 2016, ownCloud, Inc. - * - * @author Christoph Wurst <christoph@winzerhof-wurst.at> - * @author Daniel Calviño Sánchez <danxuliu@gmail.com> - * @author Lukas Reschke <lukas@statuscode.ch> - * @author Stefan Weil <sw@weilnetz.de> - * @author Sujith H <sharidasan@owncloud.com> - * @author Vincent Petry <vincent@nextcloud.com> - * - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * 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, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * + * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-FileCopyrightText: 2016 ownCloud, Inc. + * SPDX-License-Identifier: AGPL-3.0-only */ - require __DIR__ . '/../../vendor/autoload.php'; +use Behat\Behat\Context\Exception\ContextNotFoundException; use Behat\Behat\Hook\Scope\BeforeScenarioScope; use PHPUnit\Framework\Assert; @@ -36,6 +17,8 @@ class CommandLineContext implements \Behat\Behat\Context\Context { private $lastTransferPath; private $featureContext; + private $localBaseUrl; + private $remoteBaseUrl; public function __construct($ocPath, $baseUrl) { $this->ocPath = rtrim($ocPath, '/') . '/'; @@ -60,8 +43,12 @@ class CommandLineContext implements \Behat\Behat\Context\Context { /** @BeforeScenario */ public function gatherContexts(BeforeScenarioScope $scope) { $environment = $scope->getEnvironment(); - // this should really be "WebDavContext" ... - $this->featureContext = $environment->getContext('FeatureContext'); + // this should really be "WebDavContext" + try { + $this->featureContext = $environment->getContext('FeatureContext'); + } catch (ContextNotFoundException) { + $this->featureContext = $environment->getContext('DavFeatureContext'); + } } private function findLastTransferFolderForUser($sourceUser, $targetUser) { @@ -70,7 +57,7 @@ class CommandLineContext implements \Behat\Behat\Context\Context { foreach ($results as $path => $data) { $path = rawurldecode($path); $parts = explode(' ', $path); - if (basename($parts[0]) !== 'transferred') { + if (basename($parts[0]) !== 'Transferred') { continue; } if (isset($parts[2]) && $parts[2] === $sourceUser) { @@ -98,7 +85,7 @@ class CommandLineContext implements \Behat\Behat\Context\Context { } /** - * @When /^transferring ownership from "([^"]+)" to "([^"]+)"/ + * @When /^transferring ownership from "([^"]+)" to "([^"]+)"$/ */ public function transferringOwnership($user1, $user2) { if ($this->runOcc(['files:transfer-ownership', $user1, $user2]) === 0) { @@ -110,7 +97,7 @@ class CommandLineContext implements \Behat\Behat\Context\Context { } /** - * @When /^transferring ownership of path "([^"]+)" from "([^"]+)" to "([^"]+)"/ + * @When /^transferring ownership of path "([^"]+)" from "([^"]+)" to "([^"]+)"$/ */ public function transferringOwnershipPath($path, $user1, $user2) { $path = '--path=' . $path; @@ -122,7 +109,6 @@ class CommandLineContext implements \Behat\Behat\Context\Context { } } - /** * @When /^using received transfer folder of "([^"]+)" as dav path$/ */ @@ -136,6 +122,6 @@ class CommandLineContext implements \Behat\Behat\Context\Context { * @Then /^transfer folder name contains "([^"]+)"$/ */ public function transferFolderNameContains($text) { - Assert::assertContains($text, $this->lastTransferPath); + Assert::assertStringContainsString($text, $this->lastTransferPath); } } |