Skip to content

Commit 6ce7eef

Browse files
committed
Try behat fixes
1 parent 8b8f25e commit 6ce7eef

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/Context/FeatureContext.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -441,12 +441,15 @@ private static function get_process_env_variables(): array {
441441
$path_separator = Utils\is_windows() ? ';' : ':';
442442
$php_binary_path = dirname( PHP_BINARY );
443443
$env = [
444-
'PATH' => $php_binary_path . $path_separator . $bin_path . $path_separator . getenv( 'PATH' ),
445-
'BEHAT_RUN' => 1,
446-
'HOME' => sys_get_temp_dir() . '/wp-cli-home',
447-
'TEST_RUN_DIR' => self::$behat_run_dir,
444+
'PATH' => $php_binary_path . $path_separator . $bin_path . $path_separator . getenv( 'PATH' ),
445+
'BEHAT_RUN' => 1,
446+
'HOME' => sys_get_temp_dir() . '/wp-cli-home',
447+
'COMPOSER_HOME' => sys_get_temp_dir() . '/wp-cli-composer-home',
448+
'TEST_RUN_DIR' => self::$behat_run_dir,
448449
];
449450

451+
$env = array_merge( $_ENV, $env );
452+
450453
if ( self::running_with_code_coverage() ) {
451454
$has_coverage_driver = ( new Runtime() )->hasXdebug() || ( new Runtime() )->hasPCOV();
452455

@@ -1441,7 +1444,7 @@ public function install_wp( $subdir = '' ): void {
14411444
$subdir = $this->replace_variables( $subdir );
14421445

14431446
// Disable WP Cron by default to avoid bogus HTTP requests in CLI context.
1444-
$config_extra_php = "if ( ! defined( 'DISABLE_WP_CRON' ) ) { define( 'DISABLE_WP_CRON', true ); }\n";
1447+
$config_extra_php = "if ( ! defined( 'DISABLE_WP_CRON' ) ) { define( 'DISABLE_WP_CRON', true ); }" . PHP_EOL;
14451448

14461449
if ( 'sqlite' !== self::$db_type ) {
14471450
$this->create_db();
@@ -1517,9 +1520,9 @@ public function install_wp_with_composer( $vendor_directory = 'vendor' ): void {
15171520
$this->composer_command( 'require johnpbloch/wordpress-core-installer johnpbloch/wordpress-core --optimize-autoloader' );
15181521

15191522
// Disable WP Cron by default to avoid bogus HTTP requests in CLI context.
1520-
$config_extra_php = "if ( ! defined( 'DISABLE_WP_CRON' ) ) { define( 'DISABLE_WP_CRON', true ); }\n";
1523+
$config_extra_php = "if ( ! defined( 'DISABLE_WP_CRON' ) ) { define( 'DISABLE_WP_CRON', true ); }" . PHP_EOL;
15211524

1522-
$config_extra_php .= "require_once dirname(__DIR__) . '/" . $vendor_directory . "/autoload.php';\n";
1525+
$config_extra_php .= "require_once dirname(__DIR__) . '/" . $vendor_directory . "/autoload.php';" . PHP_EOL;
15231526

15241527
$this->create_config( 'WordPress', $config_extra_php );
15251528

0 commit comments

Comments
 (0)