Skip to content

Commit

Permalink
Add extra constant to make sure strange Mac environments don't install
Browse files Browse the repository at this point in the history
  • Loading branch information
lipemat committed Nov 1, 2019
1 parent 0f53ccd commit 899f5cd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions includes/bootstrap-no-install.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@

// New version
putenv( 'WP_TESTS_SKIP_INSTALL=1' );
if ( ! defined( 'WP_TESTS_SKIP_INSTALL') ) {
define( 'WP_TESTS_SKIP_INSTALL', true );
}

require dirname( __FILE__ ) . '/bootstrap.php';
10 changes: 6 additions & 4 deletions includes/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
require_once dirname( __FILE__ ) . '/phpunit6/compat.php';
}



if ( defined( 'WP_TESTS_CONFIG_FILE_PATH' ) ) {
$config_file_path = WP_TESTS_CONFIG_FILE_PATH;
} else {
Expand Down Expand Up @@ -43,7 +41,6 @@
}
require_once dirname( __FILE__ ) . '/functions.php';


if ( version_compare( tests_get_phpunit_version(), '8.0', '>=' ) ) {
printf(
"ERROR: Looks like you're using PHPUnit %s. WordPress is currently only compatible with PHPUnit up to 7.x.\n",
Expand All @@ -53,6 +50,11 @@
exit( 1 );
}

if ( defined( 'WP_RUN_CORE_TESTS' ) && WP_RUN_CORE_TESTS && ! is_dir( ABSPATH ) ) {
echo "ERROR: The /build/ directory is missing! Please run `npm run build` prior to running PHPUnit.\n";
exit( 1 );
}

tests_reset__SERVER();

define( 'WP_TESTS_TABLE_PREFIX', $table_prefix );
Expand Down Expand Up @@ -99,7 +101,7 @@
$wp_theme_directories[] = DIR_TESTDATA . '/themedir1';
}

if ( '1' !== getenv( 'WP_TESTS_SKIP_INSTALL' ) ) {
if ( ( ! defined( 'WP_TESTS_SKIP_INSTALL' ) || ! WP_TESTS_SKIP_INSTALL ) && '1' !== getenv( 'WP_TESTS_SKIP_INSTALL' ) ) {
system( WP_PHP_BINARY . ' ' . escapeshellarg( dirname( __FILE__ ) . '/install.php' ) . ' ' . escapeshellarg( $config_file_path ) . ' ' . $multisite, $retval );
if ( 0 !== $retval ) {
exit( $retval );
Expand Down

0 comments on commit 899f5cd

Please sign in to comment.