From 7641736568a44478dc1c3dc82bd865bd1777ac27 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 4 Jul 2025 16:05:36 +0200 Subject: [PATCH 1/3] Fix branch alias --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d1ed748..064c7eb 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ }, "extra": { "branch-alias": { - "dev-master": "0.11.x-dev" + "dev-master": "0.12.x-dev" } }, "minimum-stability": "dev", From 390b699588ed6bac48ac683ac9bb74bf7f4b6483 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 4 Jul 2025 16:05:48 +0200 Subject: [PATCH 2/3] Use wp-cli-tests v5 --- composer.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 064c7eb..b6da739 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ }, "require-dev": { "roave/security-advisories": "dev-latest", - "wp-cli/wp-cli-tests": "^4" + "wp-cli/wp-cli-tests": "^5" }, "extra": { "branch-alias": { @@ -42,7 +42,8 @@ "config": { "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true, - "johnpbloch/wordpress-core-installer": true + "johnpbloch/wordpress-core-installer": true, + "phpstan/extension-installer": true } }, "scripts": { @@ -50,11 +51,13 @@ "behat-rerun": "rerun-behat-tests", "lint": "run-linter-tests", "phpcs": "run-phpcs-tests", + "phpstan": "run-phpstan-tests", "phpunit": "run-php-unit-tests", "prepare-tests": "install-package-tests", "test": [ "@lint", "@phpcs", + "@phpstan", "@phpunit", "@behat" ] From 741f7db87fddb6ce5021316c17308605e952b61f Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 4 Jul 2025 16:36:32 +0200 Subject: [PATCH 3/3] Fix unit tests --- tests/Test_Arguments.php | 6 +++++- tests/Test_Colors.php | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/Test_Arguments.php b/tests/Test_Arguments.php index 9f89eda..2201849 100644 --- a/tests/Test_Arguments.php +++ b/tests/Test_Arguments.php @@ -1,6 +1,6 @@ _testParse($cliParams, $expectedValues); @@ -265,6 +266,7 @@ public function testParseWithValidOptions($cliParams, $expectedValues) * @param array $expectedValues expected values after parsing * @dataProvider settingsWithMissingOptions */ + #[DataProvider( 'settingsWithMissingOptions' )] // phpcs:ignore PHPCompatibility.Attributes.NewAttributes.PHPUnitAttributeFound public function testParseWithMissingOptions($cliParams, $expectedValues) { $this->expectException(\Exception::class); @@ -277,6 +279,7 @@ public function testParseWithMissingOptions($cliParams, $expectedValues) * @param array $expectedValues expected values after parsing * @dataProvider settingsWithMissingOptionsWithDefault */ + #[DataProvider( 'settingsWithMissingOptionsWithDefault' )] // phpcs:ignore PHPCompatibility.Attributes.NewAttributes.PHPUnitAttributeFound public function testParseWithMissingOptionsWithDefault($cliParams, $expectedValues) { $this->_testParse($cliParams, $expectedValues); @@ -287,6 +290,7 @@ public function testParseWithMissingOptionsWithDefault($cliParams, $expectedValu * @param array $expectedValues expected values after parsing * @dataProvider settingsWithNoOptionsWithDefault */ + #[DataProvider( 'settingsWithNoOptionsWithDefault' )] // phpcs:ignore PHPCompatibility.Attributes.NewAttributes.PHPUnitAttributeFound public function testParseWithNoOptionsWithDefault($cliParams, $expectedValues) { $this->_testParse($cliParams, $expectedValues); } diff --git a/tests/Test_Colors.php b/tests/Test_Colors.php index bac23a4..b7d28ff 100644 --- a/tests/Test_Colors.php +++ b/tests/Test_Colors.php @@ -2,12 +2,14 @@ use cli\Colors; use WP_CLI\Tests\TestCase; +use PHPUnit\Framework\Attributes\DataProvider; class Test_Colors extends TestCase { /** * @dataProvider dataColors */ + #[DataProvider( 'dataColors' )] // phpcs:ignore PHPCompatibility.Attributes.NewAttributes.PHPUnitAttributeFound public function testColors( $str, $color ) { // Colors enabled. Colors::enable( true );