-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
02c1d45
commit 93b9806
Showing
6 changed files
with
118 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
tests/end-to-end/cli/log-events-text-invalid-argument.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--TEST-- | ||
Test fails with invalid path | ||
--FILE-- | ||
<?php declare(strict_types=1); | ||
$traceFile = sys_get_temp_dir() . '/invalid-directory/invalid.file'; | ||
|
||
$_SERVER['argv'][] = '--do-not-cache-result'; | ||
$_SERVER['argv'][] = '--no-configuration'; | ||
$_SERVER['argv'][] = '--no-output'; | ||
$_SERVER['argv'][] = '--log-events-text'; | ||
$_SERVER['argv'][] = $traceFile; | ||
|
||
require __DIR__ . '/../../bootstrap.php'; | ||
|
||
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']); | ||
--EXPECTF-- | ||
PHPUnit %s by Sebastian Bergmann and contributors. | ||
|
||
The path "%s" specified for the --log-events-text option could not be resolved |
19 changes: 19 additions & 0 deletions
19
tests/end-to-end/cli/log-events-verbose-text-invalid-argument.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--TEST-- | ||
Test fails with invalid path | ||
--FILE-- | ||
<?php declare(strict_types=1); | ||
$traceFile = sys_get_temp_dir() . '/invalid-directory/invalid.file'; | ||
|
||
$_SERVER['argv'][] = '--do-not-cache-result'; | ||
$_SERVER['argv'][] = '--no-configuration'; | ||
$_SERVER['argv'][] = '--no-output'; | ||
$_SERVER['argv'][] = '--log-events-verbose-text'; | ||
$_SERVER['argv'][] = $traceFile; | ||
|
||
require __DIR__ . '/../../bootstrap.php'; | ||
|
||
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']); | ||
--EXPECTF-- | ||
PHPUnit %s by Sebastian Bergmann and contributors. | ||
|
||
The path "%s" specified for the --log-events-verbose-text option could not be resolved |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php declare(strict_types=1); | ||
/* | ||
* This file is part of PHPUnit. | ||
* | ||
* (c) Sebastian Bergmann <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
namespace PHPUnit\Util; | ||
|
||
use PHPUnit\Framework\Attributes\CoversClass; | ||
use PHPUnit\Framework\Attributes\Small; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
#[CoversClass(Filesystem::class)] | ||
#[Small] | ||
final class FilesystemTest extends TestCase | ||
{ | ||
public function testCanResolveStreamOrFile(): void | ||
{ | ||
$this->assertSame('php://stdout', Filesystem::resolveStreamOrFile('php://stdout')); | ||
$this->assertSame('socket://hostname:port', Filesystem::resolveStreamOrFile('socket://hostname:port')); | ||
$this->assertSame(__FILE__, Filesystem::resolveStreamOrFile(__FILE__)); | ||
$this->assertSame(__DIR__ . '/does-not-exist', Filesystem::resolveStreamOrFile(__DIR__ . '/does-not-exist')); | ||
$this->assertFalse(Filesystem::resolveStreamOrFile(__DIR__ . '/does-not-exist/does-not-exist')); | ||
} | ||
} |