Skip to content

Commit 0e3551b

Browse files
committed
DIRECTORY_SEPARATOR all the things
1 parent 30d5882 commit 0e3551b

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

src/Context/FeatureContext.php

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ private static function get_behat_internal_variables(): array {
568568
*/
569569
private static function download_sqlite_plugin( $dir ): void {
570570
$download_url = 'https://downloads.wordpress.org/plugin/sqlite-database-integration.zip';
571-
$download_location = $dir . '/sqlite-database-integration.zip';
571+
$download_location = $dir . DIRECTORY_SEPARATOR . 'sqlite-database-integration.zip';
572572

573573
if ( ! is_dir( $dir ) ) {
574574
mkdir( $dir );
@@ -636,16 +636,16 @@ private static function configure_sqlite( $dir ): void {
636636
private static function cache_wp_files(): void {
637637
$wp_version = getenv( 'WP_VERSION' );
638638
$wp_version_suffix = ( false !== $wp_version ) ? "-$wp_version" : '';
639-
self::$cache_dir = sys_get_temp_dir() . '/wp-cli-test-core-download-cache' . $wp_version_suffix;
640-
self::$sqlite_cache_dir = sys_get_temp_dir() . '/wp-cli-test-sqlite-integration-cache';
639+
self::$cache_dir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'wp-cli-test-core-download-cache' . $wp_version_suffix;
640+
self::$sqlite_cache_dir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'wp-cli-test-sqlite-integration-cache';
641641

642642
if ( 'sqlite' === getenv( 'WP_CLI_TEST_DBTYPE' ) ) {
643-
if ( ! is_readable( self::$sqlite_cache_dir . '/sqlite-database-integration/db.copy' ) ) {
643+
if ( ! is_readable( self::$sqlite_cache_dir . DIRECTORY_SEPARATOR . 'sqlite-database-integration/db.copy' ) ) {
644644
self::download_sqlite_plugin( self::$sqlite_cache_dir );
645645
}
646646
}
647647

648-
if ( is_readable( self::$cache_dir . '/wp-config-sample.php' ) ) {
648+
if ( is_readable( self::$cache_dir . DIRECTORY_SEPARATOR . 'wp-config-sample.php' ) ) {
649649
return;
650650
}
651651

@@ -679,7 +679,7 @@ public static function prepare( BeforeSuiteScope $scope ): void {
679679
// Remove install cache if any (not setting the static var).
680680
$wp_version = getenv( 'WP_VERSION' );
681681
$wp_version_suffix = ( false !== $wp_version ) ? "-$wp_version" : '';
682-
$install_cache_dir = sys_get_temp_dir() . '/wp-cli-test-core-install-cache' . $wp_version_suffix;
682+
$install_cache_dir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'wp-cli-test-core-install-cache' . $wp_version_suffix;
683683
if ( file_exists( $install_cache_dir ) ) {
684684
self::remove_dir( $install_cache_dir );
685685
}
@@ -806,7 +806,7 @@ public static function create_cache_dir(): string {
806806
if ( self::$suite_cache_dir ) {
807807
self::remove_dir( self::$suite_cache_dir );
808808
}
809-
self::$suite_cache_dir = sys_get_temp_dir() . '/' . uniqid( 'wp-cli-test-suite-cache-' . self::$temp_dir_infix . '-', true );
809+
self::$suite_cache_dir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . uniqid( 'wp-cli-test-suite-cache-' . self::$temp_dir_infix . '-', true );
810810
mkdir( self::$suite_cache_dir );
811811
return self::$suite_cache_dir;
812812
}
@@ -1028,7 +1028,7 @@ private static function get_event_file( $scope, &$line ): ?string {
10281028
*/
10291029
public function create_run_dir(): void {
10301030
if ( ! isset( $this->variables['RUN_DIR'] ) ) {
1031-
self::$run_dir = sys_get_temp_dir() . '/' . uniqid( 'wp-cli-test-run-' . self::$temp_dir_infix . '-', true );
1031+
self::$run_dir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . uniqid( 'wp-cli-test-run-' . self::$temp_dir_infix . '-', true );
10321032
$this->variables['RUN_DIR'] = self::$run_dir;
10331033
mkdir( $this->variables['RUN_DIR'] );
10341034
}
@@ -1038,7 +1038,7 @@ public function create_run_dir(): void {
10381038
* @param string $version
10391039
*/
10401040
public function build_phar( $version = 'same' ): void {
1041-
$this->variables['PHAR_PATH'] = $this->variables['RUN_DIR'] . '/' . uniqid( 'wp-cli-build-', true ) . '.phar';
1041+
$this->variables['PHAR_PATH'] = $this->variables['RUN_DIR'] . DIRECTORY_SEPARATOR . uniqid( 'wp-cli-build-', true ) . '.phar';
10421042

10431043
$is_bundle = false;
10441044

@@ -1061,6 +1061,8 @@ public function build_phar( $version = 'same' ): void {
10611061
$this->composer_command( 'dump-autoload --working-dir=' . dirname( self::get_vendor_dir() ) );
10621062
}
10631063

1064+
$make_phar_path = realpath( $make_phar_path );
1065+
10641066
$this->proc(
10651067
Utils\esc_cmd(
10661068
'php -dphar.readonly=0 %1$s %2$s --version=%3$s && chmod +x %2$s',
@@ -1109,7 +1111,7 @@ public function download_phar( $version = 'same' ): void {
11091111
* CACHE_DIR is a cache for downloaded test data such as images. Lives until manually deleted.
11101112
*/
11111113
private function set_cache_dir(): void {
1112-
$path = sys_get_temp_dir() . '/wp-cli-test-cache';
1114+
$path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'wp-cli-test-cache';
11131115
if ( ! file_exists( $path ) ) {
11141116
mkdir( $path );
11151117
}
@@ -1394,7 +1396,7 @@ public function create_config( $subdir = '', $extra_php = false ): void {
13941396
public function install_wp( $subdir = '' ): void {
13951397
$wp_version = getenv( 'WP_VERSION' );
13961398
$wp_version_suffix = ( false !== $wp_version ) ? "-$wp_version" : '';
1397-
self::$install_cache_dir = sys_get_temp_dir() . '/wp-cli-test-core-install-cache' . $wp_version_suffix;
1399+
self::$install_cache_dir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'wp-cli-test-core-install-cache' . $wp_version_suffix;
13981400
if ( ! file_exists( self::$install_cache_dir ) ) {
13991401
mkdir( self::$install_cache_dir );
14001402
}
@@ -1507,17 +1509,17 @@ public function install_wp_with_composer( $vendor_directory = 'vendor' ): void {
15071509

15081510
public function composer_add_wp_cli_local_repository(): void {
15091511
if ( ! self::$composer_local_repository ) {
1510-
self::$composer_local_repository = sys_get_temp_dir() . '/' . uniqid( 'wp-cli-composer-local-', true );
1512+
self::$composer_local_repository = sys_get_temp_dir() . DIRECTORY_SEPARATOR . uniqid( 'wp-cli-composer-local-', true );
15111513
mkdir( self::$composer_local_repository );
15121514

15131515
$env = self::get_process_env_variables();
15141516
$src = $env['TRAVIS_BUILD_DIR'] ?? realpath( self::get_vendor_dir() . '/../' );
15151517

1516-
self::copy_dir( $src, self::$composer_local_repository . '/' );
1517-
self::remove_dir( self::$composer_local_repository . '/.git' );
1518-
self::remove_dir( self::$composer_local_repository . '/vendor' );
1518+
self::copy_dir( $src, self::$composer_local_repository . DIRECTORY_SEPARATOR );
1519+
self::remove_dir( self::$composer_local_repository . DIRECTORY_SEPARATOR . '.git' );
1520+
self::remove_dir( self::$composer_local_repository . DIRECTORY_SEPARATOR . 'vendor' );
15191521
}
1520-
$dest = self::$composer_local_repository . '/';
1522+
$dest = self::$composer_local_repository . DIRECTORY_SEPARATOR;
15211523
$this->composer_command( "config repositories.wp-cli '{\"type\": \"path\", \"url\": \"$dest\", \"options\": {\"symlink\": false, \"versions\": { \"wp-cli/wp-cli\": \"dev-main\"}}}'" );
15221524
$this->variables['COMPOSER_LOCAL_REPOSITORY'] = self::$composer_local_repository;
15231525
}

0 commit comments

Comments
 (0)