@@ -170,12 +170,12 @@ private function createFactory(AssetCompilerInterface $extraCompiler = null): Ma
170
170
$ this ->assetMapper ->expects ($ this ->any ())
171
171
->method ('getAssetFromSourcePath ' )
172
172
->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 );
179
179
} else {
180
180
throw new \RuntimeException (sprintf ('Could not find asset "%s". ' , $ sourcePath ));
181
181
}
0 commit comments