Skip to content

Commit 3adb22b

Browse files
marac19901990sebastianbergmann
authored andcommitted
fix portability issues
1 parent 5eecbf3 commit 3adb22b

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed

src/TextUI/Configuration/Cli/Builder.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ public function fromParameters(array $parameters): Configuration
808808
$realPath = realpath($path);
809809

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

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

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

tests/end-to-end/cli/log-events-text-invalid-argument.phpt

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
--TEST--
2-
phpunit --no-output --log-events-text logfile.txt
2+
Test fail with invalid path
33
--FILE--
44
<?php declare(strict_types=1);
5-
$traceFile = 'dasdasdasdasd/dasdasdsa.log';
5+
$traceFile = sys_get_temp_dir() . '/invalid-directory/invalid.file';
66

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

2020
unlink($traceFile);
2121
--EXPECTF--
22-
PHPUnit 10.5.3 by Sebastian Bergmann and contributors.
22+
PHPUnit %s by Sebastian Bergmann and contributors.
2323

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

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

1616
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
17-
18-
print file_get_contents($traceFile);
19-
20-
unlink($traceFile);
2117
--EXPECTF--
22-
PHPUnit 10.5.3 by Sebastian Bergmann and contributors.
18+
PHPUnit %s by Sebastian Bergmann and contributors.
2319

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

0 commit comments

Comments
 (0)