From e6179d27a35c8e041d7f4a82970c1772a1f75369 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 17 May 2024 11:34:24 +0200 Subject: [PATCH 1/3] Support `yoast/phpunit-polyfills` --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" From ee10ce5c928a29db28b7def918f6643a9613c64f Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 17 May 2024 11:44:24 +0200 Subject: [PATCH 2/3] Rename class files --- phpunit.xml.dist | 4 ++-- tests/bootstrap.php | 2 +- tests/{wp-cli-testcase.php => includes/TestCase.php} | 0 tests/{test-behat-tags.php => tests/TestBehatTags.php} | 10 +++++----- 4 files changed, 8 insertions(+), 8 deletions(-) rename tests/{wp-cli-testcase.php => includes/TestCase.php} (100%) rename tests/{test-behat-tags.php => tests/TestBehatTags.php} (95%) 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' ); From 80ef4371b44c129e682ba65c6d0e0182246dbb06 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 17 May 2024 11:44:34 +0200 Subject: [PATCH 3/3] Update gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) 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