Browse Source

Merge pull request #15169 from nextcloud/backport/15166/stable31

[stable31] chore: Remove non-used FederationContext.php from tests
pull/15171/head
Marcel Müller 5 months ago
committed by GitHub
parent
commit
7b808e7aec
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      tests/integration/config/behat.yml
  2. 50
      tests/integration/features/bootstrap/FederationContext.php

1
tests/integration/config/behat.yml

@ -16,7 +16,6 @@ default:
- '%paths.base%/../features'
contexts:
- FeatureContext
- FederationContext
- SharingContext:
baseUrl: http://localhost:8080/
admin:

50
tests/integration/features/bootstrap/FederationContext.php

@ -1,50 +0,0 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
use Behat\Behat\Context\Context;
use Behat\Behat\Context\SnippetAcceptingContext;
use Behat\Hook\AfterScenario;
use Behat\Hook\BeforeScenario;
require __DIR__ . '/../../vendor/autoload.php';
/**
* Federation context.
*/
class FederationContext implements Context, SnippetAcceptingContext {
private static string $phpFederatedServerPid = '';
/**
* The server is started also after the scenarios to ensure that it is
* properly cleaned up if stopped.
*/
#[BeforeScenario]
#[AfterScenario]
public function startFederatedServer(): void {
if (self::$phpFederatedServerPid !== '') {
return;
}
$port = getenv('PORT_FED');
$rootDir = getenv('NEXTCLOUD_HOST_ROOT_DIR');
self::$phpFederatedServerPid = exec('php -S localhost:' . $port . ' -t ' . $rootDir . ' >/dev/null & echo $!');
}
#[When('/^remote server is stopped$/')]
public function remoteServerIsStopped(): void {
if (self::$phpFederatedServerPid === '') {
return;
}
exec('kill ' . self::$phpFederatedServerPid);
self::$phpFederatedServerPid = '';
}
}
Loading…
Cancel
Save