diff options
Diffstat (limited to 'build/integration/features/bootstrap/FederationContext.php')
-rw-r--r-- | build/integration/features/bootstrap/FederationContext.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/build/integration/features/bootstrap/FederationContext.php b/build/integration/features/bootstrap/FederationContext.php index a4472c54b1b..423708adc10 100644 --- a/build/integration/features/bootstrap/FederationContext.php +++ b/build/integration/features/bootstrap/FederationContext.php @@ -41,10 +41,30 @@ class FederationContext implements Context, SnippetAcceptingContext { use CommandLine; /** @var string */ + private static $phpFederatedServerPid = ''; + + /** @var string */ private $lastAcceptedRemoteShareId; /** * @BeforeScenario + * @AfterScenario + * + * The server is started also after the scenarios to ensure that it is + * properly cleaned up if stopped. + */ + public function startFederatedServer() { + if (self::$phpFederatedServerPid !== '') { + return; + } + + $port = getenv('PORT_FED'); + + self::$phpFederatedServerPid = exec('php -S localhost:' . $port . ' -t ../../ >/dev/null & echo $!'); + } + + /** + * @BeforeScenario */ public function cleanupRemoteStorages() { // Ensure that dangling remote storages from previous tests will not @@ -157,6 +177,19 @@ class FederationContext implements Context, SnippetAcceptingContext { $this->sendingToWith('DELETE', "/apps/files_sharing/api/v1/remote_shares/" . $this->lastAcceptedRemoteShareId, null); } + /** + * @When /^remote server is stopped$/ + */ + public function remoteServerIsStopped() { + if (self::$phpFederatedServerPid === '') { + return; + } + + exec('kill ' . self::$phpFederatedServerPid); + + self::$phpFederatedServerPid = ''; + } + protected function resetAppConfigs() { $this->deleteServerConfig('files_sharing', 'incoming_server2server_group_share_enabled'); $this->deleteServerConfig('files_sharing', 'outgoing_server2server_group_share_enabled'); |