Skip to content

Commit

Permalink
fix portability issues
Browse files Browse the repository at this point in the history
  • Loading branch information
marac19901990 authored and sebastianbergmann committed Dec 31, 2023
1 parent 5eecbf3 commit 3adb22b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/TextUI/Configuration/Cli/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ public function fromParameters(array $parameters): Configuration
$realPath = realpath($path);

if (!$realPath) {
throw new Exception("Specified path: {$path} can't be resolved");
throw new Exception("The path {$path} specified for the --log-events-text option could not be resolved");
}
$logEventsText = $realPath;

Expand All @@ -819,7 +819,7 @@ public function fromParameters(array $parameters): Configuration
$realPath = realpath($path);

if (!$realPath) {
throw new Exception("Specified path: {$path} can't be resolved");
throw new Exception("The path {$path} specified for the --log-events-verbose-text option could not be resolved");
}
$logEventsVerboseText = $realPath;

Expand Down
8 changes: 4 additions & 4 deletions tests/end-to-end/cli/log-events-text-invalid-argument.phpt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
--TEST--
phpunit --no-output --log-events-text logfile.txt
Test fail with invalid path
--FILE--
<?php declare(strict_types=1);
$traceFile = 'dasdasdasdasd/dasdasdsa.log';
$traceFile = sys_get_temp_dir() . '/invalid-directory/invalid.file';

$_SERVER['argv'][] = '--do-not-cache-result';
$_SERVER['argv'][] = '--no-configuration';
Expand All @@ -19,6 +19,6 @@ print file_get_contents($traceFile);

unlink($traceFile);
--EXPECTF--
PHPUnit 10.5.3 by Sebastian Bergmann and contributors.
PHPUnit %s by Sebastian Bergmann and contributors.

Specified path: dasdasdasdasd/dasdasdsa.log can't be resolved
The path /tmp/invalid-directory/invalid.file specified for the --log-events-text option could not be resolved
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
--TEST--
phpunit --no-output --log-events-verbose-text logfile.txt
Test fail with invalid path
--FILE--
<?php declare(strict_types=1);
$traceFile = 'dasdasdasdasd/dasdasdsa.log';
$traceFile = sys_get_temp_dir() . '/invalid-directory/invalid.file';

$_SERVER['argv'][] = '--do-not-cache-result';
$_SERVER['argv'][] = '--no-configuration';
Expand All @@ -14,11 +14,7 @@ $_SERVER['argv'][] = __DIR__ . '/../_files/log-events-text';
require __DIR__ . '/../../bootstrap.php';

(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);

print file_get_contents($traceFile);

unlink($traceFile);
--EXPECTF--
PHPUnit 10.5.3 by Sebastian Bergmann and contributors.
PHPUnit %s by Sebastian Bergmann and contributors.

Specified path: dasdasdasdasd/dasdasdsa.log can't be resolved
The path /tmp/invalid-directory/invalid.file specified for the --log-events-verbose-text option could not be resolved

0 comments on commit 3adb22b

Please sign in to comment.