From 617304ce74d66d92e8e6575c2e5884195220739a Mon Sep 17 00:00:00 2001 From: Josh Date: Sun, 2 Aug 2026 08:30:36 -0400 Subject: [PATCH] test(Setup): prevent testFindWebRootCli() from leaking global state testFindWebRootCli() can leak it's temporarily overridden `\OC::$CLI` if an unexpected exception occurs. Also expected/actual arguments on the assert are reversed. Signed-off-by: Josh --- tests/lib/SetupTest.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/lib/SetupTest.php b/tests/lib/SetupTest.php index 3def0ff69e1b3..9fc49b5b361ac 100644 --- a/tests/lib/SetupTest.php +++ b/tests/lib/SetupTest.php @@ -149,10 +149,11 @@ public function testFindWebRootCli($url, $expected): void { $webRoot = self::invokePrivate($this->setupClass, 'findWebRoot', [$this->config]); } catch (\InvalidArgumentException $e) { $webRoot = false; + } finally { + \OC::$CLI = $cliState; } - \OC::$CLI = $cliState; - $this->assertSame($webRoot, $expected); + $this->assertSame($expected, $webRoot); } public static function findWebRootProvider(): array {