Files
opencloud/tests/parallelDeployAcceptance/features/bootstrap/ParallelContext.php
2023-05-10 11:15:19 +05:45

71 lines
2.0 KiB
PHP

<?php declare(strict_types=1);
/**
* ownCloud
*
* @author Sajan Gurung <sajan@jankaritech.com>
* @copyright Copyright (c) 2021 Sajan Gurung sajan@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 <http://www.gnu.org/licenses/>
*
*/
use Behat\Behat\Context\Context;
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
use TestHelpers\SetupHelper;
use TestHelpers\HttpRequestHelper;
require_once 'bootstrap.php';
/**
* Steps related to parallel deploy setup
*/
class ParallelContext implements Context {
/**
* @var FeatureContext
*/
private FeatureContext $featureContext;
/**
* @BeforeScenario
*
* @param BeforeScenarioScope $scope
*
* @return void
*
* @throws Exception
*/
public function setUpScenario(BeforeScenarioScope $scope): void {
$environment = $scope->getEnvironment();
$this->featureContext = $environment->getContext('FeatureContext');
SetupHelper::init(
$this->featureContext->getAdminUsername(),
$this->featureContext->getAdminPassword(),
$this->featureContext->getBaseUrl(),
$this->featureContext->getOcPath()
);
}
/**
* @Given using :selector as owncloud selector
*
* @param string $selector 'ocis' or 'oc10'
*
* @return void
*/
public function usingOwncloudSelector(string $selector): void {
$this->featureContext->setOCSelector($selector);
HttpRequestHelper::setOCSelectorCookie("owncloud-selector=$selector;path=/;");
}
}