File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 77use function getenv ;
88use function rtrim ;
99
10+ use const DIRECTORY_SEPARATOR ;
11+
1012final class CacheDirectoryProvider
1113{
1214 public static function getCacheLocation (): string
1315 {
14- $ env = getenv ('LARAVEL_PLUGIN_CACHE_PATH ' );
16+ $ env = getenv ('PSALM_LARAVEL_PLUGIN_CACHE_PATH ' );
1517 if ($ env !== false && $ env !== '' ) {
16- return rtrim ($ env , ' / ' );
18+ return rtrim ($ env , DIRECTORY_SEPARATOR );
1719 }
1820
19- return __DIR__ . ' /../../ cache ' ;
21+ return __DIR__ . DIRECTORY_SEPARATOR . ' .. ' . DIRECTORY_SEPARATOR . ' .. ' . DIRECTORY_SEPARATOR . ' cache ' ;
2022 }
2123}
Original file line number Diff line number Diff line change 1010use function putenv ;
1111use function sys_get_temp_dir ;
1212
13+ use const DIRECTORY_SEPARATOR ;
14+
1315final class CacheDirectoryProviderTest extends TestCase
1416{
1517 protected function tearDown (): void
1618 {
17- putenv ('LARAVEL_PLUGIN_CACHE_PATH ' );
19+ putenv ('PSALM_LARAVEL_PLUGIN_CACHE_PATH ' );
1820 }
1921
2022 public function testReturnsDefaultPathIfEnvNotSet (): void
2123 {
2224 $ path = CacheDirectoryProvider::getCacheLocation ();
2325
24- $ this ->assertStringEndsWith (' / cache ' , $ path );
26+ $ this ->assertStringEndsWith (DIRECTORY_SEPARATOR . ' cache ' , $ path );
2527 $ this ->assertFileExists ($ path );
2628 }
2729
2830 public function testReturnsCustomPathFromEnv (): void
2931 {
3032 $ custom = sys_get_temp_dir () . '/psalm-laravel-stubs-test ' ;
31- putenv ("LARAVEL_PLUGIN_CACHE_PATH = {$ custom }" );
33+ putenv ("PSALM_LARAVEL_PLUGIN_CACHE_PATH = {$ custom }" );
3234
3335 $ this ->assertSame ($ custom , CacheDirectoryProvider::getCacheLocation ());
3436 }
You can’t perform that action at this time.
0 commit comments