Skip to content

Commit 7daf3d5

Browse files
committed
Use Utils\is_path_absolute
1 parent 2ba6443 commit 7daf3d5

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/Context/ThenStepDefinitions.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Behat\Gherkin\Node\PyStringNode;
66
use Behat\Gherkin\Node\TableNode;
7+
use WP_CLI\Utils;
78
use Exception;
89
use Requests;
910
use RuntimeException;
@@ -455,10 +456,8 @@ public function then_stdout_stderr_should_be_a_specific_version_string( $stream,
455456
public function then_a_specific_file_folder_should_exist( $path, $type, $strictly, $action, $expected = null ): void {
456457
$path = $this->replace_variables( $path );
457458

458-
$is_absolute = preg_match( '#^[a-zA-Z]:\\\\#', $path ) || ( strlen( $path ) > 0 && ( '/' === $path[0] || '\\' === $path[0] ) );
459-
460459
// If it's a relative path, make it relative to the current test dir.
461-
if ( ! $is_absolute ) {
460+
if ( ! Utils\is_path_absolute( $path ) ) {
462461
$path = $this->variables['RUN_DIR'] . DIRECTORY_SEPARATOR . $path;
463462
}
464463

0 commit comments

Comments
 (0)