diff --git a/bootstrap.php b/bootstrap.php index b650647..3b92cf7 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -4,30 +4,11 @@ require_once 'vendor/autoload.php'; -# The WP test suite assumes the existence of classes that only exist in -# version 9 and older of PHPUnit. This solves that. -if ( 1 === version_compare( \PHPUnit\Runner\Version::id(), '10' ) ) { - require __DIR__ . '/supressors/SupressFramework.php'; - require __DIR__ . '/supressors/SupressFrameworkError.php'; -} - use Aldavigdis\WpTestsStrapon\Bootstrap; -use Aldavigdis\WpTestsStrapon\FetchWP; - -if (getenv('WP_VERSION') === false) { - putenv('WP_VERSION=master'); -} +use Aldavigdis\WpTestsStrapon\SetEnv; -if (defined('WP_TESTS_CONFIG_FILE_PATH') === false) { - define( - 'WP_TESTS_CONFIG_FILE_PATH', - Aldavigdis\WpTestsStrapon\Config::path() - ); -} +SetEnv::supress(); +SetEnv::setWpVersion(); +SetEnv::setConfigFilePath(); Bootstrap::init(getenv('WP_VERSION')); - -require FetchWP::extractDirPath() . 'wordpress-develop-trunk/tests/phpunit/includes/functions.php'; -ob_start(); -require FetchWP::extractDirPath() . 'wordpress-develop-trunk/tests/phpunit/includes/bootstrap.php'; -ob_end_clean(); diff --git a/composer.lock b/composer.lock index 4ebdb19..31dcc02 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "dbc4d02b7215ae5dfb1ffd28e87ce7ea", + "content-hash": "50e46c0920f200025eafd691dede4e62", "packages": [ { "name": "myclabs/deep-copy", diff --git a/src/Bootstrap.php b/src/Bootstrap.php index 7b2cfe5..dfa5fb4 100644 --- a/src/Bootstrap.php +++ b/src/Bootstrap.php @@ -384,6 +384,14 @@ public static function init(string $wp_version): void self::displayLine('Bye!', '👋'); self::displaySeparator(); + + require FetchWP::extractDirPath() . + 'wordpress-develop-trunk/tests/phpunit/includes/functions.php'; + + ob_start(); + require FetchWP::extractDirPath() . + 'wordpress-develop-trunk/tests/phpunit/includes/bootstrap.php'; + ob_end_clean(); } /** diff --git a/src/SetEnv.php b/src/SetEnv.php new file mode 100644 index 0000000..f6183eb --- /dev/null +++ b/src/SetEnv.php @@ -0,0 +1,49 @@ +