diff --git a/composer.json b/composer.json index ddb9f470..9b53625d 100644 --- a/composer.json +++ b/composer.json @@ -18,14 +18,15 @@ }, "require-dev": { "wp-cli/scaffold-command": "^1 || ^2", - "wp-cli/wp-cli-tests": "^4" + "wp-cli/wp-cli-tests": "^5" }, "config": { "process-timeout": 7200, "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" ] diff --git a/tests/JsonManipulatorTest.php b/tests/JsonManipulatorTest.php index 026f7bec..156ab7f9 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); @@ -1601,10 +1605,6 @@ public static function removeSubNodeProvider() } } } -', - - '{ -} ', ), 'works on deep repos with borked texts2' => array( @@ -1624,10 +1624,6 @@ public static function removeSubNodeProvider() } } } -', - - '{ -} ', ), 'fails on deep arrays with borked texts' => array( @@ -2367,6 +2363,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 +2430,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 +2492,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);