Skip to content

Commit

Permalink
fix(CI): Clean up Context files
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen committed Aug 25, 2023
1 parent 8c77397 commit 5f71e34
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 111 deletions.
7 changes: 1 addition & 6 deletions tests/integration/config/behat.yml
Expand Up @@ -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:
Expand Down
95 changes: 42 additions & 53 deletions tests/integration/features/bootstrap/FeatureContext.php
Expand Up @@ -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<string, string> */
protected static array $identifierToToken;
/** @var array<string, int> */
protected static array $identifierToId;
/** @var array<string, string> */
protected static array $tokenToIdentifier;
/** @var array<string, string> */
protected static array $sessionIdToUser;
/** @var array<string, string> */
protected static array $userToSessionId;
/** @var array<string, int> */
protected static array $userToAttendeeId;
/** @var array<string, int> */
protected static array $textToMessageId;
/** @var array<int, string> */
protected static array $messageIdToText;
/** @var array<string, int> */
protected static array $remoteToInviteId;
/** @var array<int, string> */
protected static array $inviteIdToRemote;
/** @var array<string, int> */
protected static array $questionToPollId;
/** @var array[] */
protected static $lastNotifications;
protected static array $lastNotifications;
/** @var array<int, string> */
protected static $botIdToName;
protected static array $botIdToName;
/** @var array<string, int> */
protected static $botNameToId;
protected static array $botNameToId;
/** @var array<string, string> */
protected static $botNameToHash;
protected static array $botNameToHash;
/** @var array<string, mixed>|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
Expand All @@ -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;
Expand Down Expand Up @@ -152,7 +142,6 @@ public function __construct() {
$this->cookieJars = [];
$this->baseUrl = getenv('TEST_SERVER_URL');
$this->baseRemoteUrl = getenv('TEST_REMOTE_URL');
$this->guestsAppWasEnabled = null;
}

/**
Expand Down
39 changes: 1 addition & 38 deletions tests/integration/features/bootstrap/FederationContext.php
Expand Up @@ -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
Expand Down
20 changes: 6 additions & 14 deletions tests/integration/features/bootstrap/SharingContext.php
Expand Up @@ -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;
Expand Down

0 comments on commit 5f71e34

Please sign in to comment.