mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
test(behat): reset per-scenario state in BasicStructure and Sharing
Add @BeforeScenario hooks to reset auth/server state and sharing state between scenarios, preventing state bleed across test runs. - BasicStructure: reset currentUser, currentServer, baseUrl, apiVersion, requestToken and cookieJar (baseUrl and currentServer go together via usingServer(), so both must be reset) - Sharing: reset lastShareData, storedShareData and savedShareId Signed-off-by: Anna Larch <anna@nextcloud.com> AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
5ffde0370b
commit
d58e55ad63
2 changed files with 21 additions and 0 deletions
|
|
@ -72,6 +72,18 @@ trait BasicStructure {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @BeforeScenario
|
||||
*/
|
||||
public function resetAuthState(): void {
|
||||
$this->currentUser = '';
|
||||
$this->currentServer = 'LOCAL';
|
||||
$this->baseUrl = $this->localBaseUrl;
|
||||
$this->apiVersion = 1;
|
||||
$this->requestToken = null;
|
||||
$this->cookieJar = new CookieJar();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^using api version "(\d+)"$/
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -23,6 +23,15 @@ trait Sharing {
|
|||
/** @var SimpleXMLElement[] */
|
||||
private array $storedShareData = [];
|
||||
private ?string $savedShareId = null;
|
||||
|
||||
/**
|
||||
* @BeforeScenario
|
||||
*/
|
||||
public function resetSharingState(): void {
|
||||
$this->lastShareData = null;
|
||||
$this->storedShareData = [];
|
||||
$this->savedShareId = null;
|
||||
}
|
||||
/** @var ResponseInterface */
|
||||
private $response;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue