Repository navigation
fix windows test failures: path separators and arch normalization - #1148
Merged
crazywhalecc merged 2 commits intoMay 21, 2026
Merged
Conversation
luthermonson
force-pushed
the
v3-fix-windows-test-paths
branch
from
May 20, 2026 04:59
2a106b8 to
52d234f
Compare
crazywhalecc
approved these changes
May 21, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes Windows-only PHPUnit failures in the artifact/cache path and platform-detection logic by normalizing architecture strings and ensuring generated filesystem paths use the correct platform separator.
Changes:
- Update
ArtifactTestplatform helper to use the project’sarch2gnu()normalization (fixesAMD64vsx86_64mismatches on Windows). - Normalize generated download/cache paths via
FileSystem::convertPath()to avoid mixed\.../fileseparators on Windows. - Adjust one test to use a truly-absolute path on Windows (drive-letter path) to match
isRelativePath()behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/StaticPHP/Artifact/ArtifactTest.php | Makes tests platform-aware for absolute paths on Windows and normalizes arch detection via arch2gnu(). |
| src/StaticPHP/Artifact/ArtifactCache.php | Ensures cache full paths are normalized via FileSystem::convertPath() for archive/file/git cache types. |
| src/StaticPHP/Artifact/Artifact.php | Normalizes getSourceRoot() path concatenation via FileSystem::convertPath() to avoid mixed separators. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
What does this PR do?
Running phpunit on Windows surfaces 12 problems (3 errors + 9 failures) that all pass on Linux CI. Reproducer:
runtime\php.exe vendor\phpunit\phpunit\phpunit tests\ --no-coverageBefore the changes:
Tests: 399, Assertions: 601, Errors: 3, Failures: 9, Warnings: 7, Deprecations: 4.Three buckets of failures, all in
tests/StaticPHP/Artifact/:Invalid platform architecture 'AMD64'errorsphp_uname('m')returns uppercaseAMD64on Windows, and the test helpergetCurrentPlatform()only normalized macOS'sarm64. Affected:testHasPlatformBinaryReturnsTrueWithCustomCallback,testSetAndGetCustomBinaryCallback,testSetAndGetCustomBinaryCheckUpdateCallback, plus fourdownstream test failures that depend on the same helper (
testHasPlatformBinaryReturnsTrueWhenConfigHasBinaryForCurrentPlatform,testSetAndGetBinaryExtractCallbackForCurrentPlatform,testGetBinaryExtractCallbackReturnsNullForNonMatchingPlatform,testShouldUseBinaryReturnsTrueWhenDownloadedAndHasBinaryConfig).ArtifactCache::getCacheFullPath()produced\...\downloads/file.extinstead of\...\downloads\file.ext. Same shape inArtifact::getSourceRoot(). Affected:testGetCacheFullPathForArchiveType,testGetCacheFullPathForGitType,testGetCacheFullPathForFileType,testGetSourceRootUsesMetadataSourceRoot.testGetSourceDirWithAbsoluteExtractInConfig— used a Unix-style/tmp/...as "absolute," but on Windows that has no drive letter soisRelativePath()returns true and the test landed in the wrong code branch.After these changes we wrap path concatenations in the existing
FileSystem::convertPath(), and the test helper uses the existingarch2gnu()(which already lowercases input and mapsamd64/x64/x86_64->x86_64) instead of the hand-rolled partial fixup. Linux/macOS behavior is unchanged because the separator wraps are no-ops where slashes already match, the test's arch helper is now using what the rest of the codebase already uses everywhere, and the absolute-path test now picks a Windows-realistic absolute path on Windows only.After the changes:
Tests: 399, Assertions: 604, Failures: 0, Warnings: 7, Deprecations: 4.