diff --git a/.gitignore b/.gitignore index 4a485fb2..dcd18b14 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ composer.lock phpunit.xml phpcs.xml .phpcs.xml +.phpunit.result.cache diff --git a/composer.json b/composer.json index 90f8a12e..05b17a43 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "wp-cli/eval-command": "^1 || ^2", "wp-cli/wp-cli": "^2.5.1", "wp-coding-standards/wpcs": "^3", - "yoast/phpunit-polyfills": "^1.0.3" + "yoast/phpunit-polyfills": "^1.0.3 || ^2.0.1" }, "require-dev": { "roave/security-advisories": "dev-latest" diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 6d71ef1b..4ec777f6 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -4,8 +4,8 @@ > - tests/ - tests/ + tests/ + tests/tests diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 73b76032..0b7f434e 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -29,7 +29,7 @@ require_once VENDOR_DIR . '/autoload.php'; require_once WP_CLI_ROOT . '/php/utils.php'; -require_once __DIR__ . '/wp-cli-testcase.php'; +require_once __DIR__ . '/includes/TestCase.php'; function wpcli_tests_include_config( array $config_filenames = [] ) { $config_filename = false; diff --git a/tests/wp-cli-testcase.php b/tests/includes/TestCase.php similarity index 100% rename from tests/wp-cli-testcase.php rename to tests/includes/TestCase.php diff --git a/tests/test-behat-tags.php b/tests/tests/TestBehatTags.php similarity index 95% rename from tests/test-behat-tags.php rename to tests/tests/TestBehatTags.php index 17d959a4..d819a181 100644 --- a/tests/test-behat-tags.php +++ b/tests/tests/TestBehatTags.php @@ -3,7 +3,7 @@ use WP_CLI\Tests\TestCase; use WP_CLI\Utils; -class BehatTagsTest extends TestCase { +class TestBehatTags extends TestCase { public $temp_dir; @@ -39,7 +39,7 @@ public function test_behat_tags_wp_version_github_token( $env, $expected ) { putenv( 'WP_VERSION' ); putenv( 'GITHUB_TOKEN' ); - $behat_tags = dirname( __DIR__ ) . '/utils/behat-tags.php'; + $behat_tags = dirname( dirname( __DIR__ ) ) . '/utils/behat-tags.php'; $contents = '@require-wp-4.6 @require-wp-4.8 @require-wp-4.9 @less-than-wp-4.6 @less-than-wp-4.8 @less-than-wp-4.9'; file_put_contents( $this->temp_dir . '/features/wp_version.feature', $contents ); @@ -64,7 +64,7 @@ public function test_behat_tags_wp_version_github_token( $env, $expected ) { putenv( false === $env_github_token ? 'GITHUB_TOKEN' : "GITHUB_TOKEN=$env_github_token" ); } - public function data_behat_tags_wp_version_github_token() { + public static function data_behat_tags_wp_version_github_token() { return array( array( 'WP_VERSION=4.5', '~@require-wp-4.6&&~@require-wp-4.8&&~@require-wp-4.9&&~@github-api' ), array( 'WP_VERSION=4.6', '~@require-wp-4.8&&~@require-wp-4.9&&~@less-than-wp-4.6&&~@github-api' ), @@ -85,7 +85,7 @@ public function test_behat_tags_php_version() { putenv( 'GITHUB_TOKEN' ); - $behat_tags = dirname( __DIR__ ) . '/utils/behat-tags.php'; + $behat_tags = dirname( dirname( __DIR__ ) ) . '/utils/behat-tags.php'; $php_version = substr( PHP_VERSION, 0, 3 ); $contents = ''; @@ -142,7 +142,7 @@ public function test_behat_tags_extension() { putenv( 'GITHUB_TOKEN' ); - $behat_tags = dirname( __DIR__ ) . '/utils/behat-tags.php'; + $behat_tags = dirname( dirname( __DIR__ ) ) . '/utils/behat-tags.php'; file_put_contents( $this->temp_dir . '/features/extension.feature', '@require-extension-imagick @require-extension-curl' );