mirror of
https://github.com/nextcloud/server.git
synced 2026-06-09 00:32:29 -04:00
chore: Run rector on integration bootstrap code
This avoids integration PHP code to use deprecated method and crash when we remove them. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
39c14c383b
commit
082664c0c2
17 changed files with 57 additions and 54 deletions
|
|
@ -12,8 +12,6 @@ use GuzzleHttp\Exception\GuzzleException;
|
|||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class CalDavContext implements \Behat\Behat\Context\Context {
|
||||
/** @var string */
|
||||
private $baseUrl;
|
||||
/** @var Client */
|
||||
private $client;
|
||||
/** @var ResponseInterface */
|
||||
|
|
@ -24,9 +22,9 @@ class CalDavContext implements \Behat\Behat\Context\Context {
|
|||
/**
|
||||
* @param string $baseUrl
|
||||
*/
|
||||
public function __construct($baseUrl) {
|
||||
$this->baseUrl = $baseUrl;
|
||||
|
||||
public function __construct(
|
||||
private $baseUrl,
|
||||
) {
|
||||
// in case of ci deployment we take the server url from the environment
|
||||
$testServerUrl = getenv('TEST_SERVER_URL');
|
||||
if ($testServerUrl !== false) {
|
||||
|
|
|
|||
|
|
@ -12,8 +12,6 @@ use GuzzleHttp\Exception\GuzzleException;
|
|||
use GuzzleHttp\Message\ResponseInterface;
|
||||
|
||||
class CardDavContext implements \Behat\Behat\Context\Context {
|
||||
/** @var string */
|
||||
private $baseUrl;
|
||||
/** @var Client */
|
||||
private $client;
|
||||
/** @var ResponseInterface */
|
||||
|
|
@ -21,12 +19,9 @@ class CardDavContext implements \Behat\Behat\Context\Context {
|
|||
/** @var string */
|
||||
private $responseXml = '';
|
||||
|
||||
/**
|
||||
* @param string $baseUrl
|
||||
*/
|
||||
public function __construct($baseUrl) {
|
||||
$this->baseUrl = $baseUrl;
|
||||
|
||||
public function __construct(
|
||||
private string $baseUrl,
|
||||
) {
|
||||
// in case of ci deployment we take the server url from the environment
|
||||
$testServerUrl = getenv('TEST_SERVER_URL');
|
||||
if ($testServerUrl !== false) {
|
||||
|
|
|
|||
|
|
@ -11,19 +11,14 @@ use GuzzleHttp\Client;
|
|||
use GuzzleHttp\Message\ResponseInterface;
|
||||
|
||||
class ChecksumsContext implements \Behat\Behat\Context\Context {
|
||||
/** @var string */
|
||||
private $baseUrl;
|
||||
/** @var Client */
|
||||
private $client;
|
||||
/** @var ResponseInterface */
|
||||
private $response;
|
||||
|
||||
/**
|
||||
* @param string $baseUrl
|
||||
*/
|
||||
public function __construct($baseUrl) {
|
||||
$this->baseUrl = $baseUrl;
|
||||
|
||||
public function __construct(
|
||||
private string $baseUrl,
|
||||
) {
|
||||
// in case of ci deployment we take the server url from the environment
|
||||
$testServerUrl = getenv('TEST_SERVER_URL');
|
||||
if ($testServerUrl !== false) {
|
||||
|
|
|
|||
|
|
@ -17,13 +17,12 @@ class CommandLineContext implements \Behat\Behat\Context\Context {
|
|||
private $lastTransferPath;
|
||||
|
||||
private $featureContext;
|
||||
private $localBaseUrl;
|
||||
private $remoteBaseUrl;
|
||||
|
||||
public function __construct($ocPath, $baseUrl) {
|
||||
public function __construct(
|
||||
$ocPath,
|
||||
private $baseUrl,
|
||||
) {
|
||||
$this->ocPath = rtrim($ocPath, '/') . '/';
|
||||
$this->localBaseUrl = $baseUrl;
|
||||
$this->remoteBaseUrl = $baseUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@
|
|||
require __DIR__ . '/autoload.php';
|
||||
|
||||
class CommentsContext implements \Behat\Behat\Context\Context {
|
||||
/** @var string */
|
||||
private $baseUrl;
|
||||
/** @var array */
|
||||
private $response;
|
||||
/** @var int */
|
||||
|
|
@ -20,9 +18,9 @@ class CommentsContext implements \Behat\Behat\Context\Context {
|
|||
/**
|
||||
* @param string $baseUrl
|
||||
*/
|
||||
public function __construct($baseUrl) {
|
||||
$this->baseUrl = $baseUrl;
|
||||
|
||||
public function __construct(
|
||||
private $baseUrl,
|
||||
) {
|
||||
// in case of ci deployment we take the server url from the environment
|
||||
$testServerUrl = getenv('TEST_SERVER_URL');
|
||||
if ($testServerUrl !== false) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
|
|
|||
|
|
@ -16,13 +16,12 @@ use GuzzleHttp\Utils;
|
|||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class PrincipalPropertySearchContext implements Context {
|
||||
private string $baseUrl;
|
||||
private Client $client;
|
||||
private ResponseInterface $response;
|
||||
|
||||
public function __construct(string $baseUrl) {
|
||||
$this->baseUrl = $baseUrl;
|
||||
|
||||
public function __construct(
|
||||
private string $baseUrl,
|
||||
) {
|
||||
// in case of ci deployment we take the server url from the environment
|
||||
$testServerUrl = getenv('TEST_SERVER_URL');
|
||||
if ($testServerUrl !== false) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
|
|
|||
|
|
@ -5,7 +5,14 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
use Behat\Behat\Context\Context;
|
||||
use OC\Remote\Api\OCS;
|
||||
use OC\Remote\Credentials;
|
||||
use OC\Remote\Instance;
|
||||
use OC\Remote\User;
|
||||
use OCP\Http\Client\IClientService;
|
||||
use OCP\ICacheFactory;
|
||||
use OCP\IConfig;
|
||||
use OCP\Server;
|
||||
use PHPUnit\Framework\Assert;
|
||||
|
||||
require __DIR__ . '/autoload.php';
|
||||
|
|
@ -14,26 +21,25 @@ require __DIR__ . '/autoload.php';
|
|||
* Remote context.
|
||||
*/
|
||||
class RemoteContext implements Context {
|
||||
/** @var \OC\Remote\Instance */
|
||||
/** @var Instance */
|
||||
protected $remoteInstance;
|
||||
|
||||
/** @var \OC\Remote\Credentials */
|
||||
/** @var Credentials */
|
||||
protected $credentails;
|
||||
|
||||
/** @var \OC\Remote\User */
|
||||
/** @var User */
|
||||
protected $userResult;
|
||||
|
||||
protected $remoteUrl;
|
||||
|
||||
protected $lastException;
|
||||
|
||||
public function __construct($remote) {
|
||||
public function __construct(
|
||||
private string $remote,
|
||||
) {
|
||||
require_once __DIR__ . '/../../../../lib/base.php';
|
||||
$this->remoteUrl = $remote;
|
||||
}
|
||||
|
||||
protected function getApiClient() {
|
||||
return new \OC\Remote\Api\OCS($this->remoteInstance, $this->credentails, \OC::$server->get(IClientService::class));
|
||||
return new OCS($this->remoteInstance, $this->credentails, Server::get(IClientService::class));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -43,13 +49,13 @@ class RemoteContext implements Context {
|
|||
*/
|
||||
public function selectRemoteInstance($remoteServer) {
|
||||
if ($remoteServer == 'REMOTE') {
|
||||
$baseUri = $this->remoteUrl;
|
||||
$baseUri = $this->remote;
|
||||
} else {
|
||||
$baseUri = 'nonexistingnextcloudserver.local';
|
||||
}
|
||||
$this->lastException = null;
|
||||
try {
|
||||
$this->remoteInstance = new \OC\Remote\Instance($baseUri, \OC::$server->getMemCacheFactory()->createLocal(), \OC::$server->get(IClientService::class));
|
||||
$this->remoteInstance = new Instance($baseUri, Server::get(ICacheFactory::class)->createLocal(), Server::get(IClientService::class));
|
||||
// trigger the status request
|
||||
$this->remoteInstance->getProtocol();
|
||||
} catch (\Exception $e) {
|
||||
|
|
@ -63,7 +69,7 @@ class RemoteContext implements Context {
|
|||
*/
|
||||
public function theRemoteVersionShouldBe($version) {
|
||||
if ($version === '__current_version__') {
|
||||
$version = \OC::$server->getConfig()->getSystemValue('version', '0.0.0.0');
|
||||
$version = Server::get(IConfig::class)->getSystemValue('version', '0.0.0.0');
|
||||
}
|
||||
|
||||
Assert::assertEquals($version, $this->remoteInstance->getVersion());
|
||||
|
|
@ -83,7 +89,7 @@ class RemoteContext implements Context {
|
|||
* @param string $password
|
||||
*/
|
||||
public function usingCredentials($user, $password) {
|
||||
$this->credentails = new \OC\Remote\Credentials($user, $password);
|
||||
$this->credentails = new Credentials($user, $password);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
||||
|
|
|
|||
|
|
@ -619,9 +619,9 @@ trait Sharing {
|
|||
} elseif ($contentExpected === 'A_TOKEN') {
|
||||
// A token is composed by 15 characters from
|
||||
// ISecureRandom::CHAR_HUMAN_READABLE.
|
||||
Assert::assertRegExp('/^[abcdefgijkmnopqrstwxyzABCDEFGHJKLMNPQRSTWXYZ23456789]{15}$/', (string)$returnedShare->$field, "Field '$field' is not a token");
|
||||
Assert::assertMatchesRegularExpression('/^[abcdefgijkmnopqrstwxyzABCDEFGHJKLMNPQRSTWXYZ23456789]{15}$/', (string)$returnedShare->$field, "Field '$field' is not a token");
|
||||
} elseif (strpos($contentExpected, 'REGEXP ') === 0) {
|
||||
Assert::assertRegExp(substr($contentExpected, strlen('REGEXP ')), (string)$returnedShare->$field, "Field '$field' does not match");
|
||||
Assert::assertMatchesRegularExpression(substr($contentExpected, strlen('REGEXP ')), (string)$returnedShare->$field, "Field '$field' does not match");
|
||||
} else {
|
||||
Assert::assertEquals($contentExpected, (string)$returnedShare->$field, "Field '$field' does not match");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
|
|
|||
|
|
@ -12,8 +12,6 @@ use GuzzleHttp\Client;
|
|||
use GuzzleHttp\Message\ResponseInterface;
|
||||
|
||||
class TagsContext implements \Behat\Behat\Context\Context {
|
||||
/** @var string */
|
||||
private $baseUrl;
|
||||
/** @var Client */
|
||||
private $client;
|
||||
/** @var ResponseInterface */
|
||||
|
|
@ -22,9 +20,9 @@ class TagsContext implements \Behat\Behat\Context\Context {
|
|||
/**
|
||||
* @param string $baseUrl
|
||||
*/
|
||||
public function __construct($baseUrl) {
|
||||
$this->baseUrl = $baseUrl;
|
||||
|
||||
public function __construct(
|
||||
private $baseUrl,
|
||||
) {
|
||||
// in case of ci deployment we take the server url from the environment
|
||||
$testServerUrl = getenv('TEST_SERVER_URL');
|
||||
if ($testServerUrl !== false) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ return (require 'rector-shared.php')
|
|||
$nextcloudDir . '/version.php',
|
||||
$nextcloudDir . '/lib/private',
|
||||
$nextcloudDir . '/tests',
|
||||
$nextcloudDir . '/build/integration/features/bootstrap',
|
||||
// $nextcloudDir . '/config',
|
||||
// $nextcloudDir . '/themes',
|
||||
])
|
||||
|
|
|
|||
Loading…
Reference in a new issue