From 5724d53262885250fa4e3e6ccda93040c48b3f7d Mon Sep 17 00:00:00 2001 From: David Molineus Date: Mon, 9 Feb 2026 10:40:57 +0100 Subject: [PATCH 1/5] Update phpcq tools --- .phpcq.lock | 2 +- .phpcq.yaml.dist | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.phpcq.lock b/.phpcq.lock index 8e3e36e..d0573aa 100644 --- a/.phpcq.lock +++ b/.phpcq.lock @@ -1 +1 @@ -{"plugins":{"phpunit":{"api-version":"1.0.0","version":"1.0.0.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phpunit/phpunit-1.0.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0"},"tool":{"phpunit":"^6.0 || ^7.0 || ^8.0 || ^9.0"}},"checksum":{"type":"sha-512","value":"c73f15658e3ba62665f09492ec91c3a6a715760bfaa88473a987538439fff442540148e086e46a6aa18ce55a3ea2fbf76caaa581384cb84a38859fcc609ae7e4"},"tools":{"phpunit":{"version":"9.6.23","url":"https://phar.phpunit.de/phpunit-9.6.23.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*","ext-json":"*","ext-libxml":"*","ext-mbstring":"*","ext-xml":"*","ext-xmlwriter":"*"}},"checksum":{"type":"sha-256","value":"f195cd37de1bd14b4b60aa90af5bea95e8506d828c0dbbcf8dca03d78a38e79f"},"signature":"https://phar.phpunit.de/phpunit-9.6.23.phar.asc"}},"composerLock":null},"psalm":{"api-version":"1.0.0","version":"1.3.0.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/psalm/psalm-1.3.0.0.php","signature":null,"requirements":{"php":{"php":"^7.4 || ^8.0","ext-dom":"*"},"tool":{"psalm":"^3.0 || ^4.0 || ^5.0 || ^6.0"}},"checksum":{"type":"sha-512","value":"4a550c9226d7bca582d7c10bd87cce01190c96398936b1613421640c83df62ed1c6e0d44c1b39635414ea8cf4a892a6458d27590793238add24e7cb5547e6ffd"},"tools":{"psalm":{"version":"6.12.0","url":"https://github.com/vimeo/psalm/releases/download/6.12.0/psalm.phar","requirements":{"php":{"php":"~8.1.31 || ~8.2.27 || ~8.3.16 || ~8.4.3","ext-SimpleXML":"*","ext-ctype":"*","ext-dom":"*","ext-json":"*","ext-libxml":"*","ext-mbstring":"*","ext-tokenizer":"*"}},"checksum":null,"signature":"https://github.com/vimeo/psalm/releases/download/6.12.0/psalm.phar.asc"}},"composerLock":null},"composer-require-checker":{"api-version":"1.0.0","version":"1.1.1.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/composer-require-checker/composer-require-checker-1.1.1.0.php","signature":null,"requirements":{"php":{"php":"^7.4 || ^8.0"},"tool":{"composer-require-checker":"^3.8 || ^4.0"}},"checksum":{"type":"sha-512","value":"d5415bddfe024c5749d894034583882aee4e5c3e1087815d9fdd81cb5e71630f631a0e35de0ff84b97fbbf738c16ece5f83bd8c00695913eb846aa6f04577dc2"},"tools":{"composer-require-checker":{"version":"4.16.1","url":"https://github.com/maglnet/ComposerRequireChecker/releases/download/4.16.1/composer-require-checker.phar","requirements":{"php":{"php":"~8.2.0 || ~8.3.0 || ~8.4.0","ext-phar":"*"}},"checksum":null,"signature":"https://github.com/maglnet/ComposerRequireChecker/releases/download/4.16.1/composer-require-checker.phar.asc"}},"composerLock":null},"phpmd":{"api-version":"1.0.0","version":"1.0.2.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phpmd/phpmd-1.0.2.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpmd":"^2.6.1"}},"checksum":{"type":"sha-512","value":"f22280a6dec8dbdd2ec1d83b294f23237fe32c34f4a298e52038e0a7a0074d541635b2b488b1a6098a42d8418a6cd8eb804406ea82b91e362be2b5d11a0915b0"},"tools":{"phpmd":{"version":"2.15.0","url":"https://github.com/phpmd/phpmd/releases/download/2.15.0/phpmd.phar","requirements":{"php":{"php":">=5.3.9","ext-xml":"*"}},"checksum":null,"signature":"https://github.com/phpmd/phpmd/releases/download/2.15.0/phpmd.phar.asc"}},"composerLock":null},"phpcpd":{"api-version":"1.0.0","version":"1.1.1.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phpcpd/phpcpd-1.1.1.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpcpd":"^6.0"}},"checksum":{"type":"sha-512","value":"1189ce0bf3fade4cb4241f1d96f915ef8fc7651f4450dc79fdf464ee3d6be3009316f0d423ce2d4af9d76ad50807b7fdf4d77bfa6d9ee2c91d6eda32ea214433"},"tools":{"phpcpd":{"version":"6.0.3","url":"https://phar.phpunit.de/phpcpd-6.0.3.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*"}},"checksum":{"type":"sha-256","value":"2cbaea7cfda1bb4299d863eb075e977c3f49055dd16d88529fae5150d48a84cb"},"signature":"https://phar.phpunit.de/phpcpd-6.0.3.phar.asc"}},"composerLock":null},"phploc":{"api-version":"1.0.0","version":"1.0.0.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phploc/phploc-1.0.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*","ext-json":"*"},"tool":{"phploc":"^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0"}},"checksum":{"type":"sha-512","value":"f67b02d494796adf553cb3dd13ec06c1cb8e53c799954061749424251379541637538199afb3afa3c7a01cabd1cb6f1c53eb621f015dff9644c6c7cbf10c56d1"},"tools":{"phploc":{"version":"7.0.2","url":"https://phar.phpunit.de/phploc-7.0.2.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*","ext-json":"*"}},"checksum":{"type":"sha-256","value":"3d59778ec86faf25fd00e3a329b2f9ad4a3c751ca91601ea7dab70f887b0bf46"},"signature":"https://phar.phpunit.de/phploc-7.0.2.phar.asc"}},"composerLock":null},"phpcs":{"api-version":"1.0.0","version":"1.2.0.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phpcs/phpcs-1.2.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpcs":"^3.0 || ^2.0","phpcbf":"^3.0 || ^2.0"}},"checksum":{"type":"sha-512","value":"b6ed00306e76068a6af5e3b1dec837724f9e1900ef1049ce88e7ce195b0583524ca33a73613fba13244307a7ca853b6ddaa14ded69f651c3f184ac130bd1aaad"},"tools":{"phpcs":{"version":"3.13.2","url":"https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/download/3.13.2/phpcs.phar","requirements":{"php":{"php":">=5.4.0","ext-simplexml":"*","ext-tokenizer":"*","ext-xmlwriter":"*"}},"checksum":null,"signature":"https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/download/3.13.2/phpcs.phar.asc"},"phpcbf":{"version":"3.13.2","url":"https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/download/3.13.2/phpcbf.phar","requirements":{"php":{"php":">=5.4.0","ext-simplexml":"*","ext-tokenizer":"*","ext-xmlwriter":"*"}},"checksum":null,"signature":"https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/download/3.13.2/phpcbf.phar.asc"}},"composerLock":null},"composer-normalize":{"api-version":"1.0.0","version":"1.1.1.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/composer-normalize/composer-normalize-1.1.1.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-json":"*"},"tool":{"composer-normalize":"^2.1"}},"checksum":{"type":"sha-512","value":"d9abda440b85d501c58abf9c81bf76f417594b397129215ffa8b777e9bb5e5eda37d7661d661db3c8d11c24f20345bc6fbe56f013b3b9435d459d2b94f086e0f"},"tools":{"composer-normalize":{"version":"2.47.0","url":"https://github.com/ergebnis/composer-normalize/releases/download/2.47.0/composer-normalize.phar","requirements":{"php":{"php":"~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0","ext-json":"*"}},"checksum":null,"signature":"https://github.com/ergebnis/composer-normalize/releases/download/2.47.0/composer-normalize.phar.asc"}},"composerLock":null}},"tools":[]} \ No newline at end of file +{"plugins":{"phpunit":{"api-version":"1.0.0","version":"1.1.0.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phpunit/phpunit-1.1.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0"},"tool":{"phpunit":"^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0"}},"checksum":{"type":"sha-512","value":"c73f15658e3ba62665f09492ec91c3a6a715760bfaa88473a987538439fff442540148e086e46a6aa18ce55a3ea2fbf76caaa581384cb84a38859fcc609ae7e4"},"tools":{"phpunit":{"version":"12.5.10","url":"https://phar.phpunit.de/phpunit-12.5.10.phar","requirements":{"php":{"php":">=8.3","ext-dom":"*","ext-json":"*","ext-libxml":"*","ext-mbstring":"*","ext-xml":"*","ext-xmlwriter":"*"}},"checksum":{"type":"sha-256","value":"2a04786f1d71275775f2adbac9d3e53ce41573a61d7eb92427f5b726d4d35d3a"},"signature":"https://phar.phpunit.de/phpunit-12.5.10.phar.asc"}},"composerLock":null},"psalm":{"api-version":"1.0.0","version":"1.3.0.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/psalm/psalm-1.3.0.0.php","signature":null,"requirements":{"php":{"php":"^7.4 || ^8.0","ext-dom":"*"},"tool":{"psalm":"^3.0 || ^4.0 || ^5.0 || ^6.0"}},"checksum":{"type":"sha-512","value":"4a550c9226d7bca582d7c10bd87cce01190c96398936b1613421640c83df62ed1c6e0d44c1b39635414ea8cf4a892a6458d27590793238add24e7cb5547e6ffd"},"tools":{"psalm":{"version":"6.15.1","url":"https://github.com/vimeo/psalm/releases/download/6.15.1/psalm.phar","requirements":{"php":{"php":"~8.1.31 || ~8.2.27 || ~8.3.16 || ~8.4.3 || ~8.5.0","ext-SimpleXML":"*","ext-ctype":"*","ext-dom":"*","ext-json":"*","ext-libxml":"*","ext-mbstring":"*","ext-tokenizer":"*"}},"checksum":null,"signature":"https://github.com/vimeo/psalm/releases/download/6.15.1/psalm.phar.asc"}},"composerLock":null},"composer-require-checker":{"api-version":"1.0.0","version":"1.1.1.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/composer-require-checker/composer-require-checker-1.1.1.0.php","signature":null,"requirements":{"php":{"php":"^7.4 || ^8.0"},"tool":{"composer-require-checker":"^3.8 || ^4.0"}},"checksum":{"type":"sha-512","value":"d5415bddfe024c5749d894034583882aee4e5c3e1087815d9fdd81cb5e71630f631a0e35de0ff84b97fbbf738c16ece5f83bd8c00695913eb846aa6f04577dc2"},"tools":{"composer-require-checker":{"version":"4.20.0","url":"https://github.com/maglnet/ComposerRequireChecker/releases/download/4.20.0/composer-require-checker.phar","requirements":{"php":{"php":"~8.3.0 || ~8.4.0 || ~8.5.0","ext-phar":"*"}},"checksum":null,"signature":"https://github.com/maglnet/ComposerRequireChecker/releases/download/4.20.0/composer-require-checker.phar.asc"}},"composerLock":null},"phpmd":{"api-version":"1.0.0","version":"1.0.2.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phpmd/phpmd-1.0.2.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpmd":"^2.6.1"}},"checksum":{"type":"sha-512","value":"f22280a6dec8dbdd2ec1d83b294f23237fe32c34f4a298e52038e0a7a0074d541635b2b488b1a6098a42d8418a6cd8eb804406ea82b91e362be2b5d11a0915b0"},"tools":{"phpmd":{"version":"2.15.0","url":"https://github.com/phpmd/phpmd/releases/download/2.15.0/phpmd.phar","requirements":{"php":{"php":">=5.3.9","ext-xml":"*"}},"checksum":null,"signature":"https://github.com/phpmd/phpmd/releases/download/2.15.0/phpmd.phar.asc"}},"composerLock":null},"phpcpd":{"api-version":"1.0.0","version":"1.1.1.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phpcpd/phpcpd-1.1.1.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpcpd":"^6.0"}},"checksum":{"type":"sha-512","value":"1189ce0bf3fade4cb4241f1d96f915ef8fc7651f4450dc79fdf464ee3d6be3009316f0d423ce2d4af9d76ad50807b7fdf4d77bfa6d9ee2c91d6eda32ea214433"},"tools":{"phpcpd":{"version":"6.0.3","url":"https://phar.phpunit.de/phpcpd-6.0.3.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*"}},"checksum":{"type":"sha-256","value":"2cbaea7cfda1bb4299d863eb075e977c3f49055dd16d88529fae5150d48a84cb"},"signature":"https://phar.phpunit.de/phpcpd-6.0.3.phar.asc"}},"composerLock":null},"phploc":{"api-version":"1.0.0","version":"1.0.0.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phploc/phploc-1.0.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*","ext-json":"*"},"tool":{"phploc":"^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0"}},"checksum":{"type":"sha-512","value":"f67b02d494796adf553cb3dd13ec06c1cb8e53c799954061749424251379541637538199afb3afa3c7a01cabd1cb6f1c53eb621f015dff9644c6c7cbf10c56d1"},"tools":{"phploc":{"version":"7.0.2","url":"https://phar.phpunit.de/phploc-7.0.2.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*","ext-json":"*"}},"checksum":{"type":"sha-256","value":"3d59778ec86faf25fd00e3a329b2f9ad4a3c751ca91601ea7dab70f887b0bf46"},"signature":"https://phar.phpunit.de/phploc-7.0.2.phar.asc"}},"composerLock":null},"phpcs":{"api-version":"1.0.0","version":"1.2.0.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phpcs/phpcs-1.2.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpcs":"^3.0 || ^2.0","phpcbf":"^3.0 || ^2.0"}},"checksum":{"type":"sha-512","value":"b6ed00306e76068a6af5e3b1dec837724f9e1900ef1049ce88e7ce195b0583524ca33a73613fba13244307a7ca853b6ddaa14ded69f651c3f184ac130bd1aaad"},"tools":{"phpcs":{"version":"3.13.5","url":"https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/download/3.13.5/phpcs.phar","requirements":{"php":{"php":">=5.4.0","ext-simplexml":"*","ext-tokenizer":"*","ext-xmlwriter":"*"}},"checksum":null,"signature":"https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/download/3.13.5/phpcs.phar.asc"},"phpcbf":{"version":"3.13.5","url":"https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/download/3.13.5/phpcbf.phar","requirements":{"php":{"php":">=5.4.0","ext-simplexml":"*","ext-tokenizer":"*","ext-xmlwriter":"*"}},"checksum":null,"signature":"https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/download/3.13.5/phpcbf.phar.asc"}},"composerLock":null},"composer-normalize":{"api-version":"1.0.0","version":"1.1.1.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/composer-normalize/composer-normalize-1.1.1.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-json":"*"},"tool":{"composer-normalize":"^2.1"}},"checksum":{"type":"sha-512","value":"d9abda440b85d501c58abf9c81bf76f417594b397129215ffa8b777e9bb5e5eda37d7661d661db3c8d11c24f20345bc6fbe56f013b3b9435d459d2b94f086e0f"},"tools":{"composer-normalize":{"version":"2.49.0","url":"https://github.com/ergebnis/composer-normalize/releases/download/2.49.0/composer-normalize.phar","requirements":{"php":{"php":"~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0","ext-json":"*"}},"checksum":null,"signature":"https://github.com/ergebnis/composer-normalize/releases/download/2.49.0/composer-normalize.phar.asc"}},"composerLock":null}},"tools":[]} \ No newline at end of file diff --git a/.phpcq.yaml.dist b/.phpcq.yaml.dist index 5ff46b7..eab7e10 100644 --- a/.phpcq.yaml.dist +++ b/.phpcq.yaml.dist @@ -42,6 +42,7 @@ phpcq: # psalm - 8A03EA3B385DBAA1 - 12CE0F1D262429A5 + - 99BF4D9A33D65E1E # magl@magll.net - D2CCAC42F6295E7D # PHP_CodeSniffer From d22af7da597466905d07a1a55a51854a71722a34 Mon Sep 17 00:00:00 2001 From: David Molineus Date: Mon, 9 Feb 2026 10:42:12 +0100 Subject: [PATCH 2/5] Use DataProvider attribute for tests with data --- tests/Plugin/PluginHashTest.php | 13 +++++-------- tests/RepositoryLoaderTest.php | 9 +++++---- tests/Tool/ToolHashTest.php | 13 +++++-------- 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/tests/Plugin/PluginHashTest.php b/tests/Plugin/PluginHashTest.php index 7ddfe5f..8297331 100644 --- a/tests/Plugin/PluginHashTest.php +++ b/tests/Plugin/PluginHashTest.php @@ -6,6 +6,7 @@ use Phpcq\RepositoryDefinition\Exception\InvalidHashException; use Phpcq\RepositoryDefinition\Plugin\PluginHash; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; /** @@ -13,7 +14,7 @@ */ class PluginHashTest extends TestCase { - public function hashProvider(): array + public static function hashProvider(): array { return [ 'SHA_1' => [PluginHash::SHA_1, 'hash-value'], @@ -23,9 +24,7 @@ public function hashProvider(): array ]; } - /** - * @dataProvider hashProvider - */ + #[DataProvider('hashProvider')] public function testToolInitializesHash(string $hashType, string $hashValue): void { $hash = PluginHash::create($hashType, $hashValue); @@ -42,7 +41,7 @@ public function testThrowsForInvalidHashType(): void PluginHash::create('unknown-type', 'hash-value'); } - public function equalsProvider(): array + public static function equalsProvider(): array { return [ 'equals with identical type and value' => [ @@ -69,9 +68,7 @@ public function equalsProvider(): array ]; } - /** - * @dataProvider equalsProvider - */ + #[DataProvider('equalsProvider')] public function testEquals( bool $expected, string $leftType, diff --git a/tests/RepositoryLoaderTest.php b/tests/RepositoryLoaderTest.php index ce09a32..1fe73d6 100644 --- a/tests/RepositoryLoaderTest.php +++ b/tests/RepositoryLoaderTest.php @@ -8,6 +8,7 @@ use Phpcq\RepositoryDefinition\JsonFileLoaderInterface; use Phpcq\RepositoryDefinition\RepositoryInterface; use Phpcq\RepositoryDefinition\RepositoryLoader; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use function file_get_contents; @@ -16,7 +17,7 @@ /** @covers \Phpcq\RepositoryDefinition\RepositoryLoader */ final class RepositoryLoaderTest extends TestCase { - public function providePlugins(): Generator + public static function providePlugins(): Generator { yield [ 'relative', @@ -38,7 +39,7 @@ public function providePlugins(): Generator ]; } - /** @dataProvider providePlugins */ + #[DataProvider('providePlugins')] public function testUrlAndPathResolvingForPlugins( string $plugin, string $version, @@ -51,7 +52,7 @@ public function testUrlAndPathResolvingForPlugins( $this->assertSame($signature, $repository->getPlugin($plugin)->getVersion($version)->getSignaturePath()); } - public function provideTools(): Generator + public static function provideTools(): Generator { yield [ 'relative', @@ -73,7 +74,7 @@ public function provideTools(): Generator ]; } - /** @dataProvider provideTools */ + #[DataProvider('provideTools')] public function testUrlAndPathResolvingForTools( string $tool, string $version, diff --git a/tests/Tool/ToolHashTest.php b/tests/Tool/ToolHashTest.php index ddc5716..e5a26b9 100644 --- a/tests/Tool/ToolHashTest.php +++ b/tests/Tool/ToolHashTest.php @@ -6,6 +6,7 @@ use Phpcq\RepositoryDefinition\Exception\InvalidHashException; use Phpcq\RepositoryDefinition\Tool\ToolHash; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; /** @@ -13,7 +14,7 @@ */ class ToolHashTest extends TestCase { - public function hashProvider(): array + public static function hashProvider(): array { return [ 'SHA_1' => [ToolHash::SHA_1, 'hash-value'], @@ -23,9 +24,7 @@ public function hashProvider(): array ]; } - /** - * @dataProvider hashProvider - */ + #[DataProvider('hashProvider')] public function testToolInitializesHash(string $hashType, string $hashValue): void { $hash = ToolHash::create($hashType, $hashValue); @@ -42,7 +41,7 @@ public function testThrowsForInvalidHashType(): void ToolHash::create('unknown-type', 'hash-value'); } - public function equalsProvider(): array + public static function equalsProvider(): array { return [ 'equals with identical type and value' => [ @@ -69,9 +68,7 @@ public function equalsProvider(): array ]; } - /** - * @dataProvider equalsProvider - */ + #[DataProvider('equalsProvider')] public function testEquals( bool $expected, string $leftType, From b55c41950a39852678ec1d119e0230f7dc5d6c13 Mon Sep 17 00:00:00 2001 From: David Molineus Date: Mon, 9 Feb 2026 10:45:53 +0100 Subject: [PATCH 3/5] Replace `getMockForAbstractClass` with `createMock` --- tests/Plugin/PluginTest.php | 27 +++++++++++++-------------- tests/RepositoryLoaderTest.php | 2 +- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/tests/Plugin/PluginTest.php b/tests/Plugin/PluginTest.php index fa15408..4e7dc0b 100644 --- a/tests/Plugin/PluginTest.php +++ b/tests/Plugin/PluginTest.php @@ -6,9 +6,10 @@ use InvalidArgumentException; use LogicException; -use Phpcq\RepositoryDefinition\Plugin\AbstractPluginVersion; use Phpcq\RepositoryDefinition\Plugin\Plugin; use Phpcq\RepositoryDefinition\Plugin\PluginHash; +use Phpcq\RepositoryDefinition\Plugin\PluginRequirements; +use Phpcq\RepositoryDefinition\Plugin\PluginVersionInterface; use PHPUnit\Framework\TestCase; /** @@ -79,18 +80,16 @@ private function mockPluginVersion( string $version, string $apiVersion, ?PluginHash $hash - ): AbstractPluginVersion { - return $this->getMockForAbstractClass( - AbstractPluginVersion::class, - [ - $name, - $version, - $apiVersion, - null, - '/path/to/plugin', - null, - $hash ?? PluginHash::create(PluginHash::SHA_512, 'hashy-corp'), - ] - ); + ): PluginVersionInterface { + $mock = $this->createMock(PluginVersionInterface::class); + $mock->method('getName')->willReturn($name); + $mock->method('getVersion')->willReturn($version); + $mock->method('getApiVersion')->willReturn($apiVersion); + $mock->method('getFilePath')->willReturn('/path/to/plugin'); + $mock->method('getSignaturePath')->willReturn(null); + $mock->method('getHash')->willReturn($hash ?? PluginHash::create(PluginHash::SHA_512, 'hashy-corp')); + $mock->method('getRequirements')->willReturn(new PluginRequirements()); + + return $mock; } } diff --git a/tests/RepositoryLoaderTest.php b/tests/RepositoryLoaderTest.php index 1fe73d6..e47fae8 100644 --- a/tests/RepositoryLoaderTest.php +++ b/tests/RepositoryLoaderTest.php @@ -89,7 +89,7 @@ public function testUrlAndPathResolvingForTools( private function loadRepository(): RepositoryInterface { - $loader = $this->getMockForAbstractClass(JsonFileLoaderInterface::class); + $loader = $this->createMock(JsonFileLoaderInterface::class); $loader->method('load')->willReturnCallback( static function (string $url) { switch ($url) { From 0cc52d5bfc97e3cdc11c7acf45dd4f3fd1653a85 Mon Sep 17 00:00:00 2001 From: David Molineus Date: Mon, 9 Feb 2026 10:48:04 +0100 Subject: [PATCH 4/5] Normalize array key naming convention in hash test files --- tests/Plugin/PluginHashTest.php | 24 ++++++++++++------------ tests/Tool/ToolHashTest.php | 24 ++++++++++++------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/tests/Plugin/PluginHashTest.php b/tests/Plugin/PluginHashTest.php index 8297331..bf9506f 100644 --- a/tests/Plugin/PluginHashTest.php +++ b/tests/Plugin/PluginHashTest.php @@ -46,24 +46,24 @@ public static function equalsProvider(): array return [ 'equals with identical type and value' => [ 'expected' => true, - 'left_type' => PluginHash::SHA_1, - 'left_value' => 'content', - 'right_type' => PluginHash::SHA_1, - 'right_value' => 'content' + 'leftType' => PluginHash::SHA_1, + 'leftValue' => 'content', + 'rightType' => PluginHash::SHA_1, + 'rightValue' => 'content' ], 'does not equal with identical type but different value' => [ 'expected' => false, - 'left_type' => PluginHash::SHA_1, - 'left_value' => 'content', - 'right_type' => PluginHash::SHA_1, - 'right_value' => 'bar' + 'leftType' => PluginHash::SHA_1, + 'leftValue' => 'content', + 'rightType' => PluginHash::SHA_1, + 'rightValue' => 'bar' ], 'does not equal with different type but identical value' => [ 'expected' => false, - 'left_type' => PluginHash::SHA_1, - 'left_value' => 'content', - 'right_type' => PluginHash::SHA_256, - 'right_value' => 'bar' + 'leftType' => PluginHash::SHA_1, + 'leftValue' => 'content', + 'rightType' => PluginHash::SHA_256, + 'rightValue' => 'bar' ], ]; } diff --git a/tests/Tool/ToolHashTest.php b/tests/Tool/ToolHashTest.php index e5a26b9..86e4280 100644 --- a/tests/Tool/ToolHashTest.php +++ b/tests/Tool/ToolHashTest.php @@ -46,24 +46,24 @@ public static function equalsProvider(): array return [ 'equals with identical type and value' => [ 'expected' => true, - 'left_type' => ToolHash::SHA_1, - 'left_value' => 'content', - 'right_type' => ToolHash::SHA_1, - 'right_value' => 'content' + 'leftType' => ToolHash::SHA_1, + 'leftValue' => 'content', + 'rightType' => ToolHash::SHA_1, + 'rightValue' => 'content' ], 'does not equal with identical type but different value' => [ 'expected' => false, - 'left_type' => ToolHash::SHA_1, - 'left_value' => 'content', - 'right_type' => ToolHash::SHA_1, - 'right_value' => 'bar' + 'leftType' => ToolHash::SHA_1, + 'leftValue' => 'content', + 'rightType' => ToolHash::SHA_1, + 'rightValue' => 'bar' ], 'does not equal with different type but identical value' => [ 'expected' => false, - 'left_type' => ToolHash::SHA_1, - 'left_value' => 'content', - 'right_type' => ToolHash::SHA_256, - 'right_value' => 'bar' + 'leftType' => ToolHash::SHA_1, + 'leftValue' => 'content', + 'rightType' => ToolHash::SHA_256, + 'rightValue' => 'bar' ], ]; } From 82900e5c77388db1f67409f5a919c9c8e877dec4 Mon Sep 17 00:00:00 2001 From: David Molineus Date: Mon, 9 Feb 2026 11:12:40 +0100 Subject: [PATCH 5/5] Trust PHPCQ key --- .phpcq.yaml.dist | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.phpcq.yaml.dist b/.phpcq.yaml.dist index eab7e10..9e8e333 100644 --- a/.phpcq.yaml.dist +++ b/.phpcq.yaml.dist @@ -52,6 +52,8 @@ phpcq: - C00543248C87FB13 # PHPMD - 9093F8B32E4815AA + # PHPCQ + - 6659B17090D6C5D3 tasks: fix: