8000 Playing with windows tests · symfony/symfony@f7f3574 · GitHub
[go: up one dir, main page]

Skip to content

Commit f7f3574

Browse files
committed
Playing with windows tests
1 parent 56a41ce commit f7f3574

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/Symfony/Component/AssetMapper/Tests/Compiler/JavaScriptImportPathCompilerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,9 @@ public function testCompileFindsRelativePathsWithWindowsPathsViaSourcePath()
328328
->method('getAssetFromSourcePath')
329329
->willReturnCallback(function ($path) {
330330
return match ($path) {
331-
'C:\\\\project\\assets\\other.js' => new MappedAsset('other.js', publicPathWithoutDigest: '/assets/other.js'),
332-
'C:\\\\project\\assets\\subdir/foo.js' => new MappedAsset('subdir/foo.js', publicPathWithoutDigest: '/assets/subdir/foo.js'),
333-
'C:\\\\project\\root_asset.js' => new MappedAsset('root_asset.js', publicPathWithoutDigest: '/assets/root_asset.js'),
331+
'C://project/assets/other.js' => new MappedAsset('other.js', publicPathWithoutDigest: '/assets/other.js'),
332+
'C://project/assets/subdir/foo.js' => new MappedAsset('subdir/foo.js', publicPathWithoutDigest: '/assets/subdir/foo.js'),
333+
'C://project/root_asset.js' => new MappedAsset('root_asset.js', publicPathWithoutDigest: '/assets/root_asset.js'),
334334
default => throw new \RuntimeException(sprintf('Unexpected source path "%s"', $path)),
335335
};
336336
});

src/Symfony/Component/AssetMapper/Tests/Factory/MappedAssetFactoryTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,12 @@ private function createFactory(AssetCompilerInterface $extraCompiler = null): Ma
170170
$this->assetMapper->expects($this->any())
171171
->method('getAssetFromSourcePath')
172172
->willReturnCallback(function (string $sourcePath) use ($factory) {
173-
if (str_starts_with($sourcePath, $rootDir = realpath(__DIR__.'/../Fixtures/dir1'))) {
174-
$logicalPath = substr($sourcePath, \strlen($rootDir) + 1);
175-
} elseif (str_starts_with($sourcePath, $rootDir = realpath(__DIR__.'/../Fixtures/dir2'))) {
176-
$logicalPath = substr($sourcePath, \strlen($rootDir) + 1);
177-
} elseif (str_starts_with($sourcePath, $rootDir = realpath(__DIR__.'/../Fixtures/circular_dir'))) {
178-
$logicalPath = substr($sourcePath, \strlen($rootDir) + 1);
173+
if (str_contains($sourcePath, 'dir1')) {
174+
$logicalPath = substr($sourcePath, strpos($sourcePath, 'dir1') + 5);
175+
} elseif (str_contains($sourcePath, 'dir2')) {
176+
$logicalPath = substr($sourcePath, strpos($sourcePath, 'dir2') + 5);
177+
} elseif (str_contains($sourcePath, 'circular_dir')) {
178+
$logicalPath = substr($sourcePath, strpos($sourcePath, 'circular_dir') + 13);
179179
} else {
180180
throw new \RuntimeException(sprintf('Could not find asset "%s".', $sourcePath));
181181
}

0 commit comments

Comments
 (0)
0