Skip to content

Commit 15141ea

Browse files
committed
Normalize temp dir in Given a directory step
1 parent 2cde4e3 commit 15141ea

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/Context/GivenStepDefinitions.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,13 @@ public function given_a_specific_directory( $empty_or_nonexistent, $dir ): void
5353
// Mac OS X can prefix the `/var` folder to turn it into `/private/var`.
5454
$dir = preg_replace( '|^/private/var/|', '/var/', $dir );
5555

56-
$temp_dir = Path::normalize( sys_get_temp_dir() );
56+
$temp_dir = realpath( sys_get_temp_dir() );
57+
$temp_dir = $temp_dir ? Path::normalize( $temp_dir ) : Path::normalize( sys_get_temp_dir() );
5758
$dir = Path::normalize( $dir );
5859

60+
// Also normalize temp dir for Mac OS X.
61+
$temp_dir = preg_replace( '|^/private/var/|', '/var/', $temp_dir );
62+
5963
// Also check for temp dir prefixed with `/private` for Mac OS X.
6064
if ( 0 !== strpos( $dir, $temp_dir ) && 0 !== strpos( $dir, "/private{$temp_dir}" ) ) {
6165
throw new RuntimeException(

0 commit comments

Comments
 (0)