@@ -263,10 +263,14 @@ function testIgnoredFileFunc(int $id): int
263263 test ('file_get_contents() returns raw source code without AST transformation ' , function () {
264264 StreamWrapper::register ();
265265
266- $ tempDir = sys_get_temp_dir () . '/typephp_raw_read_ ' . uniqid ();
266+ $ sysTemp = realpath (sys_get_temp_dir ());
267+ $ baseTemp = str_replace ('\\' , '/ ' , $ sysTemp !== false ? $ sysTemp : sys_get_temp_dir ());
268+ $ tempDir = $ baseTemp . '/typephp_raw_read_ ' . uniqid ();
267269 mkdir ($ tempDir , 0777 , true );
268270
269- $ testFile = $ tempDir . '/SampleService.php ' ;
271+ $ canonicalDir = str_replace ('\\' , '/ ' , realpath ($ tempDir ) ?: $ tempDir );
272+ $ testFile = $ canonicalDir . '/SampleService.php ' ;
273+
270274 $ rawSource = <<<'PHP'
271275<?php
272276
@@ -288,7 +292,10 @@ function sampleAction(int $id): string
288292 try {
289293 Config::set ([
290294 'include ' => [
291- str_replace ('\\' , '/ ' , $ tempDir ) . '/** ' ,
295+ $ canonicalDir . '/** ' ,
296+ ],
297+ 'exclude ' => [
298+ 'vendor/** ' ,
292299 ],
293300 ]);
294301
@@ -310,7 +317,7 @@ function sampleAction(int $id): string
310317
311318 expect (\App \Test \sampleAction (42 ))->toBe ('id_42 ' );
312319
313- expect (fn () => \App \Test \sampleAction (-5 ))
320+ expect (fn () => \App \Test \sampleAction (-5 ))
314321 ->toThrow (TypeError::class, 'positive-int ' );
315322 } finally {
316323 if (file_exists ($ testFile )) {
@@ -325,7 +332,9 @@ function sampleAction(int $id): string
325332 test ('file_put_contents() writes data directly without stream interception ' , function () {
326333 StreamWrapper::register ();
327334
328- $ tempDir = sys_get_temp_dir () . '/typephp_raw_write_ ' . uniqid ();
335+ $ sysTemp = realpath (sys_get_temp_dir ());
336+ $ baseTemp = str_replace ('\\' , '/ ' , $ sysTemp !== false ? $ sysTemp : sys_get_temp_dir ());
337+ $ tempDir = $ baseTemp . '/typephp_raw_write_ ' . uniqid ();
329338 mkdir ($ tempDir , 0777 , true );
330339
331340 $ testFile = $ tempDir . '/data_write.txt ' ;
@@ -366,4 +375,4 @@ function sampleAction(int $id): string
366375 expect ($ transformedContent )->toContain ('RuntimeTypeChecker::setupScope ' );
367376 });
368377 });
369- });
378+ });
0 commit comments