From bbd78052d76dc28f9c76ae57e8bb641e86143913 Mon Sep 17 00:00:00 2001 From: Ben Ramsey Date: Mon, 26 May 2025 01:54:17 -0500 Subject: [PATCH] chore(deps-dev): upgrade PHPUnit to v11.5 --- composer.json | 2 +- composer.lock | 667 ++++++++---------- phpunit.xml.dist | 16 +- psalm-baseline.xml | 0 psalm.xml | 0 tests/BinaryUtilsTest.php | 18 +- tests/Builder/FallbackBuilderTest.php | 6 +- .../Time/GenericTimeConverterTest.php | 11 +- tests/Converter/Time/PhpTimeConverterTest.php | 11 +- .../Converter/Time/UnixTimeConverterTest.php | 12 +- tests/ExpectedBehaviorTest.php | 176 ++--- tests/Generator/CombGeneratorTest.php | 6 +- tests/Generator/DceSecurityGeneratorTest.php | 6 +- tests/Generator/DefaultNameGeneratorTest.php | 6 +- tests/Generator/DefaultTimeGeneratorTest.php | 20 +- tests/Generator/PeclUuidNameGeneratorTest.php | 9 +- .../Generator/PeclUuidRandomGeneratorTest.php | 5 +- tests/Generator/PeclUuidTimeGeneratorTest.php | 5 +- tests/Generator/RandomBytesGeneratorTest.php | 18 +- tests/Generator/UnixTimeGeneratorTest.php | 56 +- tests/Guid/FieldsTest.php | 16 +- tests/Nonstandard/FieldsTest.php | 6 +- tests/Nonstandard/UuidV6Test.php | 20 +- .../Dce/SystemDceSecurityProviderTest.php | 92 +-- .../Provider/Node/RandomNodeProviderTest.php | 26 +- .../Provider/Node/StaticNodeProviderTest.php | 6 +- .../Provider/Node/SystemNodeProviderTest.php | 136 ++-- tests/Rfc4122/FieldsTest.php | 16 +- tests/Rfc4122/UuidBuilderTest.php | 6 +- tests/Rfc4122/UuidV1Test.php | 12 +- tests/Rfc4122/UuidV2Test.php | 12 +- tests/Rfc4122/UuidV3Test.php | 7 +- tests/Rfc4122/UuidV4Test.php | 7 +- tests/Rfc4122/UuidV5Test.php | 7 +- tests/Rfc4122/UuidV6Test.php | 20 +- tests/Rfc4122/UuidV7Test.php | 12 +- tests/Rfc4122/UuidV8Test.php | 7 +- tests/Rfc4122/ValidatorTest.php | 7 +- tests/Rfc4122/VariantTraitTest.php | 13 +- tests/Type/DecimalTest.php | 35 +- tests/Type/HexadecimalTest.php | 17 +- tests/Type/IntegerTest.php | 26 +- tests/Type/TimeTest.php | 15 +- tests/UuidFactoryTest.php | 6 +- tests/UuidTest.php | 80 +-- tests/Validator/GenericValidatorTest.php | 7 +- 46 files changed, 740 insertions(+), 924 deletions(-) delete mode 100644 psalm-baseline.xml delete mode 100644 psalm.xml diff --git a/composer.json b/composer.json index cfa101e..bff4edb 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "phpstan/phpstan": "^2.1", "phpstan/phpstan-mockery": "^2.0", "phpstan/phpstan-phpunit": "^2.0", - "phpunit/phpunit": "^9.6", + "phpunit/phpunit": "^11.5", "slevomat/coding-standard": "^8.18", "squizlabs/php_codesniffer": "^3.13" }, diff --git a/composer.lock b/composer.lock index 96310d2..43fa360 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4cf836b6117ee9d096b4cbaf779f3958", + "content-hash": "1dd714ad3bd396f8cb8d4e0b5227acd7", "packages": [ { "name": "brick/math", @@ -417,76 +417,6 @@ }, "time": "2024-09-05T10:17:24+00:00" }, - { - "name": "doctrine/instantiator", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", - "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", - "shasum": "" - }, - "require": { - "php": "^8.1" - }, - "require-dev": { - "doctrine/coding-standard": "^11", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^1.2", - "phpstan/phpstan": "^1.9.4", - "phpstan/phpstan-phpunit": "^1.3", - "phpunit/phpunit": "^9.5.27", - "vimeo/psalm": "^5.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "https://ocramius.github.io/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", - "keywords": [ - "constructor", - "instantiate" - ], - "support": { - "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/2.0.0" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", - "type": "tidelift" - } - ], - "time": "2022-12-30T00:23:10+00:00" - }, { "name": "doctrine/lexer", "version": "3.0.1", @@ -2256,35 +2186,35 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.32", + "version": "11.0.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5" + "reference": "14d63fbcca18457e49c6f8bebaa91a87e8e188d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/85402a822d1ecf1db1096959413d35e1c37cf1a5", - "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/14d63fbcca18457e49c6f8bebaa91a87e8e188d7", + "reference": "14d63fbcca18457e49c6f8bebaa91a87e8e188d7", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.19.1 || ^5.1.0", - "php": ">=7.3", - "phpunit/php-file-iterator": "^3.0.6", - "phpunit/php-text-template": "^2.0.4", - "sebastian/code-unit-reverse-lookup": "^2.0.3", - "sebastian/complexity": "^2.0.3", - "sebastian/environment": "^5.1.5", - "sebastian/lines-of-code": "^1.0.4", - "sebastian/version": "^3.0.2", + "nikic/php-parser": "^5.4.0", + "php": ">=8.2", + "phpunit/php-file-iterator": "^5.1.0", + "phpunit/php-text-template": "^4.0.1", + "sebastian/code-unit-reverse-lookup": "^4.0.1", + "sebastian/complexity": "^4.0.1", + "sebastian/environment": "^7.2.0", + "sebastian/lines-of-code": "^3.0.1", + "sebastian/version": "^5.0.2", "theseer/tokenizer": "^1.2.3" }, "require-dev": { - "phpunit/phpunit": "^9.6" + "phpunit/phpunit": "^11.5.2" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -2293,7 +2223,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "9.2.x-dev" + "dev-main": "11.0.x-dev" } }, "autoload": { @@ -2322,7 +2252,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.32" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.9" }, "funding": [ { @@ -2330,32 +2260,32 @@ "type": "github" } ], - "time": "2024-08-22T04:23:01+00:00" + "time": "2025-02-25T13:26:39+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "3.0.6", + "version": "5.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" + "reference": "118cfaaa8bc5aef3287bf315b6060b1174754af6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/118cfaaa8bc5aef3287bf315b6060b1174754af6", + "reference": "118cfaaa8bc5aef3287bf315b6060b1174754af6", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -2382,7 +2312,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" + "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/5.1.0" }, "funding": [ { @@ -2390,28 +2321,28 @@ "type": "github" } ], - "time": "2021-12-02T12:48:52+00:00" + "time": "2024-08-27T05:02:59+00:00" }, { "name": "phpunit/php-invoker", - "version": "3.1.1", + "version": "5.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" + "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/c1ca3814734c07492b3d4c5f794f4b0995333da2", + "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { "ext-pcntl": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "suggest": { "ext-pcntl": "*" @@ -2419,7 +2350,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -2445,7 +2376,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-invoker/issues", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + "security": "https://github.com/sebastianbergmann/php-invoker/security/policy", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/5.0.1" }, "funding": [ { @@ -2453,32 +2385,32 @@ "type": "github" } ], - "time": "2020-09-28T05:58:55+00:00" + "time": "2024-07-03T05:07:44+00:00" }, { "name": "phpunit/php-text-template", - "version": "2.0.4", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/3e0404dc6b300e6bf56415467ebcb3fe4f33e964", + "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -2504,7 +2436,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/4.0.1" }, "funding": [ { @@ -2512,32 +2445,32 @@ "type": "github" } ], - "time": "2020-10-26T05:33:50+00:00" + "time": "2024-07-03T05:08:43+00:00" }, { "name": "phpunit/php-timer", - "version": "5.0.3", + "version": "7.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" + "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3b415def83fbcb41f991d9ebf16ae4ad8b7837b3", + "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -2563,7 +2496,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + "security": "https://github.com/sebastianbergmann/php-timer/security/policy", + "source": "https://github.com/sebastianbergmann/php-timer/tree/7.0.1" }, "funding": [ { @@ -2571,24 +2505,23 @@ "type": "github" } ], - "time": "2020-10-26T13:16:10+00:00" + "time": "2024-07-03T05:09:35+00:00" }, { "name": "phpunit/phpunit", - "version": "9.6.23", + "version": "11.5.21", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "43d2cb18d0675c38bd44982a5d1d88f6d53d8d95" + "reference": "d565e2cdc21a7db9dc6c399c1fc2083b8010f289" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/43d2cb18d0675c38bd44982a5d1d88f6d53d8d95", - "reference": "43d2cb18d0675c38bd44982a5d1d88f6d53d8d95", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d565e2cdc21a7db9dc6c399c1fc2083b8010f289", + "reference": "d565e2cdc21a7db9dc6c399c1fc2083b8010f289", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.5.0 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", @@ -2598,27 +2531,26 @@ "myclabs/deep-copy": "^1.13.1", "phar-io/manifest": "^2.0.4", "phar-io/version": "^3.2.1", - "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.32", - "phpunit/php-file-iterator": "^3.0.6", - "phpunit/php-invoker": "^3.1.1", - "phpunit/php-text-template": "^2.0.4", - "phpunit/php-timer": "^5.0.3", - "sebastian/cli-parser": "^1.0.2", - "sebastian/code-unit": "^1.0.8", - "sebastian/comparator": "^4.0.8", - "sebastian/diff": "^4.0.6", - "sebastian/environment": "^5.1.5", - "sebastian/exporter": "^4.0.6", - "sebastian/global-state": "^5.0.7", - "sebastian/object-enumerator": "^4.0.4", - "sebastian/resource-operations": "^3.0.4", - "sebastian/type": "^3.2.1", - "sebastian/version": "^3.0.2" + "php": ">=8.2", + "phpunit/php-code-coverage": "^11.0.9", + "phpunit/php-file-iterator": "^5.1.0", + "phpunit/php-invoker": "^5.0.1", + "phpunit/php-text-template": "^4.0.1", + "phpunit/php-timer": "^7.0.1", + "sebastian/cli-parser": "^3.0.2", + "sebastian/code-unit": "^3.0.3", + "sebastian/comparator": "^6.3.1", + "sebastian/diff": "^6.0.2", + "sebastian/environment": "^7.2.1", + "sebastian/exporter": "^6.3.0", + "sebastian/global-state": "^7.0.2", + "sebastian/object-enumerator": "^6.0.1", + "sebastian/type": "^5.1.2", + "sebastian/version": "^5.0.2", + "staabm/side-effects-detector": "^1.0.5" }, "suggest": { - "ext-soap": "To be able to generate mocks based on WSDL files", - "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" + "ext-soap": "To be able to generate mocks based on WSDL files" }, "bin": [ "phpunit" @@ -2626,7 +2558,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.6-dev" + "dev-main": "11.5-dev" } }, "autoload": { @@ -2658,7 +2590,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.23" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.21" }, "funding": [ { @@ -2682,7 +2614,7 @@ "type": "tidelift" } ], - "time": "2025-05-02T06:40:34+00:00" + "time": "2025-05-21T12:35:00+00:00" }, { "name": "psr/cache", @@ -2838,28 +2770,28 @@ }, { "name": "sebastian/cli-parser", - "version": "1.0.2", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b" + "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b", - "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/15c5dd40dc4f38794d383bb95465193f5e0ae180", + "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -2882,7 +2814,8 @@ "homepage": "https://github.com/sebastianbergmann/cli-parser", "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2" + "security": "https://github.com/sebastianbergmann/cli-parser/security/policy", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/3.0.2" }, "funding": [ { @@ -2890,32 +2823,32 @@ "type": "github" } ], - "time": "2024-03-02T06:27:43+00:00" + "time": "2024-07-03T04:41:36+00:00" }, { "name": "sebastian/code-unit", - "version": "1.0.8", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + "reference": "54391c61e4af8078e5b276ab082b6d3c54c9ad64" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/54391c61e4af8078e5b276ab082b6d3c54c9ad64", + "reference": "54391c61e4af8078e5b276ab082b6d3c54c9ad64", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -2938,7 +2871,8 @@ "homepage": "https://github.com/sebastianbergmann/code-unit", "support": { "issues": "https://github.com/sebastianbergmann/code-unit/issues", - "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + "security": "https://github.com/sebastianbergmann/code-unit/security/policy", + "source": "https://github.com/sebastianbergmann/code-unit/tree/3.0.3" }, "funding": [ { @@ -2946,32 +2880,32 @@ "type": "github" } ], - "time": "2020-10-26T13:08:54+00:00" + "time": "2025-03-19T07:56:08+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "2.0.3", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + "reference": "183a9b2632194febd219bb9246eee421dad8d45e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/183a9b2632194febd219bb9246eee421dad8d45e", + "reference": "183a9b2632194febd219bb9246eee421dad8d45e", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -2993,7 +2927,8 @@ "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", "support": { "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + "security": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/security/policy", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/4.0.1" }, "funding": [ { @@ -3001,34 +2936,39 @@ "type": "github" } ], - "time": "2020-09-28T05:30:19+00:00" + "time": "2024-07-03T04:45:54+00:00" }, { "name": "sebastian/comparator", - "version": "4.0.8", + "version": "6.3.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a" + "reference": "24b8fbc2c8e201bb1308e7b05148d6ab393b6959" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/24b8fbc2c8e201bb1308e7b05148d6ab393b6959", + "reference": "24b8fbc2c8e201bb1308e7b05148d6ab393b6959", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/diff": "^4.0", - "sebastian/exporter": "^4.0" + "ext-dom": "*", + "ext-mbstring": "*", + "php": ">=8.2", + "sebastian/diff": "^6.0", + "sebastian/exporter": "^6.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.4" + }, + "suggest": { + "ext-bcmath": "For comparing BcMath\\Number objects" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.3-dev" } }, "autoload": { @@ -3067,7 +3007,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" + "security": "https://github.com/sebastianbergmann/comparator/security/policy", + "source": "https://github.com/sebastianbergmann/comparator/tree/6.3.1" }, "funding": [ { @@ -3075,33 +3016,33 @@ "type": "github" } ], - "time": "2022-09-14T12:41:17+00:00" + "time": "2025-03-07T06:57:01+00:00" }, { "name": "sebastian/complexity", - "version": "2.0.3", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a" + "reference": "ee41d384ab1906c68852636b6de493846e13e5a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/25f207c40d62b8b7aa32f5ab026c53561964053a", - "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/ee41d384ab1906c68852636b6de493846e13e5a0", + "reference": "ee41d384ab1906c68852636b6de493846e13e5a0", "shasum": "" }, "require": { - "nikic/php-parser": "^4.18 || ^5.0", - "php": ">=7.3" + "nikic/php-parser": "^5.0", + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -3124,7 +3065,8 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.3" + "security": "https://github.com/sebastianbergmann/complexity/security/policy", + "source": "https://github.com/sebastianbergmann/complexity/tree/4.0.1" }, "funding": [ { @@ -3132,33 +3074,33 @@ "type": "github" } ], - "time": "2023-12-22T06:19:30+00:00" + "time": "2024-07-03T04:49:50+00:00" }, { "name": "sebastian/diff", - "version": "4.0.6", + "version": "6.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" + "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", - "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/b4ccd857127db5d41a5b676f24b51371d76d8544", + "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3", + "phpunit/phpunit": "^11.0", "symfony/process": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -3190,7 +3132,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" + "security": "https://github.com/sebastianbergmann/diff/security/policy", + "source": "https://github.com/sebastianbergmann/diff/tree/6.0.2" }, "funding": [ { @@ -3198,27 +3141,27 @@ "type": "github" } ], - "time": "2024-03-02T06:30:58+00:00" + "time": "2024-07-03T04:53:05+00:00" }, { "name": "sebastian/environment", - "version": "5.1.5", + "version": "7.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" + "reference": "a5c75038693ad2e8d4b6c15ba2403532647830c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/a5c75038693ad2e8d4b6c15ba2403532647830c4", + "reference": "a5c75038693ad2e8d4b6c15ba2403532647830c4", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.3" }, "suggest": { "ext-posix": "*" @@ -3226,7 +3169,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.1-dev" + "dev-main": "7.2-dev" } }, "autoload": { @@ -3245,7 +3188,7 @@ } ], "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", + "homepage": "https://github.com/sebastianbergmann/environment", "keywords": [ "Xdebug", "environment", @@ -3253,42 +3196,55 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" + "security": "https://github.com/sebastianbergmann/environment/security/policy", + "source": "https://github.com/sebastianbergmann/environment/tree/7.2.1" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/environment", + "type": "tidelift" } ], - "time": "2023-02-03T06:03:51+00:00" + "time": "2025-05-21T11:55:47+00:00" }, { "name": "sebastian/exporter", - "version": "4.0.6", + "version": "6.3.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72" + "reference": "3473f61172093b2da7de1fb5782e1f24cc036dc3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72", - "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/3473f61172093b2da7de1fb5782e1f24cc036dc3", + "reference": "3473f61172093b2da7de1fb5782e1f24cc036dc3", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/recursion-context": "^4.0" + "ext-mbstring": "*", + "php": ">=8.2", + "sebastian/recursion-context": "^6.0" }, "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.1-dev" } }, "autoload": { @@ -3330,7 +3286,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6" + "security": "https://github.com/sebastianbergmann/exporter/security/policy", + "source": "https://github.com/sebastianbergmann/exporter/tree/6.3.0" }, "funding": [ { @@ -3338,38 +3295,35 @@ "type": "github" } ], - "time": "2024-03-02T06:33:00+00:00" + "time": "2024-12-05T09:17:50+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.7", + "version": "7.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" + "reference": "3be331570a721f9a4b5917f4209773de17f747d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", - "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/3be331570a721f9a4b5917f4209773de17f747d7", + "reference": "3be331570a721f9a4b5917f4209773de17f747d7", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.2", + "sebastian/object-reflector": "^4.0", + "sebastian/recursion-context": "^6.0" }, "require-dev": { "ext-dom": "*", - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-uopz": "*" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -3388,13 +3342,14 @@ } ], "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", + "homepage": "https://www.github.com/sebastianbergmann/global-state", "keywords": [ "global state" ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" + "security": "https://github.com/sebastianbergmann/global-state/security/policy", + "source": "https://github.com/sebastianbergmann/global-state/tree/7.0.2" }, "funding": [ { @@ -3402,33 +3357,33 @@ "type": "github" } ], - "time": "2024-03-02T06:35:11+00:00" + "time": "2024-07-03T04:57:36+00:00" }, { "name": "sebastian/lines-of-code", - "version": "1.0.4", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5" + "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e1e4a170560925c26d424b6a03aed157e7dcc5c5", - "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/d36ad0d782e5756913e42ad87cb2890f4ffe467a", + "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a", "shasum": "" }, "require": { - "nikic/php-parser": "^4.18 || ^5.0", - "php": ">=7.3" + "nikic/php-parser": "^5.0", + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -3451,7 +3406,8 @@ "homepage": "https://github.com/sebastianbergmann/lines-of-code", "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.4" + "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/3.0.1" }, "funding": [ { @@ -3459,34 +3415,34 @@ "type": "github" } ], - "time": "2023-12-22T06:20:34+00:00" + "time": "2024-07-03T04:58:38+00:00" }, { "name": "sebastian/object-enumerator", - "version": "4.0.4", + "version": "6.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + "reference": "f5b498e631a74204185071eb41f33f38d64608aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/f5b498e631a74204185071eb41f33f38d64608aa", + "reference": "f5b498e631a74204185071eb41f33f38d64608aa", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.2", + "sebastian/object-reflector": "^4.0", + "sebastian/recursion-context": "^6.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -3508,7 +3464,8 @@ "homepage": "https://github.com/sebastianbergmann/object-enumerator/", "support": { "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + "security": "https://github.com/sebastianbergmann/object-enumerator/security/policy", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/6.0.1" }, "funding": [ { @@ -3516,32 +3473,32 @@ "type": "github" } ], - "time": "2020-10-26T13:12:34+00:00" + "time": "2024-07-03T05:00:13+00:00" }, { "name": "sebastian/object-reflector", - "version": "2.0.4", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/6e1a43b411b2ad34146dee7524cb13a068bb35f9", + "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -3563,7 +3520,8 @@ "homepage": "https://github.com/sebastianbergmann/object-reflector/", "support": { "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + "security": "https://github.com/sebastianbergmann/object-reflector/security/policy", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/4.0.1" }, "funding": [ { @@ -3571,32 +3529,32 @@ "type": "github" } ], - "time": "2020-10-26T13:14:26+00:00" + "time": "2024-07-03T05:01:32+00:00" }, { "name": "sebastian/recursion-context", - "version": "4.0.5", + "version": "6.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" + "reference": "694d156164372abbd149a4b85ccda2e4670c0e16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/694d156164372abbd149a4b85ccda2e4670c0e16", + "reference": "694d156164372abbd149a4b85ccda2e4670c0e16", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -3626,7 +3584,8 @@ "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" + "security": "https://github.com/sebastianbergmann/recursion-context/security/policy", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/6.0.2" }, "funding": [ { @@ -3634,86 +3593,32 @@ "type": "github" } ], - "time": "2023-02-03T06:07:39+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "3.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e", - "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "support": { - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-03-14T16:00:52+00:00" + "time": "2024-07-03T05:10:34+00:00" }, { "name": "sebastian/type", - "version": "3.2.1", + "version": "5.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" + "reference": "a8a7e30534b0eb0c77cd9d07e82de1a114389f5e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/a8a7e30534b0eb0c77cd9d07e82de1a114389f5e", + "reference": "a8a7e30534b0eb0c77cd9d07e82de1a114389f5e", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^11.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -3736,7 +3641,8 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" + "security": "https://github.com/sebastianbergmann/type/security/policy", + "source": "https://github.com/sebastianbergmann/type/tree/5.1.2" }, "funding": [ { @@ -3744,29 +3650,29 @@ "type": "github" } ], - "time": "2023-02-03T06:13:03+00:00" + "time": "2025-03-18T13:35:50+00:00" }, { "name": "sebastian/version", - "version": "3.0.2", + "version": "5.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c6c1022351a901512170118436c764e473f6de8c" + "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", - "reference": "c6c1022351a901512170118436c764e473f6de8c", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c687e3387b99f5b03b6caa64c74b63e2936ff874", + "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -3789,7 +3695,8 @@ "homepage": "https://github.com/sebastianbergmann/version", "support": { "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + "security": "https://github.com/sebastianbergmann/version/security/policy", + "source": "https://github.com/sebastianbergmann/version/tree/5.0.2" }, "funding": [ { @@ -3797,7 +3704,7 @@ "type": "github" } ], - "time": "2020-09-28T06:39:44+00:00" + "time": "2024-10-09T05:16:32+00:00" }, { "name": "sebastianfeldmann/camino", @@ -4188,6 +4095,58 @@ ], "time": "2025-05-11T03:36:00+00:00" }, + { + "name": "staabm/side-effects-detector", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/staabm/side-effects-detector.git", + "reference": "d8334211a140ce329c13726d4a715adbddd0a163" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/staabm/side-effects-detector/zipball/d8334211a140ce329c13726d4a715adbddd0a163", + "reference": "d8334211a140ce329c13726d4a715adbddd0a163", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpstan/extension-installer": "^1.4.3", + "phpstan/phpstan": "^1.12.6", + "phpunit/phpunit": "^9.6.21", + "symfony/var-dumper": "^5.4.43", + "tomasvotruba/type-coverage": "1.0.0", + "tomasvotruba/unused-public": "1.0.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "lib/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A static analysis tool to detect side effects in PHP code", + "keywords": [ + "static analysis" + ], + "support": { + "issues": "https://github.com/staabm/side-effects-detector/issues", + "source": "https://github.com/staabm/side-effects-detector/tree/1.0.5" + }, + "funding": [ + { + "url": "https://github.com/staabm", + "type": "github" + } + ], + "time": "2024-10-20T05:08:20+00:00" + }, { "name": "symfony/console", "version": "v7.2.6", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 14e81da..5c9cab4 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,10 +1,9 @@ + cacheDirectory="./build/cache/phpunit"> @@ -12,15 +11,12 @@ - + + + ./src - - - - - - + diff --git a/psalm-baseline.xml b/psalm-baseline.xml deleted file mode 100644 index e69de29..0000000 diff --git a/psalm.xml b/psalm.xml deleted file mode 100644 index e69de29..0000000 diff --git a/tests/BinaryUtilsTest.php b/tests/BinaryUtilsTest.php index 537fae4..a5721d4 100644 --- a/tests/BinaryUtilsTest.php +++ b/tests/BinaryUtilsTest.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test; +use PHPUnit\Framework\Attributes\DataProvider; use Ramsey\Uuid\BinaryUtils; use Ramsey\Uuid\Rfc4122\Version; use Ramsey\Uuid\Variant; @@ -14,18 +15,14 @@ use function hex2bin; class BinaryUtilsTest extends TestCase { - /** - * @dataProvider provideVersionTestValues - */ + #[DataProvider('provideVersionTestValues')] public function testApplyVersion(int $timeHi, Version $version, int $expectedInt, string $expectedHex): void { $this->assertSame($expectedInt, BinaryUtils::applyVersion($timeHi, $version)); $this->assertSame($expectedHex, dechex(BinaryUtils::applyVersion($timeHi, $version))); } - /** - * @dataProvider provideVariantTestValues - */ + #[DataProvider('provideVariantTestValues')] public function testApplyVariant(int $clockSeq, Variant $variant, int $expectedInt, string $expectedHex): void { $this->assertSame($expectedInt, BinaryUtils::applyVariant($clockSeq, $variant)); @@ -34,9 +31,8 @@ class BinaryUtilsTest extends TestCase /** * @param non-empty-string $bytes - * - * @dataProvider provideVersionAndVariantTestValues */ + #[DataProvider('provideVersionAndVariantTestValues')] public function testApplyVersionAndVariant( string $bytes, Version $version, @@ -48,7 +44,7 @@ class BinaryUtilsTest extends TestCase /** * @return array */ - public function provideVersionTestValues(): array + public static function provideVersionTestValues(): array { return [ [ @@ -201,7 +197,7 @@ class BinaryUtilsTest extends TestCase /** * @return array */ - public function provideVariantTestValues(): array + public static function provideVariantTestValues(): array { return [ [ @@ -330,7 +326,7 @@ class BinaryUtilsTest extends TestCase /** * @return array */ - public function provideVersionAndVariantTestValues(): array + public static function provideVersionAndVariantTestValues(): array { /** @var non-empty-string $bytes */ $bytes = hex2bin('426a25b74e975e743af1700fa4e42455'); diff --git a/tests/Builder/FallbackBuilderTest.php b/tests/Builder/FallbackBuilderTest.php index 3e7b17b..267ce19 100644 --- a/tests/Builder/FallbackBuilderTest.php +++ b/tests/Builder/FallbackBuilderTest.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test\Builder; use Mockery; +use PHPUnit\Framework\Attributes\DataProvider; use Ramsey\Uuid\Builder\FallbackBuilder; use Ramsey\Uuid\Builder\UuidBuilderInterface; use Ramsey\Uuid\Codec\CodecInterface; @@ -63,9 +64,8 @@ class FallbackBuilderTest extends TestCase /** * @param non-empty-string $bytes - * - * @dataProvider provideBytes */ + #[DataProvider('provideBytes')] public function testSerializationOfBuilderCollection(string $bytes): void { $calculator = new BrickMathCalculator(); @@ -121,7 +121,7 @@ class FallbackBuilderTest extends TestCase /** * @return array */ - public function provideBytes(): array + public static function provideBytes(): array { return [ [ diff --git a/tests/Converter/Time/GenericTimeConverterTest.php b/tests/Converter/Time/GenericTimeConverterTest.php index 748d602..dccc512 100644 --- a/tests/Converter/Time/GenericTimeConverterTest.php +++ b/tests/Converter/Time/GenericTimeConverterTest.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test\Converter\Time; +use PHPUnit\Framework\Attributes\DataProvider; use Ramsey\Uuid\Converter\Time\GenericTimeConverter; use Ramsey\Uuid\Math\BrickMathCalculator; use Ramsey\Uuid\Test\TestCase; @@ -15,9 +16,8 @@ class GenericTimeConverterTest extends TestCase * @param numeric-string $seconds * @param numeric-string $microseconds * @param non-empty-string $expected - * - * @dataProvider provideCalculateTime */ + #[DataProvider('provideCalculateTime')] public function testCalculateTime(string $seconds, string $microseconds, string $expected): void { $calculator = new BrickMathCalculator(); @@ -31,7 +31,7 @@ class GenericTimeConverterTest extends TestCase /** * @return array */ - public function provideCalculateTime(): array + public static function provideCalculateTime(): array { return [ [ @@ -86,9 +86,8 @@ class GenericTimeConverterTest extends TestCase /** * @param numeric-string $unixTimestamp * @param numeric-string $microseconds - * - * @dataProvider provideConvertTime */ + #[DataProvider('provideConvertTime')] public function testConvertTime(Hexadecimal $uuidTimestamp, string $unixTimestamp, string $microseconds): void { $calculator = new BrickMathCalculator(); @@ -103,7 +102,7 @@ class GenericTimeConverterTest extends TestCase /** * @return array */ - public function provideConvertTime(): array + public static function provideConvertTime(): array { return [ [ diff --git a/tests/Converter/Time/PhpTimeConverterTest.php b/tests/Converter/Time/PhpTimeConverterTest.php index 073a475..55ae249 100644 --- a/tests/Converter/Time/PhpTimeConverterTest.php +++ b/tests/Converter/Time/PhpTimeConverterTest.php @@ -6,6 +6,7 @@ namespace Ramsey\Uuid\Test\Converter\Time; use Brick\Math\BigInteger; use Mockery; +use PHPUnit\Framework\Attributes\DataProvider; use Ramsey\Uuid\Converter\Time\GenericTimeConverter; use Ramsey\Uuid\Converter\Time\PhpTimeConverter; use Ramsey\Uuid\Exception\InvalidArgumentException; @@ -79,9 +80,8 @@ class PhpTimeConverterTest extends TestCase /** * @param numeric-string $unixTimestamp * @param numeric-string $microseconds - * - * @dataProvider provideConvertTime */ + #[DataProvider('provideConvertTime')] public function testConvertTime(Hexadecimal $uuidTimestamp, string $unixTimestamp, string $microseconds): void { $calculator = new BrickMathCalculator(); @@ -97,7 +97,7 @@ class PhpTimeConverterTest extends TestCase /** * @return array */ - public function provideConvertTime(): array + public static function provideConvertTime(): array { return [ [ @@ -147,9 +147,8 @@ class PhpTimeConverterTest extends TestCase * @param numeric-string $seconds * @param numeric-string $microseconds * @param non-empty-string $expected - * - * @dataProvider provideCalculateTime */ + #[DataProvider('provideCalculateTime')] public function testCalculateTime(string $seconds, string $microseconds, string $expected): void { $calculator = new BrickMathCalculator(); @@ -164,7 +163,7 @@ class PhpTimeConverterTest extends TestCase /** * @return array */ - public function provideCalculateTime(): array + public static function provideCalculateTime(): array { return [ [ diff --git a/tests/Converter/Time/UnixTimeConverterTest.php b/tests/Converter/Time/UnixTimeConverterTest.php index a8ecd8a..d23e08a 100644 --- a/tests/Converter/Time/UnixTimeConverterTest.php +++ b/tests/Converter/Time/UnixTimeConverterTest.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test\Converter\Time; +use PHPUnit\Framework\Attributes\DataProvider; use Ramsey\Uuid\Converter\Time\UnixTimeConverter; use Ramsey\Uuid\Math\BrickMathCalculator; use Ramsey\Uuid\Test\TestCase; @@ -11,9 +12,7 @@ use Ramsey\Uuid\Type\Hexadecimal; class UnixTimeConverterTest extends TestCase { - /** - * @dataProvider provideConvertTime - */ + #[DataProvider('provideConvertTime')] public function testConvertTime(Hexadecimal $uuidTimestamp, string $unixTimestamp, string $microseconds): void { $calculator = new BrickMathCalculator(); @@ -28,7 +27,7 @@ class UnixTimeConverterTest extends TestCase /** * @return array */ - public function provideConvertTime(): array + public static function provideConvertTime(): array { return [ [ @@ -106,9 +105,8 @@ class UnixTimeConverterTest extends TestCase * @param numeric-string $seconds * @param numeric-string $microseconds * @param non-empty-string $expected - * - * @dataProvider provideCalculateTime */ + #[DataProvider('provideCalculateTime')] public function testCalculateTime(string $seconds, string $microseconds, string $expected): void { $calculator = new BrickMathCalculator(); @@ -122,7 +120,7 @@ class UnixTimeConverterTest extends TestCase /** * @return array */ - public function provideCalculateTime(): array + public static function provideCalculateTime(): array { return [ [ diff --git a/tests/ExpectedBehaviorTest.php b/tests/ExpectedBehaviorTest.php index 58518fe..bc612bc 100644 --- a/tests/ExpectedBehaviorTest.php +++ b/tests/ExpectedBehaviorTest.php @@ -2,6 +2,10 @@ namespace Ramsey\Uuid\Test; +use Mockery; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; use Ramsey\Uuid\Codec\TimestampFirstCombCodec; use Ramsey\Uuid\Generator\CombGenerator; use Ramsey\Uuid\Generator\DefaultTimeGenerator; @@ -31,13 +35,12 @@ class ExpectedBehaviorTest extends TestCase { /** * @param mixed[] $args - * - * @dataProvider provideStaticCreationMethods */ + #[DataProvider('provideStaticCreationMethods')] public function testStaticCreationMethodsAndStandardBehavior(string $method, array $args): void { /** @var UuidInterface $uuid */ - $uuid = call_user_func_array(['Ramsey\Uuid\Uuid', $method], $args); + $uuid = Uuid::$method(...$args); $this->assertIsInt($uuid->compareTo(Uuid::uuid1())); $this->assertNotSame(0, $uuid->compareTo(Uuid::uuid4())); @@ -85,7 +88,10 @@ class ExpectedBehaviorTest extends TestCase $this->assertSame(1, preg_match('/^\d+$/', (string) $uuid->getInteger())); } - public function provideStaticCreationMethods() + /** + * @return array + */ + public static function provideStaticCreationMethods(): array { return [ ['uuid1', []], @@ -102,10 +108,10 @@ class ExpectedBehaviorTest extends TestCase ]; } - public function testUuidVersion1MethodBehavior() + public function testUuidVersion1MethodBehavior(): void { /** @var UuidV1 $uuid */ - $uuid = Uuid::uuid1('00000fffffff', 0xffff); + $uuid = Uuid::uuid1('00000fffffff', 0x3fff); $this->assertInstanceOf('DateTimeInterface', $uuid->getDateTime()); $this->assertSame('00000fffffff', $uuid->getFields()->getNode()->toString()); @@ -113,15 +119,19 @@ class ExpectedBehaviorTest extends TestCase } /** - * @dataProvider provideIsValid + * @param non-empty-string $uuid */ - public function testIsValid($uuid, $expected) + #[DataProvider('provideIsValid')] + public function testIsValid(string $uuid, bool $expected): void { $this->assertSame($expected, Uuid::isValid($uuid), "{$uuid} is not a valid UUID"); $this->assertSame($expected, Uuid::isValid(strtoupper($uuid)), strtoupper($uuid) . ' is not a valid UUID'); } - public function provideIsValid() + /** + * @return array + */ + public static function provideIsValid(): array { return [ // RFC 4122 UUIDs @@ -169,7 +179,7 @@ class ExpectedBehaviorTest extends TestCase // Invalid UUIDs ['ffffffffffffffffffffffffffffffff', false], ['00000000000000000000000000000000', false], - [0, false], + ['0', false], ['foobar', false], ['ff6f8cb0c57d51e1bb210800200c9a66', false], ['gf6f8cb0-c57d-51e1-bb21-0800200c9a66', false], @@ -177,9 +187,11 @@ class ExpectedBehaviorTest extends TestCase } /** - * @dataProvider provideFromStringInteger + * @param non-empty-string $string + * @param numeric-string $integer */ - public function testSerialization(string $string): void + #[DataProvider('provideFromStringInteger')] + public function testSerialization(string $string, ?int $version, int $variant, string $integer): void { $uuid = Uuid::fromString($string); @@ -194,18 +206,20 @@ class ExpectedBehaviorTest extends TestCase } /** - * @dataProvider provideFromStringInteger + * @param non-empty-string $string + * @param numeric-string $integer */ + #[DataProvider('provideFromStringInteger')] public function testFromBytes(string $string, ?int $version, int $variant, string $integer): void { + /** @var non-empty-string $bytes */ $bytes = hex2bin(str_replace('-', '', $string)); /** @var UuidInterface $uuid */ - $uuid = Uuid::fromBytes((string) $bytes); + $uuid = Uuid::fromBytes($bytes); - $this->assertInstanceOf('Ramsey\Uuid\UuidInterface', $uuid); $this->assertSame($string, $uuid->toString()); - $this->assertSame(Version::tryFrom($version), $uuid->getFields()->getVersion()); + $this->assertSame(Version::tryFrom($version ?? 0), $uuid->getFields()->getVersion()); $this->assertSame(Variant::from($variant), $uuid->getFields()->getVariant()); $components = explode('-', $string); @@ -224,8 +238,10 @@ class ExpectedBehaviorTest extends TestCase } /** - * @dataProvider provideFromStringInteger + * @param non-empty-string $string + * @param numeric-string $integer */ + #[DataProvider('provideFromStringInteger')] public function testFromInteger(string $string, ?int $version, int $variant, string $integer): void { $bytes = hex2bin(str_replace('-', '', $string)); @@ -233,9 +249,8 @@ class ExpectedBehaviorTest extends TestCase /** @var UuidInterface $uuid */ $uuid = Uuid::fromInteger($integer); - $this->assertInstanceOf('Ramsey\Uuid\UuidInterface', $uuid); $this->assertSame($string, $uuid->toString()); - $this->assertSame(Version::tryFrom($version), $uuid->getFields()->getVersion()); + $this->assertSame(Version::tryFrom($version ?? 0), $uuid->getFields()->getVersion()); $this->assertSame(Variant::from($variant), $uuid->getFields()->getVariant()); $components = explode('-', $string); @@ -254,8 +269,10 @@ class ExpectedBehaviorTest extends TestCase } /** - * @dataProvider provideFromStringInteger + * @param non-empty-string $string + * @param numeric-string $integer */ + #[DataProvider('provideFromStringInteger')] public function testFromString(string $string, ?int $version, int $variant, string $integer): void { $bytes = hex2bin(str_replace('-', '', $string)); @@ -263,9 +280,8 @@ class ExpectedBehaviorTest extends TestCase /** @var UuidInterface $uuid */ $uuid = Uuid::fromString($string); - $this->assertInstanceOf('Ramsey\Uuid\UuidInterface', $uuid); $this->assertSame($string, $uuid->toString()); - $this->assertSame(Version::tryFrom($version), $uuid->getFields()->getVersion()); + $this->assertSame(Version::tryFrom($version ?? 0), $uuid->getFields()->getVersion()); $this->assertSame(Variant::from($variant), $uuid->getFields()->getVariant()); $components = explode('-', $string); @@ -283,7 +299,10 @@ class ExpectedBehaviorTest extends TestCase $this->assertSame($bytes, $uuid->getBytes()); } - public function provideFromStringInteger() + /** + * @return array + */ + public static function provideFromStringInteger(): array { return [ ['00000000-0000-0000-0000-000000000000', null, 2, '0'], @@ -323,29 +342,25 @@ class ExpectedBehaviorTest extends TestCase ]; } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ - public function testGetSetFactory() + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] + public function testGetSetFactory(): void { $this->assertInstanceOf('Ramsey\Uuid\UuidFactory', Uuid::getFactory()); - $factory = \Mockery::mock('Ramsey\Uuid\UuidFactory'); + $factory = Mockery::mock('Ramsey\Uuid\UuidFactory'); Uuid::setFactory($factory); $this->assertSame($factory, Uuid::getFactory()); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ - public function testFactoryProvidesFunctionality() + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] + public function testFactoryProvidesFunctionality(): void { - $uuid = \Mockery::mock('Ramsey\Uuid\UuidInterface'); + $uuid = Mockery::mock('Ramsey\Uuid\UuidInterface'); - $factory = \Mockery::mock('Ramsey\Uuid\UuidFactoryInterface', [ + $factory = Mockery::mock('Ramsey\Uuid\UuidFactoryInterface', [ 'uuid1' => $uuid, 'uuid3' => $uuid, 'uuid4' => $uuid, @@ -357,24 +372,25 @@ class ExpectedBehaviorTest extends TestCase Uuid::setFactory($factory); - $this->assertSame($uuid, Uuid::uuid1('ffffffffffff', 0xffff)); + /** @var non-empty-string $bytes */ + $bytes = hex2bin('ffffffffffffffffffffffffffffffff'); + + $this->assertSame($uuid, Uuid::uuid1('ffffffffffff', 0x3fff)); $this->assertSame($uuid, Uuid::uuid3(Uuid::NAMESPACE_URL, 'https://example.com/foo')); $this->assertSame($uuid, Uuid::uuid4()); $this->assertSame($uuid, Uuid::uuid5(Uuid::NAMESPACE_URL, 'https://example.com/foo')); - $this->assertSame($uuid, Uuid::fromBytes(hex2bin('ffffffffffffffffffffffffffffffff'))); + $this->assertSame($uuid, Uuid::fromBytes($bytes)); $this->assertSame($uuid, Uuid::fromString('ffffffff-ffff-ffff-ffff-ffffffffffff')); $this->assertSame($uuid, Uuid::fromInteger('340282366920938463463374607431768211455')); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ - public function testUsingCustomCodec() + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] + public function testUsingCustomCodec(): void { - $mockUuid = \Mockery::mock('Ramsey\Uuid\UuidInterface'); + $mockUuid = Mockery::mock('Ramsey\Uuid\UuidInterface'); - $codec = \Mockery::mock('Ramsey\Uuid\Codec\CodecInterface', [ + $codec = Mockery::mock('Ramsey\Uuid\Codec\CodecInterface', [ 'encode' => 'abcd1234', 'encodeBinary' => hex2bin('abcd1234'), 'decode' => $mockUuid, @@ -388,19 +404,20 @@ class ExpectedBehaviorTest extends TestCase $uuid = Uuid::uuid4(); + /** @var non-empty-string $bytes */ + $bytes = hex2bin('f00ba2'); + $this->assertSame('abcd1234', $uuid->toString()); $this->assertSame(hex2bin('abcd1234'), $uuid->getBytes()); $this->assertSame($mockUuid, Uuid::fromString('f00ba2')); - $this->assertSame($mockUuid, Uuid::fromBytes(hex2bin('f00ba2'))); + $this->assertSame($mockUuid, Uuid::fromBytes($bytes)); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ - public function testUsingCustomRandomGenerator() + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] + public function testUsingCustomRandomGenerator(): void { - $generator = \Mockery::mock('Ramsey\Uuid\Generator\RandomGeneratorInterface', [ + $generator = Mockery::mock('Ramsey\Uuid\Generator\RandomGeneratorInterface', [ 'generate' => hex2bin('01234567abcd5432dcba0123456789ab'), ]); @@ -414,13 +431,11 @@ class ExpectedBehaviorTest extends TestCase $this->assertSame('01234567-abcd-4432-9cba-0123456789ab', $uuid->toString()); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ - public function testUsingCustomTimeGenerator() + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] + public function testUsingCustomTimeGenerator(): void { - $generator = \Mockery::mock('Ramsey\Uuid\Generator\TimeGeneratorInterface', [ + $generator = Mockery::mock('Ramsey\Uuid\Generator\TimeGeneratorInterface', [ 'generate' => hex2bin('01234567abcd5432dcba0123456789ab'), ]); @@ -434,24 +449,22 @@ class ExpectedBehaviorTest extends TestCase $this->assertSame('01234567-abcd-1432-9cba-0123456789ab', $uuid->toString()); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ - public function testUsingDefaultTimeGeneratorWithCustomProviders() + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] + public function testUsingDefaultTimeGeneratorWithCustomProviders(): void { - $nodeProvider = \Mockery::mock('Ramsey\Uuid\Provider\NodeProviderInterface', [ + $nodeProvider = Mockery::mock('Ramsey\Uuid\Provider\NodeProviderInterface', [ 'getNode' => new Hexadecimal('0123456789ab'), ]); - $timeConverter = \Mockery::mock('Ramsey\Uuid\Converter\TimeConverterInterface'); + $timeConverter = Mockery::mock('Ramsey\Uuid\Converter\TimeConverterInterface'); $timeConverter ->shouldReceive('calculateTime') - ->andReturnUsing(function ($seconds, $microseconds) { + ->andReturnUsing(function (int $seconds, int $microseconds) { return new Hexadecimal('abcd' . dechex($microseconds) . dechex($seconds)); }); - $timeProvider = \Mockery::mock('Ramsey\Uuid\Provider\TimeProviderInterface', [ + $timeProvider = Mockery::mock('Ramsey\Uuid\Provider\TimeProviderInterface', [ 'currentTime' => [ 'sec' => 1578522046, 'usec' => 10000, @@ -471,26 +484,24 @@ class ExpectedBehaviorTest extends TestCase $this->assertSame('5e1655be-2710-1bcd-8fff-0123456789ab', $uuid->toString()); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ - public function testHelperFunctions() + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] + public function testHelperFunctions(): void { - $uuid1 = \Mockery::mock('Ramsey\Uuid\UuidInterface', [ + $uuid1 = Mockery::mock('Ramsey\Uuid\UuidInterface', [ 'toString' => 'aVersion1Uuid', ]); - $uuid3 = \Mockery::mock('Ramsey\Uuid\UuidInterface', [ + $uuid3 = Mockery::mock('Ramsey\Uuid\UuidInterface', [ 'toString' => 'aVersion3Uuid', ]); - $uuid4 = \Mockery::mock('Ramsey\Uuid\UuidInterface', [ + $uuid4 = Mockery::mock('Ramsey\Uuid\UuidInterface', [ 'toString' => 'aVersion4Uuid', ]); - $uuid5 = \Mockery::mock('Ramsey\Uuid\UuidInterface', [ + $uuid5 = Mockery::mock('Ramsey\Uuid\UuidInterface', [ 'toString' => 'aVersion5Uuid', ]); - $factory = \Mockery::mock('Ramsey\Uuid\UuidFactoryInterface', [ + $factory = Mockery::mock('Ramsey\Uuid\UuidFactoryInterface', [ 'uuid1' => $uuid1, 'uuid3' => $uuid3, 'uuid4' => $uuid4, @@ -499,7 +510,7 @@ class ExpectedBehaviorTest extends TestCase Uuid::setFactory($factory); - $this->assertSame('aVersion1Uuid', \Ramsey\Uuid\v1('ffffffffffff', 0xffff)); + $this->assertSame('aVersion1Uuid', \Ramsey\Uuid\v1('ffffffffffff', 0x3fff)); $this->assertSame('aVersion3Uuid', \Ramsey\Uuid\v3(Uuid::NAMESPACE_URL, 'https://example.com/foo')); $this->assertSame('aVersion4Uuid', \Ramsey\Uuid\v4()); $this->assertSame('aVersion5Uuid', \Ramsey\Uuid\v5(Uuid::NAMESPACE_URL, 'https://example.com/foo')); @@ -508,7 +519,7 @@ class ExpectedBehaviorTest extends TestCase /** * @link https://git.io/JvJZo Use of TimestampFirstCombCodec in laravel/framework */ - public function testUseOfTimestampFirstCombCodec() + public function testUseOfTimestampFirstCombCodec(): void { $factory = new UuidFactory(); @@ -541,16 +552,13 @@ class ExpectedBehaviorTest extends TestCase $expectedHex = implode('', $fields); $expectedBytes = hex2bin($expectedHex); - $this->assertInstanceOf('Ramsey\Uuid\UuidInterface', $uuid); $this->assertSame(Variant::Rfc4122, $uuid->getFields()->getVariant()); $this->assertSame(Version::Random, $uuid->getFields()->getVersion()); $this->assertSame($expectedBytes, $uuid->getBytes()); $this->assertSame($expectedHex, (string) $uuid->getHex()); } - /** - * @dataProvider provideUuidConstantTests - */ + #[DataProvider('provideUuidConstantTests')] public function testUuidConstants(string $constantName, int | string $expected): void { $this->assertSame($expected, constant("Ramsey\\Uuid\\Uuid::{$constantName}")); @@ -559,7 +567,7 @@ class ExpectedBehaviorTest extends TestCase /** * @return array */ - public function provideUuidConstantTests(): array + public static function provideUuidConstantTests(): array { return [ ['NAMESPACE_DNS', '6ba7b810-9dad-11d1-80b4-00c04fd430c8'], diff --git a/tests/Generator/CombGeneratorTest.php b/tests/Generator/CombGeneratorTest.php index aef5564..a1fd4ef 100644 --- a/tests/Generator/CombGeneratorTest.php +++ b/tests/Generator/CombGeneratorTest.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test\Generator; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\MockObject\MockObject; use Ramsey\Uuid\Converter\NumberConverterInterface; use Ramsey\Uuid\Exception\InvalidArgumentException; @@ -85,16 +86,15 @@ class CombGeneratorTest extends TestCase /** * @return array> */ - public function lengthLessThanSix(): array + public static function lengthLessThanSix(): array { return [[1], [2], [3], [4], [5]]; } /** * @param positive-int $length - * - * @dataProvider lengthLessThanSix */ + #[DataProvider('lengthLessThanSix')] public function testGenerateWithLessThanTimestampBytesThrowsException(int $length): void { /** @var MockObject & RandomGeneratorInterface $randomGenerator */ diff --git a/tests/Generator/DceSecurityGeneratorTest.php b/tests/Generator/DceSecurityGeneratorTest.php index ca53096..d4b10f7 100644 --- a/tests/Generator/DceSecurityGeneratorTest.php +++ b/tests/Generator/DceSecurityGeneratorTest.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test\Generator; use Mockery; +use PHPUnit\Framework\Attributes\DataProvider; use Ramsey\Uuid\Converter\Number\GenericNumberConverter; use Ramsey\Uuid\Converter\NumberConverterInterface; use Ramsey\Uuid\Converter\Time\GenericTimeConverter; @@ -30,9 +31,8 @@ class DceSecurityGeneratorTest extends TestCase /** * @param non-empty-string $node * @param positive-int $providedDomain - * - * @dataProvider provideValuesForDceSecurityGenerator */ + #[DataProvider('provideValuesForDceSecurityGenerator')] public function testGenerateBytesReplacesBytesWithDceValues( int | string $uid, int | string $gid, @@ -78,7 +78,7 @@ class DceSecurityGeneratorTest extends TestCase /** * @return array */ - public function provideValuesForDceSecurityGenerator(): array + public static function provideValuesForDceSecurityGenerator(): array { return [ [ diff --git a/tests/Generator/DefaultNameGeneratorTest.php b/tests/Generator/DefaultNameGeneratorTest.php index 9bfb556..754f3ae 100644 --- a/tests/Generator/DefaultNameGeneratorTest.php +++ b/tests/Generator/DefaultNameGeneratorTest.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test\Generator; +use PHPUnit\Framework\Attributes\DataProvider; use Ramsey\Uuid\Exception\NameException; use Ramsey\Uuid\Generator\DefaultNameGenerator; use Ramsey\Uuid\Test\TestCase; @@ -17,9 +18,8 @@ class DefaultNameGeneratorTest extends TestCase * @param non-empty-string $ns * @param non-empty-string $name * @param non-empty-string $algorithm - * - * @dataProvider provideNamesForHashingTest */ + #[DataProvider('provideNamesForHashingTest')] public function testDefaultNameGeneratorHashesName(string $ns, string $name, string $algorithm): void { $namespace = Uuid::fromString($ns); @@ -33,7 +33,7 @@ class DefaultNameGeneratorTest extends TestCase /** * @return array */ - public function provideNamesForHashingTest(): array + public static function provideNamesForHashingTest(): array { return [ [ diff --git a/tests/Generator/DefaultTimeGeneratorTest.php b/tests/Generator/DefaultTimeGeneratorTest.php index c854385..2a99da5 100644 --- a/tests/Generator/DefaultTimeGeneratorTest.php +++ b/tests/Generator/DefaultTimeGeneratorTest.php @@ -7,6 +7,8 @@ namespace Ramsey\Uuid\Test\Generator; use Exception; use Mockery; use Mockery\MockInterface; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; use PHPUnit\Framework\MockObject\MockObject; use Ramsey\Uuid\BinaryUtils; use Ramsey\Uuid\Converter\TimeConverterInterface; @@ -113,10 +115,8 @@ class DefaultTimeGeneratorTest extends TestCase $defaultTimeGenerator->generate($this->nodeId, $this->clockSeq); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testGenerateDoesNotApplyVersionAndVariant(): void { $expectedBytes = hex2bin('83cb98e098e003cb0fe2122f80ca9e06'); @@ -138,10 +138,8 @@ class DefaultTimeGeneratorTest extends TestCase $this->assertSame($expectedBytes, $defaultTimeGenerator->generate($this->nodeId, $this->clockSeq)); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testGenerateUsesRandomSequenceWhenClockSeqNull(): void { PHPMockery::mock('Ramsey\Uuid\Generator', 'random_int') @@ -160,10 +158,8 @@ class DefaultTimeGeneratorTest extends TestCase $defaultTimeGenerator->generate($this->nodeId); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testGenerateThrowsExceptionWhenExceptionThrownByRandomint(): void { PHPMockery::mock('Ramsey\Uuid\Generator', 'random_int') diff --git a/tests/Generator/PeclUuidNameGeneratorTest.php b/tests/Generator/PeclUuidNameGeneratorTest.php index d95b00f..06e852a 100644 --- a/tests/Generator/PeclUuidNameGeneratorTest.php +++ b/tests/Generator/PeclUuidNameGeneratorTest.php @@ -4,6 +4,8 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test\Generator; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; use Ramsey\Uuid\BinaryUtils; use Ramsey\Uuid\Exception\NameException; use Ramsey\Uuid\Generator\PeclUuidNameGenerator; @@ -22,10 +24,9 @@ class PeclUuidNameGeneratorTest extends TestCase /** * @param non-empty-string $ns * @param non-empty-string $algorithm - * - * @dataProvider provideNamesForHashingTest - * @requires extension uuid */ + #[DataProvider('provideNamesForHashingTest')] + #[RequiresPhpExtension('uuid')] public function testPeclUuidNameGeneratorHashesName(string $ns, string $name, string $algorithm): void { $namespace = Uuid::fromString($ns); @@ -60,7 +61,7 @@ class PeclUuidNameGeneratorTest extends TestCase /** * @return array */ - public function provideNamesForHashingTest(): array + public static function provideNamesForHashingTest(): array { return [ [ diff --git a/tests/Generator/PeclUuidRandomGeneratorTest.php b/tests/Generator/PeclUuidRandomGeneratorTest.php index 3b27eb9..5f9f54e 100644 --- a/tests/Generator/PeclUuidRandomGeneratorTest.php +++ b/tests/Generator/PeclUuidRandomGeneratorTest.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test\Generator; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; use Ramsey\Uuid\Generator\PeclUuidRandomGenerator; use Ramsey\Uuid\Rfc4122\Fields; use Ramsey\Uuid\Rfc4122\Version; @@ -12,9 +13,7 @@ use Ramsey\Uuid\Uuid; class PeclUuidRandomGeneratorTest extends TestCase { - /** - * @requires extension uuid - */ + #[RequiresPhpExtension('uuid')] public function testGenerateCreatesUuidUsingPeclUuidMethods(): void { $generator = new PeclUuidRandomGenerator(); diff --git a/tests/Generator/PeclUuidTimeGeneratorTest.php b/tests/Generator/PeclUuidTimeGeneratorTest.php index ab78660..08c2746 100644 --- a/tests/Generator/PeclUuidTimeGeneratorTest.php +++ b/tests/Generator/PeclUuidTimeGeneratorTest.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test\Generator; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; use Ramsey\Uuid\Generator\PeclUuidTimeGenerator; use Ramsey\Uuid\Rfc4122\Fields; use Ramsey\Uuid\Rfc4122\Version; @@ -12,9 +13,7 @@ use Ramsey\Uuid\Uuid; class PeclUuidTimeGeneratorTest extends TestCase { - /** - * @requires extension uuid - */ + #[RequiresPhpExtension('uuid')] public function testGenerateCreatesUuidUsingPeclUuidMethods(): void { $generator = new PeclUuidTimeGenerator(); diff --git a/tests/Generator/RandomBytesGeneratorTest.php b/tests/Generator/RandomBytesGeneratorTest.php index db60539..4fe9adc 100644 --- a/tests/Generator/RandomBytesGeneratorTest.php +++ b/tests/Generator/RandomBytesGeneratorTest.php @@ -5,6 +5,9 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test\Generator; use Exception; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; use Ramsey\Uuid\Exception\RandomSourceException; use Ramsey\Uuid\Generator\RandomBytesGenerator; use Ramsey\Uuid\Test\TestCase; @@ -17,7 +20,7 @@ class RandomBytesGeneratorTest extends TestCase /** * @return array */ - public function lengthAndHexDataProvider(): array + public static function lengthAndHexDataProvider(): array { return [ [6, '4f17dd046fb8'], @@ -31,11 +34,10 @@ class RandomBytesGeneratorTest extends TestCase * @param non-empty-string $hex * * @throws Exception - * - * @dataProvider lengthAndHexDataProvider - * @runInSeparateProcess - * @preserveGlobalState disabled */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] + #[DataProvider('lengthAndHexDataProvider')] public function testGenerateReturnsRandomBytes(int $length, string $hex): void { $bytes = hex2bin($hex); @@ -50,10 +52,8 @@ class RandomBytesGeneratorTest extends TestCase $this->assertSame($bytes, $generator->generate($length)); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testGenerateThrowsExceptionWhenExceptionThrownByRandomBytes(): void { PHPMockery::mock('Ramsey\Uuid\Generator', 'random_bytes') diff --git a/tests/Generator/UnixTimeGeneratorTest.php b/tests/Generator/UnixTimeGeneratorTest.php index 356f99f..00a24a0 100644 --- a/tests/Generator/UnixTimeGeneratorTest.php +++ b/tests/Generator/UnixTimeGeneratorTest.php @@ -7,6 +7,8 @@ namespace Ramsey\Uuid\Test\Generator; use DateTimeImmutable; use Mockery; use Mockery\MockInterface; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; use Ramsey\Uuid\Generator\RandomBytesGenerator; use Ramsey\Uuid\Generator\RandomGeneratorInterface; use Ramsey\Uuid\Generator\UnixTimeGenerator; @@ -14,10 +16,8 @@ use Ramsey\Uuid\Test\TestCase; class UnixTimeGeneratorTest extends TestCase { - /** - * @runInSeparateProcess since values are stored statically on the class - * @preserveGlobalState disabled - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testGenerate(): void { $dateTime = new DateTimeImmutable('@1578612359.521023'); @@ -36,10 +36,8 @@ class UnixTimeGeneratorTest extends TestCase $this->assertSame($expectedBytes, $bytes); } - /** - * @runInSeparateProcess since values are stored statically on the class - * @preserveGlobalState disabled - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testGenerateProducesMonotonicResults(): void { $randomGenerator = new RandomBytesGenerator(); @@ -52,10 +50,8 @@ class UnixTimeGeneratorTest extends TestCase } } - /** - * @runInSeparateProcess since values are stored statically on the class - * @preserveGlobalState disabled - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testGenerateProducesMonotonicResultsWithSameDate(): void { $dateTime = new DateTimeImmutable('now'); @@ -69,10 +65,8 @@ class UnixTimeGeneratorTest extends TestCase } } - /** - * @runInSeparateProcess since values are stored statically on the class - * @preserveGlobalState disabled - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testGenerateProducesMonotonicResultsFor32BitPath(): void { $randomGenerator = new RandomBytesGenerator(); @@ -85,10 +79,8 @@ class UnixTimeGeneratorTest extends TestCase } } - /** - * @runInSeparateProcess since values are stored statically on the class - * @preserveGlobalState disabled - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testGenerateProducesMonotonicResultsWithSameDateFor32BitPath(): void { $dateTime = new DateTimeImmutable('now'); @@ -102,10 +94,8 @@ class UnixTimeGeneratorTest extends TestCase } } - /** - * @runInSeparateProcess since values are stored statically on the class - * @preserveGlobalState disabled - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testGenerateProducesMonotonicResultsStartingWithAllBitsSet(): void { /** @var RandomGeneratorInterface&MockInterface $randomGenerator */ @@ -126,10 +116,8 @@ class UnixTimeGeneratorTest extends TestCase } } - /** - * @runInSeparateProcess since values are stored statically on the class - * @preserveGlobalState disabled - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testGenerateProducesMonotonicResultsStartingWithAllBitsSetWithSameDate(): void { $dateTime = new DateTimeImmutable('now'); @@ -152,10 +140,8 @@ class UnixTimeGeneratorTest extends TestCase } } - /** - * @runInSeparateProcess since values are stored statically on the class - * @preserveGlobalState disabled - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testGenerateProducesMonotonicResultsStartingWithAllBitsSetFor32BitPath(): void { /** @var RandomGeneratorInterface&MockInterface $randomGenerator */ @@ -176,10 +162,8 @@ class UnixTimeGeneratorTest extends TestCase } } - /** - * @runInSeparateProcess since values are stored statically on the class - * @preserveGlobalState disabled - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testGenerateProducesMonotonicResultsStartingWithAllBitsSetWithSameDateFor32BitPath(): void { $dateTime = new DateTimeImmutable('now'); diff --git a/tests/Guid/FieldsTest.php b/tests/Guid/FieldsTest.php index 0c0ad8d..eecef58 100644 --- a/tests/Guid/FieldsTest.php +++ b/tests/Guid/FieldsTest.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test\Guid; +use PHPUnit\Framework\Attributes\DataProvider; use Ramsey\Uuid\Exception\InvalidArgumentException; use Ramsey\Uuid\Guid\Fields; use Ramsey\Uuid\Rfc4122\Version; @@ -29,9 +30,8 @@ class FieldsTest extends TestCase /** * @param non-empty-string $guid - * - * @dataProvider nonRfc4122GuidVariantProvider */ + #[DataProvider('nonRfc4122GuidVariantProvider')] public function testConstructorThrowsExceptionIfNotRfc4122Variant(string $guid): void { /** @var non-empty-string $bytes */ @@ -51,7 +51,7 @@ class FieldsTest extends TestCase * * @return array */ - public function nonRfc4122GuidVariantProvider(): array + public static function nonRfc4122GuidVariantProvider(): array { // In string representation, the following IDs would begin as: // ff6f8cb0-c57d-11e1-... @@ -71,9 +71,8 @@ class FieldsTest extends TestCase /** * @param non-empty-string $guid - * - * @dataProvider invalidVersionProvider */ + #[DataProvider('invalidVersionProvider')] public function testConstructorThrowsExceptionIfInvalidVersion(string $guid): void { /** @var non-empty-string $bytes */ @@ -90,7 +89,7 @@ class FieldsTest extends TestCase /** * @return array */ - public function invalidVersionProvider(): array + public static function invalidVersionProvider(): array { // The following UUIDs are in GUID byte order. Dashes have // been removed in the tests to distinguish these from string @@ -111,9 +110,8 @@ class FieldsTest extends TestCase * @param non-empty-string $bytes * @param non-empty-string $methodName * @param Variant | Version | bool | non-empty-string | null $expectedValue - * - * @dataProvider fieldGetterMethodProvider */ + #[DataProvider('fieldGetterMethodProvider')] public function testFieldGetterMethods( string $bytes, string $methodName, @@ -139,7 +137,7 @@ class FieldsTest extends TestCase * 2: Variant | Version | bool | non-empty-string | null, * }> */ - public function fieldGetterMethodProvider(): array + public static function fieldGetterMethodProvider(): array { // The following UUIDs are in GUID byte order. Dashes have // been removed in the tests to distinguish these from string diff --git a/tests/Nonstandard/FieldsTest.php b/tests/Nonstandard/FieldsTest.php index fc1c688..36f0f40 100644 --- a/tests/Nonstandard/FieldsTest.php +++ b/tests/Nonstandard/FieldsTest.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test\Nonstandard; +use PHPUnit\Framework\Attributes\DataProvider; use Ramsey\Uuid\Exception\InvalidArgumentException; use Ramsey\Uuid\Nonstandard\Fields; use Ramsey\Uuid\Test\TestCase; @@ -31,9 +32,8 @@ class FieldsTest extends TestCase * @param non-empty-string $uuid * @param non-empty-string $methodName * @param Variant | bool | non-empty-string | null $expectedValue - * - * @dataProvider fieldGetterMethodProvider */ + #[DataProvider('fieldGetterMethodProvider')] public function testFieldGetterMethods( string $uuid, string $methodName, @@ -55,7 +55,7 @@ class FieldsTest extends TestCase /** * @return array */ - public function fieldGetterMethodProvider(): array + public static function fieldGetterMethodProvider(): array { return [ ['ff6f8cb0-c57d-91e1-0b21-0800200c9a66', 'getClockSeq', '0b21'], diff --git a/tests/Nonstandard/UuidV6Test.php b/tests/Nonstandard/UuidV6Test.php index 2330e0d..2a219de 100644 --- a/tests/Nonstandard/UuidV6Test.php +++ b/tests/Nonstandard/UuidV6Test.php @@ -6,6 +6,7 @@ namespace Ramsey\Uuid\Test\Nonstandard; use DateTimeImmutable; use Mockery; +use PHPUnit\Framework\Attributes\DataProvider; use Ramsey\Uuid\Codec\CodecInterface; use Ramsey\Uuid\Converter\NumberConverterInterface; use Ramsey\Uuid\Converter\TimeConverterInterface; @@ -22,9 +23,7 @@ use Ramsey\Uuid\Uuid; class UuidV6Test extends TestCase { - /** - * @dataProvider provideTestVersions - */ + #[DataProvider('provideTestVersions')] public function testConstructorThrowsExceptionWhenFieldsAreNotValidForType(Version $version): void { $fields = Mockery::mock(FieldsInterface::class, [ @@ -47,7 +46,7 @@ class UuidV6Test extends TestCase /** * @return array */ - public function provideTestVersions(): array + public static function provideTestVersions(): array { return [ ['version' => Version::Time], @@ -62,9 +61,8 @@ class UuidV6Test extends TestCase /** * @param non-empty-string $uuid - * - * @dataProvider provideUuidV6WithOddMicroseconds */ + #[DataProvider('provideUuidV6WithOddMicroseconds')] public function testGetDateTimeProperlyHandlesLongMicroseconds(string $uuid, string $expected): void { /** @var UuidV6 $object */ @@ -79,7 +77,7 @@ class UuidV6Test extends TestCase /** * @return array */ - public function provideUuidV6WithOddMicroseconds(): array + public static function provideUuidV6WithOddMicroseconds(): array { return [ [ @@ -104,9 +102,8 @@ class UuidV6Test extends TestCase /** * @param non-empty-string $uuidv6 * @param non-empty-string $uuidv1 - * - * @dataProvider provideUuidV1UuidV6Equivalents */ + #[DataProvider('provideUuidV1UuidV6Equivalents')] public function testToUuidV1(string $uuidv6, string $uuidv1): void { /** @var UuidV6 $uuid6 */ @@ -125,9 +122,8 @@ class UuidV6Test extends TestCase /** * @param non-empty-string $uuidv6 * @param non-empty-string $uuidv1 - * - * @dataProvider provideUuidV1UuidV6Equivalents */ + #[DataProvider('provideUuidV1UuidV6Equivalents')] public function testFromUuidV1(string $uuidv6, string $uuidv1): void { /** @var LazyUuidFromString $uuid */ @@ -147,7 +143,7 @@ class UuidV6Test extends TestCase /** * @return array */ - public function provideUuidV1UuidV6Equivalents(): array + public static function provideUuidV1UuidV6Equivalents(): array { return [ [ diff --git a/tests/Provider/Dce/SystemDceSecurityProviderTest.php b/tests/Provider/Dce/SystemDceSecurityProviderTest.php index 6ad0e88..cb2b7ba 100644 --- a/tests/Provider/Dce/SystemDceSecurityProviderTest.php +++ b/tests/Provider/Dce/SystemDceSecurityProviderTest.php @@ -5,6 +5,9 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test\Provider\Dce; use Mockery; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; use Ramsey\Uuid\Exception\DceSecurityException; use Ramsey\Uuid\Provider\Dce\SystemDceSecurityProvider; use Ramsey\Uuid\Test\TestCase; @@ -14,10 +17,8 @@ use function array_merge; class SystemDceSecurityProviderTest extends TestCase { - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testGetUidThrowsExceptionIfShellExecDisabled(): void { PHPMockery::mock( @@ -49,10 +50,8 @@ class SystemDceSecurityProviderTest extends TestCase $this->assertSame(5, $caughtException); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testGetUidForPosixThrowsExceptionIfShellExecReturnsNull(): void { PHPMockery::mock( @@ -84,11 +83,10 @@ class SystemDceSecurityProviderTest extends TestCase /** * @param mixed $value - * - * @runInSeparateProcess - * @preserveGlobalState disabled - * @dataProvider provideWindowsBadValues */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] + #[DataProvider('provideWindowsBadValues')] public function testGetUidForWindowsThrowsExceptionIfShellExecForWhoAmIReturnsBadValues($value): void { PHPMockery::mock( @@ -118,11 +116,9 @@ class SystemDceSecurityProviderTest extends TestCase $provider->getUid(); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - * @dataProvider provideWindowsGoodWhoAmIValues - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] + #[DataProvider('provideWindowsGoodWhoAmIValues')] public function testGetUidForWindowsWhenShellExecForWhoAmIReturnsGoodValues( string $value, string $expectedId @@ -153,7 +149,7 @@ class SystemDceSecurityProviderTest extends TestCase /** * @return array */ - public function provideWindowsGoodWhoAmIValues(): array + public static function provideWindowsGoodWhoAmIValues(): array { return [ [ @@ -171,11 +167,9 @@ class SystemDceSecurityProviderTest extends TestCase ]; } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - * @dataProvider providePosixTestValues - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] + #[DataProvider('providePosixTestValues')] public function testGetUidForPosixSystems(string $os, string $id): void { PHPMockery::mock( @@ -201,10 +195,8 @@ class SystemDceSecurityProviderTest extends TestCase $this->assertSame($uid, $provider->getUid()); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testGetGidThrowsExceptionIfShellExecDisabled(): void { PHPMockery::mock( @@ -236,10 +228,8 @@ class SystemDceSecurityProviderTest extends TestCase $this->assertSame(5, $caughtException); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testGetGidForPosixThrowsExceptionIfShellExecReturnsNull(): void { PHPMockery::mock( @@ -269,11 +259,9 @@ class SystemDceSecurityProviderTest extends TestCase $provider->getGid(); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - * @dataProvider providePosixTestValues - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] + #[DataProvider('providePosixTestValues')] public function testGetGidForPosixSystems(string $os, string $id): void { PHPMockery::mock( @@ -301,11 +289,10 @@ class SystemDceSecurityProviderTest extends TestCase /** * @param mixed $value - * - * @runInSeparateProcess - * @preserveGlobalState disabled - * @dataProvider provideWindowsBadValues */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] + #[DataProvider('provideWindowsBadValues')] public function testGetGidForWindowsThrowsExceptionWhenShellExecForNetUserReturnsBadValues($value): void { PHPMockery::mock( @@ -337,11 +324,10 @@ class SystemDceSecurityProviderTest extends TestCase /** * @param mixed $value - * - * @runInSeparateProcess - * @preserveGlobalState disabled - * @dataProvider provideWindowsBadGroupValues */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] + #[DataProvider('provideWindowsBadGroupValues')] public function testGetGidForWindowsThrowsExceptionWhenShellExecForWmicGroupGetReturnsBadValues($value): void { PHPMockery::mock( @@ -378,11 +364,9 @@ class SystemDceSecurityProviderTest extends TestCase $provider->getGid(); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - * @dataProvider provideWindowsGoodNetUserAndWmicGroupValues - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] + #[DataProvider('provideWindowsGoodNetUserAndWmicGroupValues')] public function testGetGidForWindowsSucceeds( string $netUserResponse, string $wmicGroupResponse, @@ -427,7 +411,7 @@ class SystemDceSecurityProviderTest extends TestCase * expectedId: non-empty-string, * }> */ - public function provideWindowsGoodNetUserAndWmicGroupValues(): array + public static function provideWindowsGoodNetUserAndWmicGroupValues(): array { return [ [ @@ -460,7 +444,7 @@ class SystemDceSecurityProviderTest extends TestCase /** * @return array */ - public function providePosixTestValues(): array + public static function providePosixTestValues(): array { return [ ['os' => 'Darwin', 'id' => '1042'], @@ -476,7 +460,7 @@ class SystemDceSecurityProviderTest extends TestCase /** * @return array */ - public function provideWindowsBadValues(): array + public static function provideWindowsBadValues(): array { return [ ['value' => null], @@ -492,10 +476,10 @@ class SystemDceSecurityProviderTest extends TestCase /** * @return array */ - public function provideWindowsBadGroupValues(): array + public static function provideWindowsBadGroupValues(): array { return array_merge( - $this->provideWindowsBadValues(), + self::provideWindowsBadValues(), [ ['value' => 'Users Not a valid SID string'], ['value' => 'Users 344aab9758bb0d018b93739e7893fb3a'], diff --git a/tests/Provider/Node/RandomNodeProviderTest.php b/tests/Provider/Node/RandomNodeProviderTest.php index 2af3922..8316199 100644 --- a/tests/Provider/Node/RandomNodeProviderTest.php +++ b/tests/Provider/Node/RandomNodeProviderTest.php @@ -5,6 +5,8 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test\Provider\Node; use Exception; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; use Ramsey\Uuid\Exception\RandomSourceException; use Ramsey\Uuid\Provider\Node\RandomNodeProvider; use Ramsey\Uuid\Test\TestCase; @@ -18,10 +20,8 @@ use function substr; class RandomNodeProviderTest extends TestCase { - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testGetNodeUsesRandomBytes(): void { $bytes = hex2bin('38a675685d50'); @@ -38,10 +38,8 @@ class RandomNodeProviderTest extends TestCase $this->assertSame($expectedNode, $node->toString()); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testGetNodeAlreadyHasMulticastBit(): void { $bytesHex = '4161a1ff5d50'; @@ -60,10 +58,8 @@ class RandomNodeProviderTest extends TestCase $this->assertSame($expectedNode, $provider->getNode()->toString()); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testGetNodeSetsMulticastBitForLowNodeValue(): void { $bytes = hex2bin('100000000001'); @@ -104,10 +100,8 @@ class RandomNodeProviderTest extends TestCase $this->assertSame('010000000000', $node); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testGetNodeThrowsExceptionWhenExceptionThrownByRandombytes(): void { PHPMockery::mock('Ramsey\Uuid\Provider\Node', 'random_bytes') diff --git a/tests/Provider/Node/StaticNodeProviderTest.php b/tests/Provider/Node/StaticNodeProviderTest.php index 5a6c47a..7a8ad2b 100644 --- a/tests/Provider/Node/StaticNodeProviderTest.php +++ b/tests/Provider/Node/StaticNodeProviderTest.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test\Provider\Node; +use PHPUnit\Framework\Attributes\DataProvider; use Ramsey\Uuid\Exception\InvalidArgumentException; use Ramsey\Uuid\Provider\Node\StaticNodeProvider; use Ramsey\Uuid\Test\TestCase; @@ -13,9 +14,8 @@ class StaticNodeProviderTest extends TestCase { /** * @param non-empty-string $expectedNode - * - * @dataProvider provideNodeForTest */ + #[DataProvider('provideNodeForTest')] public function testStaticNode(Hexadecimal $node, string $expectedNode): void { $staticNode = new StaticNodeProvider($node); @@ -26,7 +26,7 @@ class StaticNodeProviderTest extends TestCase /** * @return array */ - public function provideNodeForTest(): array + public static function provideNodeForTest(): array { return [ [ diff --git a/tests/Provider/Node/SystemNodeProviderTest.php b/tests/Provider/Node/SystemNodeProviderTest.php index f1daddf..e38cc81 100644 --- a/tests/Provider/Node/SystemNodeProviderTest.php +++ b/tests/Provider/Node/SystemNodeProviderTest.php @@ -4,6 +4,9 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test\Provider\Node; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; use Ramsey\Uuid\Exception\InvalidArgumentException; use Ramsey\Uuid\Exception\NodeException; use Ramsey\Uuid\Provider\Node\SystemNodeProvider; @@ -58,13 +61,11 @@ class SystemNodeProviderTest extends TestCase /** * @var Spy[] */ - private $functionProxies = []; + private array $functionProxies = []; - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - * @dataProvider provideValidNetStatOutput - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] + #[DataProvider('provideValidNetStatOutput')] public function testGetNodeReturnsSystemNodeFromMacAddress(string $netstatOutput, string $expected): void { /* Arrange mocks for native functions */ @@ -94,11 +95,9 @@ class SystemNodeProviderTest extends TestCase $this->assertMatchesRegularExpression('/^[A-Fa-f0-9]{12}$/', $node->toString(), $message); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - * @dataProvider provideInvalidNetStatOutput - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] + #[DataProvider('provideInvalidNetStatOutput')] public function testGetNodeShouldNotReturnsSystemNodeForInvalidMacAddress(string $netstatOutput): void { /* Arrange */ @@ -127,11 +126,9 @@ class SystemNodeProviderTest extends TestCase $this->assertInstanceOf(NodeException::class, $exception); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - * @dataProvider provideNotationalFormats - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] + #[DataProvider('provideNotationalFormats')] public function testGetNodeReturnsNodeStrippedOfNotationalFormatting(string $formatted, string $expected): void { /* Arrange */ @@ -155,11 +152,9 @@ class SystemNodeProviderTest extends TestCase $this->assertSame($expected, $node->toString()); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - * @dataProvider provideInvalidNotationalFormats - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] + #[DataProvider('provideInvalidNotationalFormats')] public function testGetNodeDoesNotAcceptIncorrectNotationalFormatting(string $formatted): void { /* Arrange */ @@ -188,10 +183,8 @@ class SystemNodeProviderTest extends TestCase $this->assertInstanceOf(NodeException::class, $exception); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testGetNodeReturnsFirstMacAddressFound(): void { /* Arrange */ @@ -215,10 +208,8 @@ class SystemNodeProviderTest extends TestCase $this->assertSame('aabbccddeeff', $node->toString()); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testGetNodeReturnsFalseWhenNodeIsNotFound(): void { /* Arrange */ @@ -247,10 +238,8 @@ class SystemNodeProviderTest extends TestCase $this->assertInstanceOf(NodeException::class, $exception); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testGetNodeWillNotExecuteSystemCallIfFailedFirstTime(): void { /* Arrange */ @@ -287,11 +276,9 @@ class SystemNodeProviderTest extends TestCase $this->assertInstanceOf(NodeException::class, $exception2); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - * @dataProvider provideCommandPerOs - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] + #[DataProvider('provideCommandPerOs')] public function testGetNodeGetsNetworkInterfaceConfig(string $os, string $command): void { /* Arrange */ @@ -335,10 +322,8 @@ class SystemNodeProviderTest extends TestCase $this->assertInstanceOf(NodeException::class, $exception); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testGetNodeReturnsSameNodeUponSubsequentCalls(): void { /* Arrange */ @@ -363,10 +348,8 @@ class SystemNodeProviderTest extends TestCase $this->assertSame($node->toString(), $node2->toString()); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testSubsequentCallsToGetNodeDoNotRecallIfconfig(): void { /* Arrange */ @@ -391,11 +374,9 @@ class SystemNodeProviderTest extends TestCase $this->assertSame($node->toString(), $node2->toString()); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - * @dataProvider provideCommandPerOs - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] + #[DataProvider('provideCommandPerOs')] public function testCallGetsysfsOnLinux(string $os, string $command): void { /* Arrange */ @@ -447,10 +428,8 @@ class SystemNodeProviderTest extends TestCase $this->assertSame('010203040506', $node->toString()); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testCallGetsysfsOnLinuxWhenGlobReturnsFalse(): void { /* Arrange */ @@ -480,10 +459,8 @@ class SystemNodeProviderTest extends TestCase $this->assertSame('010203040506', $node->toString()); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testCallGetsysfsOnLinuxWhenGlobReturnsEmptyArray(): void { /* Arrange */ @@ -513,10 +490,8 @@ class SystemNodeProviderTest extends TestCase $this->assertSame('010203040506', $node->toString()); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testCallGetsysfsOnLinuxWhenGlobFilesAreNotReadable(): void { /* Arrange */ @@ -548,10 +523,8 @@ class SystemNodeProviderTest extends TestCase $this->assertSame('010203040506', $node->toString()); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testGetNodeReturnsFalseWhenPassthruIsDisabled(): void { /* Arrange */ @@ -587,21 +560,14 @@ class SystemNodeProviderTest extends TestCase /** * Replaces the return value for functions with the given value or callback. - * - * @param callback|mixed|null $fileGetContentsBody - * @param callback|mixed|null $globBody - * @param callback|mixed|null $passthruBody - * @param callback|mixed|null $constantBody - * @param callback|mixed|null $iniGetDisableFunctionsBody - * @param callback|mixed|null $isReadableBody */ private function arrangeMockFunctions( - $fileGetContentsBody, - $globBody, - $passthruBody, - $constantBody, - $iniGetDisableFunctionsBody, - $isReadableBody = true + mixed $fileGetContentsBody, + mixed $globBody, + mixed $passthruBody, + mixed $constantBody, + mixed $iniGetDisableFunctionsBody, + mixed $isReadableBody = true ): void { $mockFunction = [ self::MOCK_FILE_GET_CONTENTS => $fileGetContentsBody, @@ -689,7 +655,7 @@ class SystemNodeProviderTest extends TestCase * * @return array */ - public function provideCommandPerOs(): array + public static function provideCommandPerOs(): array { return [ 'windows' => ['Windows', 'ipconfig /all 2>&1'], @@ -706,7 +672,7 @@ class SystemNodeProviderTest extends TestCase * * @return array */ - public function provideInvalidNetStatOutput(): array + public static function provideInvalidNetStatOutput(): array { return [ 'Not an octal value' => [ @@ -732,7 +698,7 @@ class SystemNodeProviderTest extends TestCase * * @return array */ - public function provideInvalidNotationalFormats(): array + public static function provideInvalidNotationalFormats(): array { return [ ['01:23-45-67-89-ab'], @@ -752,7 +718,7 @@ class SystemNodeProviderTest extends TestCase * * @return array */ - public function provideNotationalFormats(): array + public static function provideNotationalFormats(): array { return [ ['01-23-45-67-89-ab', '0123456789ab'], @@ -765,7 +731,7 @@ class SystemNodeProviderTest extends TestCase * * @return array */ - public function provideValidNetStatOutput(): array + public static function provideValidNetStatOutput(): array { return [ /* Full output of related command */ diff --git a/tests/Rfc4122/FieldsTest.php b/tests/Rfc4122/FieldsTest.php index cbf1595..12ded15 100644 --- a/tests/Rfc4122/FieldsTest.php +++ b/tests/Rfc4122/FieldsTest.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test\Rfc4122; +use PHPUnit\Framework\Attributes\DataProvider; use Ramsey\Uuid\Exception\InvalidArgumentException; use Ramsey\Uuid\Rfc4122\Fields; use Ramsey\Uuid\Rfc4122\Version; @@ -30,9 +31,8 @@ class FieldsTest extends TestCase /** * @param non-empty-string $uuid - * - * @dataProvider nonRfc4122VariantProvider */ + #[DataProvider('nonRfc4122VariantProvider')] public function testConstructorThrowsExceptionIfNotRfc4122Variant(string $uuid): void { /** @var non-empty-string $bytes */ @@ -49,7 +49,7 @@ class FieldsTest extends TestCase /** * @return array */ - public function nonRfc4122VariantProvider(): array + public static function nonRfc4122VariantProvider(): array { return [ ['ff6f8cb0-c57d-11e1-0b21-0800200c9a66'], @@ -69,9 +69,8 @@ class FieldsTest extends TestCase /** * @param non-empty-string $uuid - * - * @dataProvider invalidVersionProvider */ + #[DataProvider('invalidVersionProvider')] public function testConstructorThrowsExceptionIfInvalidVersion(string $uuid): void { /** @var non-empty-string $bytes */ @@ -88,7 +87,7 @@ class FieldsTest extends TestCase /** * @return array */ - public function invalidVersionProvider(): array + public static function invalidVersionProvider(): array { return [ ['ff6f8cb0-c57d-01e1-8b21-0800200c9a66'], @@ -106,9 +105,8 @@ class FieldsTest extends TestCase * @param non-empty-string $uuid * @param non-empty-string $methodName * @param Variant | Version | bool | non-empty-string | null $expectedValue - * - * @dataProvider fieldGetterMethodProvider */ + #[DataProvider('fieldGetterMethodProvider')] public function testFieldGetterMethods( string $uuid, string $methodName, @@ -134,7 +132,7 @@ class FieldsTest extends TestCase * 2: Variant | Version | bool | non-empty-string | null, * }> */ - public function fieldGetterMethodProvider(): array + public static function fieldGetterMethodProvider(): array { return [ ['ff6f8cb0-c57d-11e1-9b21-0800200c9a66', 'getClockSeq', '1b21'], diff --git a/tests/Rfc4122/UuidBuilderTest.php b/tests/Rfc4122/UuidBuilderTest.php index 079a754..a2dcf51 100644 --- a/tests/Rfc4122/UuidBuilderTest.php +++ b/tests/Rfc4122/UuidBuilderTest.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test\Rfc4122; +use PHPUnit\Framework\Attributes\DataProvider; use Ramsey\Uuid\Codec\StringCodec; use Ramsey\Uuid\Converter\Number\GenericNumberConverter; use Ramsey\Uuid\Converter\Time\GenericTimeConverter; @@ -33,9 +34,8 @@ class UuidBuilderTest extends TestCase /** * @param non-empty-string $uuid * @param class-string $expectedClass - * - * @dataProvider provideBuildTestValues */ + #[DataProvider('provideBuildTestValues')] public function testBuild(string $uuid, string $expectedClass, ?Version $expectedVersion): void { /** @var non-empty-string $bytes */ @@ -59,7 +59,7 @@ class UuidBuilderTest extends TestCase /** * @return array */ - public function provideBuildTestValues(): array + public static function provideBuildTestValues(): array { return [ [ diff --git a/tests/Rfc4122/UuidV1Test.php b/tests/Rfc4122/UuidV1Test.php index 72b54f6..7553897 100644 --- a/tests/Rfc4122/UuidV1Test.php +++ b/tests/Rfc4122/UuidV1Test.php @@ -6,6 +6,7 @@ namespace Ramsey\Uuid\Test\Rfc4122; use DateTimeImmutable; use Mockery; +use PHPUnit\Framework\Attributes\DataProvider; use Ramsey\Uuid\Codec\CodecInterface; use Ramsey\Uuid\Converter\NumberConverterInterface; use Ramsey\Uuid\Converter\TimeConverterInterface; @@ -21,9 +22,7 @@ use Ramsey\Uuid\Uuid; class UuidV1Test extends TestCase { - /** - * @dataProvider provideTestVersions - */ + #[DataProvider('provideTestVersions')] public function testConstructorThrowsExceptionWhenFieldsAreNotValidForType(Version $version): void { $fields = Mockery::mock(FieldsInterface::class, [ @@ -46,7 +45,7 @@ class UuidV1Test extends TestCase /** * @return array */ - public function provideTestVersions(): array + public static function provideTestVersions(): array { return [ ['version' => Version::DceSecurity], @@ -62,9 +61,8 @@ class UuidV1Test extends TestCase /** * @param non-empty-string $uuid * @param numeric-string $expected - * - * @dataProvider provideUuidV1WithOddMicroseconds */ + #[DataProvider('provideUuidV1WithOddMicroseconds')] public function testGetDateTimeProperlyHandlesLongMicroseconds(string $uuid, string $expected): void { /** @var UuidV1 $object */ @@ -79,7 +77,7 @@ class UuidV1Test extends TestCase /** * @return array */ - public function provideUuidV1WithOddMicroseconds(): array + public static function provideUuidV1WithOddMicroseconds(): array { return [ [ diff --git a/tests/Rfc4122/UuidV2Test.php b/tests/Rfc4122/UuidV2Test.php index a3f20b9..52cc1bd 100644 --- a/tests/Rfc4122/UuidV2Test.php +++ b/tests/Rfc4122/UuidV2Test.php @@ -6,6 +6,7 @@ namespace Ramsey\Uuid\Test\Rfc4122; use DateTimeInterface; use Mockery; +use PHPUnit\Framework\Attributes\DataProvider; use Ramsey\Uuid\Codec\CodecInterface; use Ramsey\Uuid\Converter\Number\GenericNumberConverter; use Ramsey\Uuid\Converter\NumberConverterInterface; @@ -30,9 +31,7 @@ use Ramsey\Uuid\UuidFactory; class UuidV2Test extends TestCase { - /** - * @dataProvider provideTestVersions - */ + #[DataProvider('provideTestVersions')] public function testConstructorThrowsExceptionWhenFieldsAreNotValidForType(Version $version): void { $fields = Mockery::mock(FieldsInterface::class, [ @@ -55,7 +54,7 @@ class UuidV2Test extends TestCase /** * @return array */ - public function provideTestVersions(): array + public static function provideTestVersions(): array { return [ ['version' => Version::Time], @@ -70,9 +69,8 @@ class UuidV2Test extends TestCase /** * @param positive-int $domain - * - * @dataProvider provideLocalDomainAndIdentifierForTests */ + #[DataProvider('provideLocalDomainAndIdentifierForTests')] public function testGetLocalDomainAndIdentifier( int $domain, IntegerObject $identifier, @@ -124,7 +122,7 @@ class UuidV2Test extends TestCase * expectedTime: non-empty-string, * }> */ - public function provideLocalDomainAndIdentifierForTests(): array + public static function provideLocalDomainAndIdentifierForTests(): array { return [ [ diff --git a/tests/Rfc4122/UuidV3Test.php b/tests/Rfc4122/UuidV3Test.php index b8a1745..1348f98 100644 --- a/tests/Rfc4122/UuidV3Test.php +++ b/tests/Rfc4122/UuidV3Test.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test\Rfc4122; use Mockery; +use PHPUnit\Framework\Attributes\DataProvider; use Ramsey\Uuid\Codec\CodecInterface; use Ramsey\Uuid\Converter\NumberConverterInterface; use Ramsey\Uuid\Converter\TimeConverterInterface; @@ -16,9 +17,7 @@ use Ramsey\Uuid\Test\TestCase; class UuidV3Test extends TestCase { - /** - * @dataProvider provideTestVersions - */ + #[DataProvider('provideTestVersions')] public function testConstructorThrowsExceptionWhenFieldsAreNotValidForType(Version $version): void { $fields = Mockery::mock(FieldsInterface::class, [ @@ -41,7 +40,7 @@ class UuidV3Test extends TestCase /** * @return array */ - public function provideTestVersions(): array + public static function provideTestVersions(): array { return [ ['version' => Version::Time], diff --git a/tests/Rfc4122/UuidV4Test.php b/tests/Rfc4122/UuidV4Test.php index f653d8d..f550e4b 100644 --- a/tests/Rfc4122/UuidV4Test.php +++ b/tests/Rfc4122/UuidV4Test.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test\Rfc4122; use Mockery; +use PHPUnit\Framework\Attributes\DataProvider; use Ramsey\Uuid\Codec\CodecInterface; use Ramsey\Uuid\Converter\NumberConverterInterface; use Ramsey\Uuid\Converter\TimeConverterInterface; @@ -16,9 +17,7 @@ use Ramsey\Uuid\Test\TestCase; class UuidV4Test extends TestCase { - /** - * @dataProvider provideTestVersions - */ + #[DataProvider('provideTestVersions')] public function testConstructorThrowsExceptionWhenFieldsAreNotValidForType(Version $version): void { $fields = Mockery::mock(FieldsInterface::class, [ @@ -41,7 +40,7 @@ class UuidV4Test extends TestCase /** * @return array */ - public function provideTestVersions(): array + public static function provideTestVersions(): array { return [ ['version' => Version::Time], diff --git a/tests/Rfc4122/UuidV5Test.php b/tests/Rfc4122/UuidV5Test.php index d9c8f3a..f1d3f66 100644 --- a/tests/Rfc4122/UuidV5Test.php +++ b/tests/Rfc4122/UuidV5Test.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test\Rfc4122; use Mockery; +use PHPUnit\Framework\Attributes\DataProvider; use Ramsey\Uuid\Codec\CodecInterface; use Ramsey\Uuid\Converter\NumberConverterInterface; use Ramsey\Uuid\Converter\TimeConverterInterface; @@ -16,9 +17,7 @@ use Ramsey\Uuid\Test\TestCase; class UuidV5Test extends TestCase { - /** - * @dataProvider provideTestVersions - */ + #[DataProvider('provideTestVersions')] public function testConstructorThrowsExceptionWhenFieldsAreNotValidForType(Version $version): void { $fields = Mockery::mock(FieldsInterface::class, [ @@ -41,7 +40,7 @@ class UuidV5Test extends TestCase /** * @return array */ - public function provideTestVersions(): array + public static function provideTestVersions(): array { return [ ['version' => Version::Time], diff --git a/tests/Rfc4122/UuidV6Test.php b/tests/Rfc4122/UuidV6Test.php index cc4e969..2c6fb8d 100644 --- a/tests/Rfc4122/UuidV6Test.php +++ b/tests/Rfc4122/UuidV6Test.php @@ -6,6 +6,7 @@ namespace Ramsey\Uuid\Test\Rfc4122; use DateTimeImmutable; use Mockery; +use PHPUnit\Framework\Attributes\DataProvider; use Ramsey\Uuid\Codec\CodecInterface; use Ramsey\Uuid\Converter\NumberConverterInterface; use Ramsey\Uuid\Converter\TimeConverterInterface; @@ -22,9 +23,7 @@ use Ramsey\Uuid\Uuid; class UuidV6Test extends TestCase { - /** - * @dataProvider provideTestVersions - */ + #[DataProvider('provideTestVersions')] public function testConstructorThrowsExceptionWhenFieldsAreNotValidForType(Version $version): void { $fields = Mockery::mock(FieldsInterface::class, [ @@ -47,7 +46,7 @@ class UuidV6Test extends TestCase /** * @return array */ - public function provideTestVersions(): array + public static function provideTestVersions(): array { return [ ['version' => Version::Time], @@ -63,9 +62,8 @@ class UuidV6Test extends TestCase /** * @param non-empty-string $uuid * @param non-empty-string $expected - * - * @dataProvider provideUuidV6WithOddMicroseconds */ + #[DataProvider('provideUuidV6WithOddMicroseconds')] public function testGetDateTimeProperlyHandlesLongMicroseconds(string $uuid, string $expected): void { /** @var UuidV6 $object */ @@ -80,7 +78,7 @@ class UuidV6Test extends TestCase /** * @return array */ - public function provideUuidV6WithOddMicroseconds(): array + public static function provideUuidV6WithOddMicroseconds(): array { return [ [ @@ -105,9 +103,8 @@ class UuidV6Test extends TestCase /** * @param non-empty-string $uuidv6 * @param non-empty-string $uuidv1 - * - * @dataProvider provideUuidV1UuidV6Equivalents */ + #[DataProvider('provideUuidV1UuidV6Equivalents')] public function testToUuidV1(string $uuidv6, string $uuidv1): void { /** @var UuidV6 $uuid6 */ @@ -126,9 +123,8 @@ class UuidV6Test extends TestCase /** * @param non-empty-string $uuidv6 * @param non-empty-string $uuidv1 - * - * @dataProvider provideUuidV1UuidV6Equivalents */ + #[DataProvider('provideUuidV1UuidV6Equivalents')] public function testFromUuidV1(string $uuidv6, string $uuidv1): void { /** @var LazyUuidFromString $uuid */ @@ -148,7 +144,7 @@ class UuidV6Test extends TestCase /** * @return array */ - public function provideUuidV1UuidV6Equivalents(): array + public static function provideUuidV1UuidV6Equivalents(): array { return [ [ diff --git a/tests/Rfc4122/UuidV7Test.php b/tests/Rfc4122/UuidV7Test.php index 09c8e6f..d890877 100644 --- a/tests/Rfc4122/UuidV7Test.php +++ b/tests/Rfc4122/UuidV7Test.php @@ -6,6 +6,7 @@ namespace Ramsey\Uuid\Test\Rfc4122; use DateTimeImmutable; use Mockery; +use PHPUnit\Framework\Attributes\DataProvider; use Ramsey\Uuid\Codec\CodecInterface; use Ramsey\Uuid\Converter\NumberConverterInterface; use Ramsey\Uuid\Converter\TimeConverterInterface; @@ -21,9 +22,7 @@ use Ramsey\Uuid\Uuid; class UuidV7Test extends TestCase { - /** - * @dataProvider provideTestVersions - */ + #[DataProvider('provideTestVersions')] public function testConstructorThrowsExceptionWhenFieldsAreNotValidForType(Version $version): void { $fields = Mockery::mock(FieldsInterface::class, [ @@ -46,7 +45,7 @@ class UuidV7Test extends TestCase /** * @return array */ - public function provideTestVersions(): array + public static function provideTestVersions(): array { return [ ['version' => Version::Time], @@ -61,9 +60,8 @@ class UuidV7Test extends TestCase /** * @param non-empty-string $uuid - * - * @dataProvider provideUuidV7WithMicroseconds */ + #[DataProvider('provideUuidV7WithMicroseconds')] public function testGetDateTimeProperlyHandlesMicroseconds(string $uuid, string $expected): void { /** @var UuidV7 $object */ @@ -78,7 +76,7 @@ class UuidV7Test extends TestCase /** * @return array */ - public function provideUuidV7WithMicroseconds(): array + public static function provideUuidV7WithMicroseconds(): array { return [ [ diff --git a/tests/Rfc4122/UuidV8Test.php b/tests/Rfc4122/UuidV8Test.php index 97cbe97..b870f27 100644 --- a/tests/Rfc4122/UuidV8Test.php +++ b/tests/Rfc4122/UuidV8Test.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test\Rfc4122; use Mockery; +use PHPUnit\Framework\Attributes\DataProvider; use Ramsey\Uuid\Codec\CodecInterface; use Ramsey\Uuid\Converter\NumberConverterInterface; use Ramsey\Uuid\Converter\TimeConverterInterface; @@ -16,9 +17,7 @@ use Ramsey\Uuid\Test\TestCase; class UuidV8Test extends TestCase { - /** - * @dataProvider provideTestVersions - */ + #[DataProvider('provideTestVersions')] public function testConstructorThrowsExceptionWhenFieldsAreNotValidForType(Version $version): void { $fields = Mockery::mock(FieldsInterface::class, [ @@ -41,7 +40,7 @@ class UuidV8Test extends TestCase /** * @return array */ - public function provideTestVersions(): array + public static function provideTestVersions(): array { return [ ['version' => Version::Time], diff --git a/tests/Rfc4122/ValidatorTest.php b/tests/Rfc4122/ValidatorTest.php index 86f2d72..52f46e3 100644 --- a/tests/Rfc4122/ValidatorTest.php +++ b/tests/Rfc4122/ValidatorTest.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test\Rfc4122; +use PHPUnit\Framework\Attributes\DataProvider; use Ramsey\Uuid\Rfc4122\Validator; use Ramsey\Uuid\Test\TestCase; @@ -13,9 +14,7 @@ use function strtoupper; class ValidatorTest extends TestCase { - /** - * @dataProvider provideValuesForValidation - */ + #[DataProvider('provideValuesForValidation')] public function testValidate(string $value, bool $expected): void { $variations = []; @@ -45,7 +44,7 @@ class ValidatorTest extends TestCase /** * @return array */ - public function provideValuesForValidation(): array + public static function provideValuesForValidation(): array { $hexMutations = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'a', 'b', 'c', 'd', 'e', 'f']; $trueVersions = [1, 2, 3, 4, 5, 6, 7, 8]; diff --git a/tests/Rfc4122/VariantTraitTest.php b/tests/Rfc4122/VariantTraitTest.php index 74fc82e..2d379e9 100644 --- a/tests/Rfc4122/VariantTraitTest.php +++ b/tests/Rfc4122/VariantTraitTest.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test\Rfc4122; use Mockery; +use PHPUnit\Framework\Attributes\DataProvider; use Ramsey\Uuid\Exception\InvalidBytesException; use Ramsey\Uuid\Rfc4122\Fields; use Ramsey\Uuid\Rfc4122\VariantTrait; @@ -16,9 +17,7 @@ use function str_replace; class VariantTraitTest extends TestCase { - /** - * @dataProvider invalidBytesProvider - */ + #[DataProvider('invalidBytesProvider')] public function testGetVariantThrowsExceptionForWrongNumberOfBytes(string $bytes): void { /** @var Fields $trait */ @@ -37,7 +36,7 @@ class VariantTraitTest extends TestCase /** * @return array */ - public function invalidBytesProvider(): array + public static function invalidBytesProvider(): array { return [ ['not16Bytes_abcd'], @@ -45,9 +44,7 @@ class VariantTraitTest extends TestCase ]; } - /** - * @dataProvider uuidVariantProvider - */ + #[DataProvider('uuidVariantProvider')] public function testGetVariant(string $uuid, int $expectedVariant): void { $bytes = (string) hex2bin(str_replace('-', '', $uuid)); @@ -65,7 +62,7 @@ class VariantTraitTest extends TestCase /** * @return array */ - public function uuidVariantProvider(): array + public static function uuidVariantProvider(): array { return [ ['ff6f8cb0-c57d-11e1-0b21-0800200c9a66', 0], diff --git a/tests/Type/DecimalTest.php b/tests/Type/DecimalTest.php index f2d0ccb..5f2d5f5 100644 --- a/tests/Type/DecimalTest.php +++ b/tests/Type/DecimalTest.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test\Type; +use PHPUnit\Framework\Attributes\DataProvider; use Ramsey\Uuid\Exception\InvalidArgumentException; use Ramsey\Uuid\Test\TestCase; use Ramsey\Uuid\Type\Decimal; @@ -15,9 +16,7 @@ use function unserialize; class DecimalTest extends TestCase { - /** - * @dataProvider provideDecimal - */ + #[DataProvider('provideDecimal')] public function testDecimalValueType( float | int | Decimal | string $value, string $expected, @@ -33,7 +32,7 @@ class DecimalTest extends TestCase /** * @return array */ - public function provideDecimal(): array + public static function provideDecimal(): array { return [ [ @@ -249,9 +248,7 @@ class DecimalTest extends TestCase ]; } - /** - * @dataProvider provideDecimalBadValues - */ + #[DataProvider('provideDecimalBadValues')] public function testDecimalTypeThrowsExceptionForBadValues(string $value): void { $this->expectException(InvalidArgumentException::class); @@ -266,7 +263,7 @@ class DecimalTest extends TestCase /** * @return array */ - public function provideDecimalBadValues(): array + public static function provideDecimalBadValues(): array { return [ ['123abc'], @@ -278,11 +275,12 @@ class DecimalTest extends TestCase ]; } - /** - * @dataProvider provideDecimal - */ - public function testSerializeUnserializeDecimal(float | int | Decimal | string $value, string $expected): void - { + #[DataProvider('provideDecimal')] + public function testSerializeUnserializeDecimal( + float | int | Decimal | string $value, + string $expected, + bool $expectedIsNegative, + ): void { $decimal = new Decimal($value); $serializedDecimal = serialize($decimal); @@ -292,11 +290,12 @@ class DecimalTest extends TestCase $this->assertSame($expected, $unserializedDecimal->toString()); } - /** - * @dataProvider provideDecimal - */ - public function testJsonSerialize(float | int | Decimal | string $value, string $expected): void - { + #[DataProvider('provideDecimal')] + public function testJsonSerialize( + float | int | Decimal | string $value, + string $expected, + bool $expectedIsNegative, + ): void { $decimal = new Decimal($value); $expectedJson = sprintf('"%s"', $expected); diff --git a/tests/Type/HexadecimalTest.php b/tests/Type/HexadecimalTest.php index 4b40978..f71c0b0 100644 --- a/tests/Type/HexadecimalTest.php +++ b/tests/Type/HexadecimalTest.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test\Type; +use PHPUnit\Framework\Attributes\DataProvider; use Ramsey\Uuid\Exception\InvalidArgumentException; use Ramsey\Uuid\Test\TestCase; use Ramsey\Uuid\Type\Hexadecimal; @@ -17,9 +18,8 @@ class HexadecimalTest extends TestCase { /** * @param Hexadecimal|non-empty-string $value - * - * @dataProvider provideHex */ + #[DataProvider('provideHex')] public function testHexadecimalType(Hexadecimal | string $value, string $expected): void { $hexadecimal = new Hexadecimal($value); @@ -31,7 +31,7 @@ class HexadecimalTest extends TestCase /** * @return array */ - public function provideHex(): array + public static function provideHex(): array { return [ [ @@ -55,9 +55,8 @@ class HexadecimalTest extends TestCase /** * @param non-empty-string $value - * - * @dataProvider provideHexBadValues */ + #[DataProvider('provideHexBadValues')] public function testHexadecimalTypeThrowsExceptionForBadValues(string $value): void { $this->expectException(InvalidArgumentException::class); @@ -71,7 +70,7 @@ class HexadecimalTest extends TestCase /** * @return array */ - public function provideHexBadValues(): array + public static function provideHexBadValues(): array { return [ ['-123456.789'], @@ -83,9 +82,8 @@ class HexadecimalTest extends TestCase /** * @param Hexadecimal|non-empty-string $value - * - * @dataProvider provideHex */ + #[DataProvider('provideHex')] public function testSerializeUnserializeHexadecimal(Hexadecimal | string $value, string $expected): void { $hexadecimal = new Hexadecimal($value); @@ -99,9 +97,8 @@ class HexadecimalTest extends TestCase /** * @param Hexadecimal|non-empty-string $value - * - * @dataProvider provideHex */ + #[DataProvider('provideHex')] public function testJsonSerialize(Hexadecimal | string $value, string $expected): void { $hexadecimal = new Hexadecimal($value); diff --git a/tests/Type/IntegerTest.php b/tests/Type/IntegerTest.php index 9d96bbf..e26a1e4 100644 --- a/tests/Type/IntegerTest.php +++ b/tests/Type/IntegerTest.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test\Type; +use PHPUnit\Framework\Attributes\DataProvider; use Ramsey\Uuid\Exception\InvalidArgumentException; use Ramsey\Uuid\Test\TestCase; use Ramsey\Uuid\Type\Integer as IntegerObject; @@ -17,13 +18,12 @@ class IntegerTest extends TestCase { /** * @param numeric-string $expected - * - * @dataProvider provideInteger */ + #[DataProvider('provideInteger')] public function testIntegerType( float | int | IntegerObject | string $value, string $expected, - bool $expectedIsNegative + bool $expectedIsNegative, ): void { $integer = new IntegerObject($value); @@ -35,7 +35,7 @@ class IntegerTest extends TestCase /** * @return array */ - public function provideInteger(): array + public static function provideInteger(): array { return [ [ @@ -166,9 +166,7 @@ class IntegerTest extends TestCase ]; } - /** - * @dataProvider provideIntegerBadValues - */ + #[DataProvider('provideIntegerBadValues')] public function testIntegerTypeThrowsExceptionForBadValues(float | int | string $value): void { $this->expectException(InvalidArgumentException::class); @@ -183,7 +181,7 @@ class IntegerTest extends TestCase /** * @return array */ - public function provideIntegerBadValues(): array + public static function provideIntegerBadValues(): array { return [ [-9223372036854775809], // String value is "-9.2233720368548E+18" @@ -202,12 +200,12 @@ class IntegerTest extends TestCase /** * @param numeric-string $expected - * - * @dataProvider provideInteger */ + #[DataProvider('provideInteger')] public function testSerializeUnserializeInteger( float | int | IntegerObject | string $value, - string $expected + string $expected, + bool $expectedIsNegative, ): void { $integer = new IntegerObject($value); $serializedInteger = serialize($integer); @@ -220,12 +218,12 @@ class IntegerTest extends TestCase /** * @param numeric-string $expected - * - * @dataProvider provideInteger */ + #[DataProvider('provideInteger')] public function testJsonSerialize( float | int | IntegerObject | string $value, - string $expected + string $expected, + bool $expectedIsNegative, ): void { $integer = new IntegerObject($value); $expectedJson = sprintf('"%s"', $expected); diff --git a/tests/Type/TimeTest.php b/tests/Type/TimeTest.php index ac21e29..3a0d8a0 100644 --- a/tests/Type/TimeTest.php +++ b/tests/Type/TimeTest.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test\Type; +use PHPUnit\Framework\Attributes\DataProvider; use Ramsey\Uuid\Test\TestCase; use Ramsey\Uuid\Type\Integer as IntegerObject; use Ramsey\Uuid\Type\Time; @@ -14,9 +15,7 @@ use function unserialize; class TimeTest extends TestCase { - /** - * @dataProvider provideTimeValues - */ + #[DataProvider('provideTimeValues')] public function testTime( int | IntegerObject | string $seconds, int | IntegerObject | string | null $microseconds @@ -46,7 +45,7 @@ class TimeTest extends TestCase /** * @return array */ - public function provideTimeValues(): array + public static function provideTimeValues(): array { return [ [ @@ -68,9 +67,7 @@ class TimeTest extends TestCase ]; } - /** - * @dataProvider provideTimeValues - */ + #[DataProvider('provideTimeValues')] public function testSerializeUnserializeTime( int | IntegerObject | string $seconds, int | IntegerObject | string | null $microseconds @@ -94,9 +91,7 @@ class TimeTest extends TestCase ); } - /** - * @dataProvider provideTimeValues - */ + #[DataProvider('provideTimeValues')] public function testJsonSerialize( int | IntegerObject | string $seconds, int | IntegerObject | string | null $microseconds diff --git a/tests/UuidFactoryTest.php b/tests/UuidFactoryTest.php index 76222e7..269dcad 100644 --- a/tests/UuidFactoryTest.php +++ b/tests/UuidFactoryTest.php @@ -8,6 +8,7 @@ use DateTime; use DateTimeImmutable; use DateTimeInterface; use Mockery; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\MockObject\MockObject; use Ramsey\Uuid\Builder\UuidBuilderInterface; use Ramsey\Uuid\Codec\CodecInterface; @@ -142,9 +143,8 @@ class UuidFactoryTest extends TestCase /** * @param int<0, 16383>|null $clockSeq - * - * @dataProvider provideDateTime */ + #[DataProvider('provideDateTime')] public function testFromDateTime( DateTimeInterface $dateTime, ?Hexadecimal $node, @@ -164,7 +164,7 @@ class UuidFactoryTest extends TestCase /** * @return array */ - public function provideDateTime(): array + public static function provideDateTime(): array { return [ [ diff --git a/tests/UuidTest.php b/tests/UuidTest.php index 7b6ce5d..a6e4208 100644 --- a/tests/UuidTest.php +++ b/tests/UuidTest.php @@ -11,6 +11,7 @@ use DateTimeImmutable; use DateTimeInterface; use Mockery; use Mockery\MockInterface; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\MockObject\MockObject; use Ramsey\Uuid\Codec\StringCodec; use Ramsey\Uuid\Codec\TimestampFirstCombCodec; @@ -402,9 +403,8 @@ class UuidTest extends TestCase /** * @param non-empty-string $uuid - * - * @dataProvider provideVariousVariantUuids */ + #[DataProvider('provideVariousVariantUuids')] public function testGetVariantForVariousVariantUuids(string $uuid, Variant $variant): void { /** @var \Ramsey\Uuid\Rfc4122\UuidInterface $uuidInstance */ @@ -415,7 +415,7 @@ class UuidTest extends TestCase /** * @return array */ - public function provideVariousVariantUuids(): array + public static function provideVariousVariantUuids(): array { return [ ['ff6f8cb0-c57d-11e1-0b21-0800200c9a66', Variant::ReservedNcs], @@ -806,9 +806,8 @@ class UuidTest extends TestCase * @param non-empty-string $uuid * @param non-empty-string $ns * @param non-empty-string $name - * - * @dataProvider provideUuid3WithKnownUuids */ + #[DataProvider('provideUuid3WithKnownUuids')] public function testUuid3WithKnownUuids(string $uuid, string $ns, string $name): void { /** @var \Ramsey\Uuid\Rfc4122\UuidInterface $uobj1 */ @@ -826,7 +825,7 @@ class UuidTest extends TestCase /** * @return array */ - public function provideUuid3WithKnownUuids(): array + public static function provideUuid3WithKnownUuids(): array { return [ [ @@ -948,9 +947,8 @@ class UuidTest extends TestCase * @param non-empty-string $uuid * @param non-empty-string $ns * @param non-empty-string $name - * - * @dataProvider provideUuid5WithKnownUuids */ + #[DataProvider('provideUuid5WithKnownUuids')] public function testUuid5WithKnownUuids(string $uuid, string $ns, string $name): void { /** @var \Ramsey\Uuid\Rfc4122\UuidInterface $uobj1 */ @@ -968,7 +966,7 @@ class UuidTest extends TestCase /** * @return array */ - public function provideUuid5WithKnownUuids(): array + public static function provideUuid5WithKnownUuids(): array { return [ [ @@ -1303,9 +1301,8 @@ class UuidTest extends TestCase * @param non-empty-string $urn * @param non-empty-string $time * @param non-empty-string $clockSeq - * - * @dataProvider providePythonTests */ + #[DataProvider('providePythonTests')] public function testUuidPassesPythonTests( string $string, string $curly, @@ -1370,12 +1367,12 @@ class UuidTest extends TestCase * fields: array, * urn: non-empty-string, * time: non-empty-string, - * clock_seq: non-empty-string, + * clockSeq: non-empty-string, * variant: Variant, * version: Version | null, * }> */ - public function providePythonTests(): array + public static function providePythonTests(): array { // This array is taken directly from the Python tests, more or less. return [ @@ -1395,7 +1392,7 @@ class UuidTest extends TestCase ], 'urn' => 'urn:uuid:00000000-0000-0000-0000-000000000000', 'time' => '000000000000000', - 'clock_seq' => '0000', + 'clockSeq' => '0000', // This is a departure from the Python tests. The Python tests // are technically "correct" because all bits are set to zero, // so it stands to reason that the variant is also zero, but @@ -1421,7 +1418,7 @@ class UuidTest extends TestCase ], 'urn' => 'urn:uuid:00010203-0405-0607-0809-0a0b0c0d0e0f', 'time' => '607040500010203', - 'clock_seq' => '0809', + 'clockSeq' => '0809', 'variant' => Variant::ReservedNcs, 'version' => null, ], @@ -1441,7 +1438,7 @@ class UuidTest extends TestCase ], 'urn' => 'urn:uuid:02d9e6d5-9467-382e-8f9b-9300a64ac3cd', 'time' => '82e946702d9e6d5', - 'clock_seq' => '0f9b', + 'clockSeq' => '0f9b', 'variant' => Variant::Rfc4122, 'version' => Version::HashMd5, ], @@ -1461,7 +1458,7 @@ class UuidTest extends TestCase ], 'urn' => 'urn:uuid:12345678-1234-5678-1234-567812345678', 'time' => '678123412345678', - 'clock_seq' => '1234', + 'clockSeq' => '1234', 'variant' => Variant::ReservedNcs, 'version' => null, ], @@ -1481,7 +1478,7 @@ class UuidTest extends TestCase ], 'urn' => 'urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8', 'time' => '1d19dad6ba7b810', - 'clock_seq' => '00b4', + 'clockSeq' => '00b4', 'variant' => Variant::Rfc4122, 'version' => Version::Time, ], @@ -1501,7 +1498,7 @@ class UuidTest extends TestCase ], 'urn' => 'urn:uuid:6ba7b811-9dad-11d1-80b4-00c04fd430c8', 'time' => '1d19dad6ba7b811', - 'clock_seq' => '00b4', + 'clockSeq' => '00b4', 'variant' => Variant::Rfc4122, 'version' => Version::Time, ], @@ -1521,7 +1518,7 @@ class UuidTest extends TestCase ], 'urn' => 'urn:uuid:6ba7b812-9dad-11d1-80b4-00c04fd430c8', 'time' => '1d19dad6ba7b812', - 'clock_seq' => '00b4', + 'clockSeq' => '00b4', 'variant' => Variant::Rfc4122, 'version' => Version::Time, ], @@ -1541,7 +1538,7 @@ class UuidTest extends TestCase ], 'urn' => 'urn:uuid:6ba7b814-9dad-11d1-80b4-00c04fd430c8', 'time' => '1d19dad6ba7b814', - 'clock_seq' => '00b4', + 'clockSeq' => '00b4', 'variant' => Variant::Rfc4122, 'version' => Version::Time, ], @@ -1561,7 +1558,7 @@ class UuidTest extends TestCase ], 'urn' => 'urn:uuid:7d444840-9dc0-11d1-b245-5ffdce74fad2', 'time' => '1d19dc07d444840', - 'clock_seq' => '3245', + 'clockSeq' => '3245', 'variant' => Variant::Rfc4122, 'version' => Version::Time, ], @@ -1581,7 +1578,7 @@ class UuidTest extends TestCase ], 'urn' => 'urn:uuid:e902893a-9d22-3c7e-a7b8-d6e313b71d9f', 'time' => 'c7e9d22e902893a', - 'clock_seq' => '27b8', + 'clockSeq' => '27b8', 'variant' => Variant::Rfc4122, 'version' => Version::HashMd5, ], @@ -1601,7 +1598,7 @@ class UuidTest extends TestCase ], 'urn' => 'urn:uuid:eb424026-6f54-4ef8-a4d0-bb658a1fc6cf', 'time' => 'ef86f54eb424026', - 'clock_seq' => '24d0', + 'clockSeq' => '24d0', 'variant' => Variant::Rfc4122, 'version' => Version::Random, ], @@ -1621,7 +1618,7 @@ class UuidTest extends TestCase ], 'urn' => 'urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6', 'time' => '1d07decf81d4fae', - 'clock_seq' => '2765', + 'clockSeq' => '2765', 'variant' => Variant::Rfc4122, 'version' => Version::Time, ], @@ -1641,7 +1638,7 @@ class UuidTest extends TestCase ], 'urn' => 'urn:uuid:fffefdfc-fffe-fffe-fffe-fffefdfcfbfa', 'time' => 'ffefffefffefdfc', - 'clock_seq' => '3ffe', + 'clockSeq' => '3ffe', 'variant' => Variant::ReservedFuture, 'version' => null, ], @@ -1673,16 +1670,13 @@ class UuidTest extends TestCase // However, since all the bits in this UUID are defined as being // set to one, we will consider the clock sequence as 0xffff, // which all bits set to one. - 'clock_seq' => 'ffff', + 'clockSeq' => 'ffff', 'variant' => Variant::Rfc4122, 'version' => null, ], ]; } - /** - * @covers \Ramsey\Uuid\Uuid::jsonSerialize - */ public function testJsonSerialize(): void { $uuid = Uuid::uuid1(); @@ -1747,9 +1741,6 @@ class UuidTest extends TestCase $this->assertSame('b6c54489-38a0-5f50-a60a-fd8d76219cae', $uuid->toString()); } - /** - * @depends testGetVersionForVersion1 - */ public function testUuidVersionConstantForVersion1(): void { /** @var \Ramsey\Uuid\Rfc4122\UuidInterface $uuid */ @@ -1757,9 +1748,6 @@ class UuidTest extends TestCase $this->assertSame($uuid->getFields()->getVersion(), Version::Time); } - /** - * @depends testGetVersionForVersion2 - */ public function testUuidVersionConstantForVersion2(): void { /** @var \Ramsey\Uuid\Rfc4122\UuidInterface $uuid */ @@ -1767,9 +1755,6 @@ class UuidTest extends TestCase $this->assertSame($uuid->getFields()->getVersion(), Version::DceSecurity); } - /** - * @depends testGetVersionForVersion3 - */ public function testUuidVersionConstantForVersion3(): void { /** @var \Ramsey\Uuid\Rfc4122\UuidInterface $uuid */ @@ -1777,9 +1762,6 @@ class UuidTest extends TestCase $this->assertSame($uuid->getFields()->getVersion(), Version::HashMd5); } - /** - * @depends testGetVersionForVersion4 - */ public function testUuidVersionConstantForVersion4(): void { /** @var \Ramsey\Uuid\Rfc4122\UuidInterface $uuid */ @@ -1787,9 +1769,6 @@ class UuidTest extends TestCase $this->assertSame($uuid->getFields()->getVersion(), Version::Random); } - /** - * @depends testGetVersionForVersion5 - */ public function testUuidVersionConstantForVersion5(): void { /** @var \Ramsey\Uuid\Rfc4122\UuidInterface $uuid */ @@ -1842,9 +1821,8 @@ class UuidTest extends TestCase /** * @param array $args - * - * @dataProvider provideStaticMethods */ + #[DataProvider('provideStaticMethods')] public function testStaticCreationMethodsReturnSpecificUuidInstances( string $staticMethod, array $args = [] @@ -1854,9 +1832,8 @@ class UuidTest extends TestCase /** * @param array $args - * - * @dataProvider provideStaticMethods */ + #[DataProvider('provideStaticMethods')] public function testUuidInstancesBuiltFromStringAreEquivalentToTheirGeneratedCounterparts( string $staticMethod, array $args = [] @@ -1872,9 +1849,8 @@ class UuidTest extends TestCase /** * @param array $args - * - * @dataProvider provideStaticMethods */ + #[DataProvider('provideStaticMethods')] public function testUuidInstancesBuiltFromBytesAreEquivalentToTheirGeneratedCounterparts( string $staticMethod, array $args = [] @@ -1891,7 +1867,7 @@ class UuidTest extends TestCase /** * @return array}> */ - public function provideStaticMethods(): array + public static function provideStaticMethods(): array { return [ ['uuid1'], diff --git a/tests/Validator/GenericValidatorTest.php b/tests/Validator/GenericValidatorTest.php index 609ea8c..6d46534 100644 --- a/tests/Validator/GenericValidatorTest.php +++ b/tests/Validator/GenericValidatorTest.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Ramsey\Uuid\Test\Validator; +use PHPUnit\Framework\Attributes\DataProvider; use Ramsey\Uuid\Test\TestCase; use Ramsey\Uuid\Validator\GenericValidator; @@ -12,9 +13,7 @@ use function strtoupper; class GenericValidatorTest extends TestCase { - /** - * @dataProvider provideValuesForValidation - */ + #[DataProvider('provideValuesForValidation')] public function testValidate(string $value, bool $expected): void { $variations = []; @@ -36,7 +35,7 @@ class GenericValidatorTest extends TestCase /** * @return array */ - public function provideValuesForValidation(): array + public static function provideValuesForValidation(): array { $hexMutations = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'a', 'b', 'c', 'd', 'e', 'f'];