@@ -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