Skip to content

Commit 271d7f6

Browse files
committed
test(envlite): normalize tmpdir via realpath for macOS portability
On macOS sys_get_temp_dir() returns /var/folders/... while __DIR__ in the fixture index.php resolves symlinks to /private/var/folders/..., breaking the FIXTURE_OK marker comparison. realpath() the tmpdir so both sides of the assert agree on a single canonical form; no-op on Linux where /tmp is typically not a symlink.
1 parent 07f3550 commit 271d7f6

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

tools/local-env/tests/test_router.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ function envlite_test_router_wait_for_bind(int $port, float $timeout_seconds = 3
2525

2626
function test_router_serves_from_document_root_not_router_directory() {
2727
// Build a fixture "site" that does NOT share a parent with router.php.
28-
$site = envlite_test_tmpdir('router-docroot');
28+
// realpath() normalizes /tmp -> /private/tmp on macOS so the assert
29+
// below matches __DIR__ from the fixture's index.php (which resolves
30+
// symlinks). On Linux this is a no-op.
31+
$site = realpath(envlite_test_tmpdir('router-docroot'));
32+
envlite_assert($site !== false, 'tmp fixture directory must resolve via realpath');
2933
file_put_contents("$site/index.php", "<?php echo 'FIXTURE_OK ' . __DIR__;");
3034

3135
// Use the real shipped router so we exercise its path resolution.

0 commit comments

Comments
 (0)