Skip to content

Commit

Permalink
fixing windows tests
Browse files Browse the repository at this point in the history
  • Loading branch information
weaverryan committed Oct 30, 2023
1 parent 36e5aec commit 489c790
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Expand Up @@ -174,7 +174,8 @@ public function convertFilesystemPathToPath(string $filesystemPath): ?string
return null;
}

return './'.substr($filesystemPath, \strlen($rootImportMapDir) + 1);
// remove the root directory, prepend "./" & normalize slashes
return './'.str_replace('\\', '/', substr($filesystemPath, \strlen($rootImportMapDir) + 1));
}

private function getRootDirectory(): string
Expand Down
Expand Up @@ -115,6 +115,8 @@ public function testGetEntriesAndWriteEntries()
public function testConvertPathToFilesystemPath(string $path, string $expectedPath)
{
$configReader = new ImportMapConfigReader(realpath(__DIR__.'/../Fixtures/importmap.php'), $this->createMock(RemotePackageStorage::class));
// normalize path separators for comparison
$expectedPath = str_replace('\\', '/', $expectedPath);
$this->assertSame($expectedPath, $configReader->convertPathToFilesystemPath($path));
}

Expand Down

0 comments on commit 489c790

Please sign in to comment.