fix(Test): reset is_windows() mock state in CIUnitTestCase::tearDown() - #10554
Merged
paulbalandan merged 1 commit intoSep 18, 2026
Merged
Conversation
michalsn
reviewed
Sep 13, 2026
michalsn
left a comment
Member
There was a problem hiding this comment.
Please add a dedicated regression test verifying that CIUnitTestCase::tearDown() resets the is_windows() mock. The updated CommonFunctionsTest resets it explicitly, so it doesn't cover automatic cleanup.
gr8man
force-pushed
the
fix/is-windows-test-pollution
branch
from
September 13, 2026 20:04
0b294b5 to
8610c9c
Compare
Member
|
Looks good. Could you please rebase to fix the PHPStan failure? |
gr8man
force-pushed
the
fix/is-windows-test-pollution
branch
from
September 14, 2026 19:11
8610c9c to
5f10252
Compare
michalsn
approved these changes
Sep 17, 2026
paulbalandan
approved these changes
Sep 18, 2026
is_windows() mock state in CIUnitTestCase::tearDown()
is_windows() mock state in CIUnitTestCase::tearDown()is_windows() mock state in CIUnitTestCase::tearDown()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When mocking the operating system via
is_windows(true)oris_windows(false), the internal static variable$mockedretains the set boolean value untilis_windows(null)is explicitly invoked with an argument (func_num_args() === 1).In
CommonFunctionsTest::testIsWindowsUsingMock(), line 866 previously calledis_windows();with zero arguments. Because zero arguments were passed,$mockedwas not reset and remainedfalse. This resulted in test pollution for any subsequent tests executed in the same PHPUnit process that relied on auto-detection of the OS platform (DIRECTORY_SEPARATOR === '\\').This PR addresses the issue by:
CommonFunctionsTest::testIsWindowsUsingMock()to callis_windows(null)so that it explicitly tests resetting the mock.resetIsWindowsMock()toCIUnitTestCase::$tearDownMethodsto automatically resetis_windows(null)after each test run, preventing static state leaks across the test suite.Checklist: