From 9de06c7502375f681ca7e8d0410dbebb8056efca Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 4 Jul 2025 00:47:59 +0000 Subject: [PATCH 1/4] Update wp-cli/wp-cli-tests requirement from ^4 to ^5 Updates the requirements on [wp-cli/wp-cli-tests](https://github.com/wp-cli/wp-cli-tests) to permit the latest version. - [Release notes](https://github.com/wp-cli/wp-cli-tests/releases) - [Commits](https://github.com/wp-cli/wp-cli-tests/compare/v4.0.0...v5.0.0) --- updated-dependencies: - dependency-name: wp-cli/wp-cli-tests dependency-version: 5.0.0 dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ddb9f470..589b6301 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ }, "require-dev": { "wp-cli/scaffold-command": "^1 || ^2", - "wp-cli/wp-cli-tests": "^4" + "wp-cli/wp-cli-tests": "^5" }, "config": { "process-timeout": 7200, From 6f5b84701438a6242477c652a9da36690b431d07 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 4 Jul 2025 10:49:39 +0200 Subject: [PATCH 2/4] Update Composer config --- composer.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 589b6301..9b53625d 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,8 @@ "sort-packages": true, "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true, - "johnpbloch/wordpress-core-installer": true + "johnpbloch/wordpress-core-installer": true, + "phpstan/extension-installer": true }, "lock": false }, @@ -58,12 +59,14 @@ "behat-rerun": "rerun-behat-tests", "lint": "run-linter-tests", "phpcs": "run-phpcs-tests", + "phpstan": "run-phpstan-tests", "phpcbf": "run-phpcbf-cleanup", "phpunit": "run-php-unit-tests", "prepare-tests": "install-package-tests", "test": [ "@lint", "@phpcs", + "@phpstan", "@phpunit", "@behat" ] From 544d18f2d33b6e4238b2f779b90cf82da85752aa Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 4 Jul 2025 11:24:58 +0200 Subject: [PATCH 3/4] Fix unit tests --- tests/JsonManipulatorTest.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/JsonManipulatorTest.php b/tests/JsonManipulatorTest.php index 026f7bec..1735feed 100644 --- a/tests/JsonManipulatorTest.php +++ b/tests/JsonManipulatorTest.php @@ -12,6 +12,7 @@ use WP_CLI\JsonManipulator; // WP_CLI use WP_CLI\Tests\TestCase; +use PHPUnit\Framework\Attributes\DataProvider; class JsonManipulatorTest extends TestCase { @@ -19,6 +20,7 @@ class JsonManipulatorTest extends TestCase /** * @dataProvider linkProvider */ + #[DataProvider( 'linkProvider' )] // phpcs:ignore PHPCompatibility.Attributes.NewAttributes.PHPUnitAttributeFound public function testAddLink($json, $type, $package, $constraint, $expected) { $manipulator = new JsonManipulator($json); @@ -1290,6 +1292,7 @@ public static function linkProvider() /** * @dataProvider providerAddLinkAndSortPackages */ + #[DataProvider( 'providerAddLinkAndSortPackages' )] // phpcs:ignore PHPCompatibility.Attributes.NewAttributes.PHPUnitAttributeFound public function testAddLinkAndSortPackages($json, $type, $package, $constraint, $sortPackages, $expected) { $manipulator = new JsonManipulator($json); @@ -1370,6 +1373,7 @@ public static function providerAddLinkAndSortPackages() /** * @dataProvider removeSubNodeProvider */ + #[DataProvider( 'removeSubNodeProvider' )] // phpcs:ignore PHPCompatibility.Attributes.NewAttributes.PHPUnitAttributeFound public function testRemoveSubNode($json, $name, $expected, $expectedContent = null) { $manipulator = new JsonManipulator($json); @@ -2367,6 +2371,7 @@ public function testRemoveMainKeyAtEndOfFile() /** * @dataProvider providerAddLinkCaseInsensitive */ + #[DataProvider( 'providerAddLinkCaseInsensitive' )] // phpcs:ignore PHPCompatibility.Attributes.NewAttributes.PHPUnitAttributeFound public function testAddLinkCaseInsensitive($json, $type, $package, $constraint, $sortPackages, $expected) { $manipulator = new JsonManipulator($json); @@ -2433,6 +2438,7 @@ public static function providerAddLinkCaseInsensitive() /** * @dataProvider providerAddSubNodeCase */ + #[DataProvider( 'providerAddSubNodeCase' )] // phpcs:ignore PHPCompatibility.Attributes.NewAttributes.PHPUnitAttributeFound public function testAddSubNodeCase($json, $mainNode, $name, $caseInsensitive, $expected) { $manipulator = new JsonManipulator($json); @@ -2494,6 +2500,7 @@ public static function providerAddSubNodeCase() /** * @dataProvider providerRemoveSubNodeCaseInsensitive */ + #[DataProvider( 'providerRemoveSubNodeCaseInsensitive' )] // phpcs:ignore PHPCompatibility.Attributes.NewAttributes.PHPUnitAttributeFound public function testRemoveSubNodeCaseInsensitive($json, $mainNode, $name, $expected, $expectedContent = null) { $manipulator = new JsonManipulator($json); From 30863008a8e43a8e78ace5c9e221321947e3c1aa Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 4 Jul 2025 11:41:00 +0200 Subject: [PATCH 4/4] Fix data provider with extraneous items --- tests/JsonManipulatorTest.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tests/JsonManipulatorTest.php b/tests/JsonManipulatorTest.php index 1735feed..156ab7f9 100644 --- a/tests/JsonManipulatorTest.php +++ b/tests/JsonManipulatorTest.php @@ -1605,10 +1605,6 @@ public static function removeSubNodeProvider() } } } -', - - '{ -} ', ), 'works on deep repos with borked texts2' => array( @@ -1628,10 +1624,6 @@ public static function removeSubNodeProvider() } } } -', - - '{ -} ', ), 'fails on deep arrays with borked texts' => array(