diff --git a/build/integration/features/bootstrap/CalDavContext.php b/build/integration/features/bootstrap/CalDavContext.php index 2b697c07681..a18097bb882 100644 --- a/build/integration/features/bootstrap/CalDavContext.php +++ b/build/integration/features/bootstrap/CalDavContext.php @@ -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) { diff --git a/build/integration/features/bootstrap/CardDavContext.php b/build/integration/features/bootstrap/CardDavContext.php index bde6177df39..e7556bbd834 100644 --- a/build/integration/features/bootstrap/CardDavContext.php +++ b/build/integration/features/bootstrap/CardDavContext.php @@ -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) { diff --git a/build/integration/features/bootstrap/ChecksumsContext.php b/build/integration/features/bootstrap/ChecksumsContext.php index b569527667a..86d52f8dba4 100644 --- a/build/integration/features/bootstrap/ChecksumsContext.php +++ b/build/integration/features/bootstrap/ChecksumsContext.php @@ -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) { diff --git a/build/integration/features/bootstrap/CommandLineContext.php b/build/integration/features/bootstrap/CommandLineContext.php index 429b7ae3550..8b21fcdbf70 100644 --- a/build/integration/features/bootstrap/CommandLineContext.php +++ b/build/integration/features/bootstrap/CommandLineContext.php @@ -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; } /** diff --git a/build/integration/features/bootstrap/CommentsContext.php b/build/integration/features/bootstrap/CommentsContext.php index 9c9dfafee10..594d5617efe 100644 --- a/build/integration/features/bootstrap/CommentsContext.php +++ b/build/integration/features/bootstrap/CommentsContext.php @@ -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) { diff --git a/build/integration/features/bootstrap/ConversionsContext.php b/build/integration/features/bootstrap/ConversionsContext.php index 223b8ee6b2d..847e5a9bec5 100644 --- a/build/integration/features/bootstrap/ConversionsContext.php +++ b/build/integration/features/bootstrap/ConversionsContext.php @@ -1,5 +1,7 @@ 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) { diff --git a/build/integration/features/bootstrap/RateLimitingContext.php b/build/integration/features/bootstrap/RateLimitingContext.php index 15c8c5c8379..f649396920a 100644 --- a/build/integration/features/bootstrap/RateLimitingContext.php +++ b/build/integration/features/bootstrap/RateLimitingContext.php @@ -1,5 +1,7 @@ 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); } /** diff --git a/build/integration/features/bootstrap/SetupContext.php b/build/integration/features/bootstrap/SetupContext.php index 84e8ffcff6d..35688c26492 100644 --- a/build/integration/features/bootstrap/SetupContext.php +++ b/build/integration/features/bootstrap/SetupContext.php @@ -1,5 +1,7 @@ $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"); } diff --git a/build/integration/features/bootstrap/SharingContext.php b/build/integration/features/bootstrap/SharingContext.php index c442317a32a..36c76bf8244 100644 --- a/build/integration/features/bootstrap/SharingContext.php +++ b/build/integration/features/bootstrap/SharingContext.php @@ -1,5 +1,7 @@ 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) { diff --git a/build/integration/features/bootstrap/autoload.php b/build/integration/features/bootstrap/autoload.php index a186262ebd3..ac1fb436d07 100644 --- a/build/integration/features/bootstrap/autoload.php +++ b/build/integration/features/bootstrap/autoload.php @@ -1,5 +1,7 @@