From 99afdd5c5eda09c2ba298ceacd3d6b19bf81f754 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 25 Aug 2023 21:57:38 +0200 Subject: [PATCH] fix(CI): Clean up Context files Signed-off-by: Joas Schilling --- tests/integration/config/behat.yml | 7 +- .../features/bootstrap/FeatureContext.php | 95 ++++++++----------- .../features/bootstrap/FederationContext.php | 39 +------- .../features/bootstrap/SharingContext.php | 20 ++-- 4 files changed, 50 insertions(+), 111 deletions(-) diff --git a/tests/integration/config/behat.yml b/tests/integration/config/behat.yml index 25ae8de49ec..f82ca24f373 100644 --- a/tests/integration/config/behat.yml +++ b/tests/integration/config/behat.yml @@ -7,12 +7,7 @@ default: - '%paths.base%/../features' contexts: - FeatureContext - - FederationContext: - baseUrl: http://localhost:8080/ - admin: - - admin - - admin - regularUserPassword: 123456 + - FederationContext - SharingContext: baseUrl: http://localhost:8080/ admin: diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php index 76dc4e3fdd7..21fb9eddafd 100644 --- a/tests/integration/features/bootstrap/FeatureContext.php +++ b/tests/integration/features/bootstrap/FeatureContext.php @@ -37,44 +37,41 @@ class FeatureContext implements Context, SnippetAcceptingContext { public const TEST_PASSWORD = '123456'; - /** @var string[] */ - protected static $identifierToToken; - /** @var string[] */ - protected static $identifierToId; - /** @var string[] */ - protected static $tokenToIdentifier; - /** @var array[] */ - protected static $identifierToAvatar; - /** @var string[] */ - protected static $sessionIdToUser; - /** @var string[] */ - protected static $userToSessionId; - /** @var int[] */ - protected static $userToAttendeeId; - /** @var string[] */ - protected static $messages; - protected static $textToMessageId; - /** @var array[] */ - protected static $messageIdToText; - /** @var int[] */ - protected static $remoteToInviteId; - /** @var string[] */ - protected static $inviteIdToRemote; - /** @var int[] */ - protected static $questionToPollId; + /** @var array */ + protected static array $identifierToToken; + /** @var array */ + protected static array $identifierToId; + /** @var array */ + protected static array $tokenToIdentifier; + /** @var array */ + protected static array $sessionIdToUser; + /** @var array */ + protected static array $userToSessionId; + /** @var array */ + protected static array $userToAttendeeId; + /** @var array */ + protected static array $textToMessageId; + /** @var array */ + protected static array $messageIdToText; + /** @var array */ + protected static array $remoteToInviteId; + /** @var array */ + protected static array $inviteIdToRemote; + /** @var array */ + protected static array $questionToPollId; /** @var array[] */ - protected static $lastNotifications; + protected static array $lastNotifications; /** @var array */ - protected static $botIdToName; + protected static array $botIdToName; /** @var array */ - protected static $botNameToId; + protected static array $botNameToId; /** @var array */ - protected static $botNameToHash; + protected static array $botNameToHash; /** @var array|null */ protected static ?array $nextChatRequestParameters = null; - protected static $permissionsMap = [ + protected static array $permissionsMap = [ 'D' => 0, // PERMISSIONS_DEFAULT 'C' => 1, // PERMISSIONS_CUSTOM 'S' => 2, // PERMISSIONS_CALL_START @@ -86,41 +83,34 @@ class FeatureContext implements Context, SnippetAcceptingContext { 'M' => 128, // PERMISSIONS_CHAT ]; - /** @var string */ - protected $currentUser; + protected ?string $currentUser = ''; - /** @var ResponseInterface */ - private $response; + private ?ResponseInterface $response; /** @var CookieJar[] */ - private $cookieJars; + private array $cookieJars; - /** @var string */ - protected $baseUrl; + protected string $baseUrl; - /** @var string */ - protected $baseRemoteUrl; + protected string $baseRemoteUrl; - /** @var array */ - protected $createdUsers = []; + /** @var string[] */ + protected array $createdUsers = []; - /** @var array */ - protected $createdGroups = []; + /** @var string[] */ + protected array $createdGroups = []; - /** @var array */ - protected $createdGuestAccountUsers = []; + /** @var string[] */ + protected array $createdGuestAccountUsers = []; /** @var array */ - protected $changedConfigs = []; + protected array $changedConfigs = []; - /** @var SharingContext */ - private $sharingContext; + private ?SharingContext $sharingContext; - /** @var null|bool */ - private $guestsAppWasEnabled = null; + private ?bool $guestsAppWasEnabled = null; - /** @var string */ - private $guestsOldWhitelist; + private string $guestsOldWhitelist; use CommandLineTrait; use RecordingTrait; @@ -152,7 +142,6 @@ public function __construct() { $this->cookieJars = []; $this->baseUrl = getenv('TEST_SERVER_URL'); $this->baseRemoteUrl = getenv('TEST_REMOTE_URL'); - $this->guestsAppWasEnabled = null; } /** diff --git a/tests/integration/features/bootstrap/FederationContext.php b/tests/integration/features/bootstrap/FederationContext.php index 95c0b0aeaaf..880c61e030f 100644 --- a/tests/integration/features/bootstrap/FederationContext.php +++ b/tests/integration/features/bootstrap/FederationContext.php @@ -35,44 +35,7 @@ * Federation context. */ class FederationContext implements Context, SnippetAcceptingContext { - /** @var string */ - private $baseUrl = ''; - /** @var string */ - private $baseRemoteUrl = ''; - - /** @var ResponseInterface */ - private $response = null; - - /** @var string */ - private $currentUser = ''; - - /** @var string */ - private $regularUserPassword; - - /** @var \SimpleXMLElement */ - private $lastCreatedShareData = null; - - public function __construct(string $baseUrl, array $admin, string $regularUserPassword) { - $this->baseUrl = $baseUrl; - $this->adminUser = $admin; - $this->regularUserPassword = $regularUserPassword; - - // in case of ci deployment we take the server url from the environment - $testServerUrl = getenv('TEST_SERVER_URL'); - if ($testServerUrl !== false) { - $this->baseUrl = $testServerUrl; - } - $testServerUrl = getenv('TEST_REMOTE_URL'); - if ($testServerUrl !== false) { - $this->baseRemoteUrl = $testServerUrl; - } - } - - /** @var string */ - private static $phpFederatedServerPid = ''; - - /** @var string */ - private $lastAcceptedRemoteShareId; + private static string $phpFederatedServerPid = ''; /** * @BeforeScenario diff --git a/tests/integration/features/bootstrap/SharingContext.php b/tests/integration/features/bootstrap/SharingContext.php index a45c86dbd05..151c25b6296 100644 --- a/tests/integration/features/bootstrap/SharingContext.php +++ b/tests/integration/features/bootstrap/SharingContext.php @@ -28,20 +28,12 @@ use Psr\Http\Message\ResponseInterface; class SharingContext implements Context { - /** @var string */ - private $baseUrl = ''; - - /** @var ResponseInterface */ - private $response = null; - - /** @var string */ - private $currentUser = ''; - - /** @var string */ - private $regularUserPassword; - - /** @var \SimpleXMLElement */ - private $lastCreatedShareData = null; + private string $baseUrl; + private ?ResponseInterface $response = null; + private string $currentUser = ''; + private array $adminUser; + private string $regularUserPassword; + private ?\SimpleXMLElement $lastCreatedShareData = null; public function __construct(string $baseUrl, array $admin, string $regularUserPassword) { $this->baseUrl = $baseUrl;