From d58e55ad63113404f53644aacea06e237aa3e098 Mon Sep 17 00:00:00 2001 From: Anna Larch Date: Wed, 27 May 2026 16:06:54 +0200 Subject: [PATCH] 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 AI-Assisted-By: Claude Sonnet 4.6 --- .../features/bootstrap/BasicStructure.php | 12 ++++++++++++ build/integration/features/bootstrap/Sharing.php | 9 +++++++++ 2 files changed, 21 insertions(+) diff --git a/build/integration/features/bootstrap/BasicStructure.php b/build/integration/features/bootstrap/BasicStructure.php index 8d1d3b38793..171de3dc476 100644 --- a/build/integration/features/bootstrap/BasicStructure.php +++ b/build/integration/features/bootstrap/BasicStructure.php @@ -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+)"$/ */ diff --git a/build/integration/features/bootstrap/Sharing.php b/build/integration/features/bootstrap/Sharing.php index 98ecce66832..4d5b78dd05e 100644 --- a/build/integration/features/bootstrap/Sharing.php +++ b/build/integration/features/bootstrap/Sharing.php @@ -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;