diff --git a/.github/SECURITY.md b/.github/SECURITY.md new file mode 100644 index 00000000..dd7208fe --- /dev/null +++ b/.github/SECURITY.md @@ -0,0 +1,17 @@ +# Security Policy + +## Supported Versions + +The following versions of `ergebnis/json-pointer` have active support: + +- `^3.2.0` + +## Unsupported Versions + +The following versions of `ergebnis/json-pointer` have reached their end of life: + +- `<3.2.0` + +## Reporting a Vulnerability + +If you believe that you have found a security vulnerability, please send an email to `am@localheinz.com`. Ensure to include all details required to understand the severity of the issue. diff --git a/.github/settings.yml b/.github/settings.yml index 9a516093..330195dc 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -82,6 +82,7 @@ repository: has_pages: false has_projects: false has_wiki: false + is_template: false name: "json-pointer" private: false diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index 3793c815..d66c7ae5 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -30,7 +30,7 @@ jobs: uses: "shivammathur/setup-php@2.25.4" with: coverage: "xdebug" - extensions: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter" + extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter" php-version: "${{ matrix.php-version }}" - name: "Set up problem matchers for PHP" @@ -39,6 +39,9 @@ jobs: - name: "Set up problem matchers for phpunit/phpunit" run: "echo \"::add-matcher::${{ runner.tool_cache }}/phpunit.json\"" + - name: "Validate composer.json and composer.lock" + run: "composer validate --ansi --strict" + - name: "Determine composer cache directory" uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.8.0" @@ -93,7 +96,7 @@ jobs: uses: "shivammathur/setup-php@2.25.4" with: coverage: "none" - extensions: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter" + extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter" php-version: "${{ matrix.php-version }}" - name: "Set up problem matchers for PHP" @@ -121,7 +124,7 @@ jobs: run: "composer normalize --ansi --dry-run" - name: "Create cache directory for friendsofphp/php-cs-fixer" - run: "mkdir -p .build/php-cs-fixer" + run: "mkdir -p .build/php-cs-fixer/" - name: "Cache cache directory for friendsofphp/php-cs-fixer" uses: "actions/cache@v3.3.1" @@ -156,13 +159,16 @@ jobs: uses: "shivammathur/setup-php@2.25.4" with: coverage: "none" - extensions: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter" + extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter" php-version: "${{ matrix.php-version }}" tools: "phive" - name: "Set up problem matchers for PHP" run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\"" + - name: "Validate composer.json and composer.lock" + run: "composer validate --ansi --strict" + - name: "Determine composer cache directory" uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.8.0" @@ -207,12 +213,15 @@ jobs: uses: "shivammathur/setup-php@2.25.4" with: coverage: "xdebug" - extensions: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter" + extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter" php-version: "${{ matrix.php-version }}" - name: "Set up problem matchers for PHP" run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\"" + - name: "Validate composer.json and composer.lock" + run: "composer validate --ansi --strict" + - name: "Determine composer cache directory" uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.8.0" @@ -254,12 +263,15 @@ jobs: uses: "shivammathur/setup-php@2.25.4" with: coverage: "none" - extensions: "none, ctype, dom, intl, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter" + extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter" php-version: "${{ matrix.php-version }}" - name: "Set up problem matchers for PHP" run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\"" + - name: "Validate composer.json and composer.lock" + run: "composer validate --ansi --strict" + - name: "Determine composer cache directory" uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.8.0" @@ -276,7 +288,7 @@ jobs: dependencies: "${{ matrix.dependencies }}" - name: "Create cache directory for rector/rector" - run: "mkdir -p .build/rector" + run: "mkdir -p .build/rector/" - name: "Cache cache directory for rector/rector" uses: "actions/cache@v3.3.1" @@ -311,7 +323,7 @@ jobs: uses: "shivammathur/setup-php@2.25.4" with: coverage: "none" - extensions: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter" + extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter" php-version: "${{ matrix.php-version }}" - name: "Set up problem matchers for PHP" @@ -320,6 +332,21 @@ jobs: - name: "Validate composer.json and composer.lock" run: "composer validate --ansi --strict" + - name: "Determine composer cache directory" + uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.8.0" + + - name: "Cache dependencies installed with composer" + uses: "actions/cache@v3.3.1" + with: + path: "${{ env.COMPOSER_CACHE_DIR }}" + key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" + restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" + + - name: "Install ${{ matrix.dependencies }} dependencies with composer" + uses: "ergebnis/.github/actions/composer/install@1.8.0" + with: + dependencies: "${{ matrix.dependencies }}" + - name: "Check installed packages for security vulnerability advisories" run: "composer audit --ansi" @@ -350,6 +377,9 @@ jobs: - name: "Set up problem matchers for PHP" run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\"" + - name: "Validate composer.json and composer.lock" + run: "composer validate --ansi --strict" + - name: "Determine composer cache directory" uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.8.0" @@ -366,7 +396,7 @@ jobs: dependencies: "${{ matrix.dependencies }}" - name: "Create cache directory for vimeo/psalm" - run: "mkdir -p .build/psalm" + run: "mkdir -p .build/psalm/" - name: "Run vimeo/psalm" run: "vendor/bin/psalm --config=psalm.xml --output-format=github --shepherd --show-info=false --stats --threads=4" @@ -395,7 +425,7 @@ jobs: uses: "shivammathur/setup-php@2.25.4" with: coverage: "none" - extensions: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter" + extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter" php-version: "${{ matrix.php-version }}" - name: "Set up problem matchers for PHP" @@ -404,6 +434,9 @@ jobs: - name: "Set up problem matchers for phpunit/phpunit" run: "echo \"::add-matcher::${{ runner.tool_cache }}/phpunit.json\"" + - name: "Validate composer.json and composer.lock" + run: "composer validate --ansi --strict" + - name: "Determine composer cache directory" uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.8.0" diff --git a/.github/workflows/renew.yaml b/.github/workflows/renew.yaml index 84271082..b4f06703 100644 --- a/.github/workflows/renew.yaml +++ b/.github/workflows/renew.yaml @@ -30,7 +30,7 @@ jobs: uses: "shivammathur/setup-php@2.25.4" with: coverage: "none" - extensions: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter" + extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter" php-version: "${{ matrix.php-version }}" - name: "Set up problem matchers for PHP" diff --git a/.gitignore b/.gitignore index c6b4dc9c..f1cf866a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ /.build/ -/.notes/ +/.note/ /.phive/ /vendor/ !/.phive/phars.xml diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 1e45a8c8..909f0d9f 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -34,11 +34,10 @@ ->exclude([ '.build/', '.github/', - '.notes/', + '.note/', ]) ->ignoreDotFiles(false) - ->in(__DIR__) - ->name('.php-cs-fixer.php'); + ->in(__DIR__); $config->setCacheFile(__DIR__ . '/.build/php-cs-fixer/.php-cs-fixer.cache'); diff --git a/.yamllint.yaml b/.yamllint.yaml index b2129ac2..af99fe0f 100644 --- a/.yamllint.yaml +++ b/.yamllint.yaml @@ -2,7 +2,7 @@ extends: "default" ignore: | .build/ - .notes/ + .note/ vendor/ rules: diff --git a/README.md b/README.md index 516b295c..5dfb617b 100644 --- a/README.md +++ b/README.md @@ -322,6 +322,10 @@ Please have a look at [`CONTRIBUTING.md`](.github/CONTRIBUTING.md). Please have a look at [`CODE_OF_CONDUCT.md`](https://github.com/ergebnis/.github/blob/main/CODE_OF_CONDUCT.md). +## Security Policy + +Please have a look at [`SECURITY.md`](.github/SECURITY.md). + ## License This package is licensed using the MIT License. diff --git a/composer.json b/composer.json index ea981e10..b91667d5 100644 --- a/composer.json +++ b/composer.json @@ -27,6 +27,7 @@ "ergebnis/data-provider": "^2.0.0", "ergebnis/license": "^2.1.0", "ergebnis/php-cs-fixer-config": "^5.10.0", + "ergebnis/phpunit-slow-test-detector": "^2.3.0", "fakerphp/faker": "^1.23.0", "infection/infection": "~0.27.0", "phpunit/phpunit": "^10.2.3", diff --git a/composer.lock b/composer.lock index 89bf0bb1..bdf0451f 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": "12ea4af4f574cb862e42c3b686b4e7bf", + "content-hash": "c78ecf6bfb5a4934a4b220327edd25b5", "packages": [], "packages-dev": [ { @@ -1235,6 +1235,74 @@ }, "time": "2023-06-28T09:15:01+00:00" }, + { + "name": "ergebnis/phpunit-slow-test-detector", + "version": "2.3.0", + "source": { + "type": "git", + "url": "https://github.com/ergebnis/phpunit-slow-test-detector.git", + "reference": "ea03f0fb94a8ba8b2428d5dbbdcda3aa2f6b529a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ergebnis/phpunit-slow-test-detector/zipball/ea03f0fb94a8ba8b2428d5dbbdcda3aa2f6b529a", + "reference": "ea03f0fb94a8ba8b2428d5dbbdcda3aa2f6b529a", + "shasum": "" + }, + "require": { + "php": "~8.1.0 || ~8.2.0", + "phpunit/phpunit": "^10.1.3" + }, + "require-dev": { + "ergebnis/composer-normalize": "^2.31.0", + "ergebnis/data-provider": "^1.3.0", + "ergebnis/license": "^2.1.0", + "ergebnis/php-cs-fixer-config": "^5.7.0", + "fakerphp/faker": "^1.22.0", + "psalm/plugin-phpunit": "~0.18.4", + "rector/rector": "~0.16.0", + "vimeo/psalm": "^5.12.0" + }, + "suggest": { + "phpunit/phpunit": "^10.0.1" + }, + "type": "library", + "extra": { + "composer-normalize": { + "indent-size": 2, + "indent-style": "space" + } + }, + "autoload": { + "psr-4": { + "Ergebnis\\PHPUnit\\SlowTestDetector\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andreas Möller", + "email": "am@localheinz.com" + } + ], + "description": "Provides facilities for detecting slow tests in phpunit/phpunit.", + "homepage": "https://github.com/ergebnis/phpunit-slow-test-detector", + "keywords": [ + "detector", + "extension", + "phpunit", + "slow", + "test" + ], + "support": { + "issues": "https://github.com/ergebnis/phpunit-slow-test-detector/issues", + "source": "https://github.com/ergebnis/phpunit-slow-test-detector" + }, + "time": "2023-05-30T17:23:26+00:00" + }, { "name": "fakerphp/faker", "version": "v1.23.0", diff --git a/psalm-baseline.xml b/psalm-baseline.xml index adc507c6..4a8365f7 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,8 +1,23 @@ - + $referenceTokens + + + provideInvalidJsonStringValue + provideInvalidUriFragmentIdentifierStringValue + provideJsonPointerReferenceTokenAndExpectedJsonPointer + provideJsonStringValueUriFragmentIdentifierStringValueAndReferenceTokens + + + + + provideInvalidJsonStringValue + provideInvalidUriFragmentIdentifierStringValue + provideValueJsonStringValueAndUriFragmentIdentifierStringValue + + diff --git a/rector.php b/rector.php index 545f96a9..4a8847ac 100644 --- a/rector.php +++ b/rector.php @@ -13,6 +13,7 @@ use Rector\Config; use Rector\Core; +use Rector\Php81; use Rector\PHPUnit; return static function (Config\RectorConfig $rectorConfig): void { @@ -27,7 +28,11 @@ $rectorConfig->phpVersion(Core\ValueObject\PhpVersion::PHP_81); + $rectorConfig->rules([ + Php81\Rector\Property\ReadOnlyPropertyRector::class, + ]); + $rectorConfig->sets([ - PHPUnit\Set\PHPUnitSetList::PHPUNIT_90, + PHPUnit\Set\PHPUnitSetList::PHPUNIT_100, ]); }; diff --git a/src/JsonPointer.php b/src/JsonPointer.php index 27e0deac..bf0897b4 100644 --- a/src/JsonPointer.php +++ b/src/JsonPointer.php @@ -23,7 +23,7 @@ final class JsonPointer /** * @var array */ - private array $referenceTokens; + private readonly array $referenceTokens; private function __construct(ReferenceToken ...$referenceTokens) { diff --git a/src/ReferenceToken.php b/src/ReferenceToken.php index 9725ae50..0bd00ba1 100644 --- a/src/ReferenceToken.php +++ b/src/ReferenceToken.php @@ -20,7 +20,7 @@ */ final class ReferenceToken { - private function __construct(private string $value) + private function __construct(private readonly string $value) { } diff --git a/src/Specification.php b/src/Specification.php index 79c42353..1132a69e 100644 --- a/src/Specification.php +++ b/src/Specification.php @@ -18,7 +18,7 @@ final class Specification /** * @param \Closure(JsonPointer):bool $closure */ - private function __construct(private \Closure $closure) + private function __construct(private readonly \Closure $closure) { } diff --git a/test/Unit/Exception/InvalidJsonPointerTest.php b/test/Unit/Exception/InvalidJsonPointerTest.php index 1ca7a98d..d1f36a6b 100644 --- a/test/Unit/Exception/InvalidJsonPointerTest.php +++ b/test/Unit/Exception/InvalidJsonPointerTest.php @@ -17,11 +17,7 @@ use Ergebnis\Json\Pointer\Test; use PHPUnit\Framework; -/** - * @internal - * - * @covers \Ergebnis\Json\Pointer\Exception\InvalidJsonPointer - */ +#[Framework\Attributes\CoversClass(Exception\InvalidJsonPointer::class)] final class InvalidJsonPointerTest extends Framework\TestCase { use Test\Util\Helper; diff --git a/test/Unit/Exception/InvalidReferenceTokenTest.php b/test/Unit/Exception/InvalidReferenceTokenTest.php index 893a16cb..06d03e7f 100644 --- a/test/Unit/Exception/InvalidReferenceTokenTest.php +++ b/test/Unit/Exception/InvalidReferenceTokenTest.php @@ -17,11 +17,7 @@ use Ergebnis\Json\Pointer\Test; use PHPUnit\Framework; -/** - * @internal - * - * @covers \Ergebnis\Json\Pointer\Exception\InvalidReferenceToken - */ +#[Framework\Attributes\CoversClass(Exception\InvalidReferenceToken::class)] final class InvalidReferenceTokenTest extends Framework\TestCase { use Test\Util\Helper; diff --git a/test/Unit/JsonPointerTest.php b/test/Unit/JsonPointerTest.php index 639aee04..c01c4177 100644 --- a/test/Unit/JsonPointerTest.php +++ b/test/Unit/JsonPointerTest.php @@ -18,19 +18,12 @@ use Ergebnis\Json\Pointer\ReferenceToken; use PHPUnit\Framework; -/** - * @internal - * - * @covers \Ergebnis\Json\Pointer\JsonPointer - * - * @uses \Ergebnis\Json\Pointer\Exception\InvalidJsonPointer - * @uses \Ergebnis\Json\Pointer\ReferenceToken - */ +#[Framework\Attributes\CoversClass(JsonPointer::class)] +#[Framework\Attributes\UsesClass(Exception\InvalidJsonPointer::class)] +#[Framework\Attributes\UsesClass(ReferenceToken::class)] final class JsonPointerTest extends Framework\TestCase { - /** - * @dataProvider provideInvalidJsonStringValue - */ + #[Framework\Attributes\DataProvider('provideInvalidJsonStringValue')] public function testFromJsonStringRejectsInvalidValue(string $value): void { $this->expectException(Exception\InvalidJsonPointer::class); @@ -74,10 +67,9 @@ public static function provideInvalidJsonStringValue(): \Generator } /** - * @dataProvider provideJsonStringValueUriFragmentIdentifierStringValueAndReferenceTokens - * * @param array $referenceTokens */ + #[Framework\Attributes\DataProvider('provideJsonStringValueUriFragmentIdentifierStringValueAndReferenceTokens')] public function testFromJsonStringReturnsJsonPointer( string $jsonStringValue, string $uriFragmentIdentifierStringValue, @@ -91,10 +83,9 @@ public function testFromJsonStringReturnsJsonPointer( } /** - * @dataProvider provideJsonStringValueUriFragmentIdentifierStringValueAndReferenceTokens - * * @param array $referenceTokens */ + #[Framework\Attributes\DataProvider('provideJsonStringValueUriFragmentIdentifierStringValueAndReferenceTokens')] public function testFromUriFragmentIdentifierStringReturnsJsonPointer( string $jsonStringValue, string $uriFragmentIdentifierStringValue, @@ -108,10 +99,9 @@ public function testFromUriFragmentIdentifierStringReturnsJsonPointer( } /** - * @dataProvider provideJsonStringValueUriFragmentIdentifierStringValueAndReferenceTokens - * * @param array $referenceTokens */ + #[Framework\Attributes\DataProvider('provideJsonStringValueUriFragmentIdentifierStringValueAndReferenceTokens')] public function testFromReferenceTokensReturnsJsonPointer( string $jsonStringValue, string $uriFragmentIdentifierStringValue, @@ -332,9 +322,7 @@ public static function provideJsonStringValueUriFragmentIdentifierStringValueAnd } } - /** - * @dataProvider provideInvalidUriFragmentIdentifierStringValue - */ + #[Framework\Attributes\DataProvider('provideInvalidUriFragmentIdentifierStringValue')] public function testFromUriFragmentIdentifierStringRejectsInvalidValue(string $value): void { $this->expectException(Exception\InvalidJsonPointer::class); @@ -385,9 +373,7 @@ public function testDocumentReturnsJsonPointer(): void self::assertSame('#', $jsonPointer->toUriFragmentIdentifierString()); } - /** - * @dataProvider provideJsonPointerReferenceTokenAndExpectedJsonPointer - */ + #[Framework\Attributes\DataProvider('provideJsonPointerReferenceTokenAndExpectedJsonPointer')] public function testAppendReturnsJsonPointer( JsonPointer $jsonPointer, ReferenceToken $referenceToken, diff --git a/test/Unit/PatternTest.php b/test/Unit/PatternTest.php index b688f1f0..44109c8c 100644 --- a/test/Unit/PatternTest.php +++ b/test/Unit/PatternTest.php @@ -16,11 +16,7 @@ use Ergebnis\Json\Pointer\Pattern; use PHPUnit\Framework; -/** - * @internal - * - * @covers \Ergebnis\Json\Pointer\Pattern - */ +#[Framework\Attributes\CoversClass(Pattern::class)] final class PatternTest extends Framework\TestCase { /** diff --git a/test/Unit/ReferenceTokenTest.php b/test/Unit/ReferenceTokenTest.php index ed3081b7..aedae8b7 100644 --- a/test/Unit/ReferenceTokenTest.php +++ b/test/Unit/ReferenceTokenTest.php @@ -13,25 +13,19 @@ namespace Ergebnis\Json\Pointer\Test\Unit; +use Ergebnis\DataProvider; use Ergebnis\Json\Pointer\Exception; use Ergebnis\Json\Pointer\ReferenceToken; use Ergebnis\Json\Pointer\Test; use PHPUnit\Framework; -/** - * @internal - * - * @covers \Ergebnis\Json\Pointer\ReferenceToken - * - * @uses \Ergebnis\Json\Pointer\Exception\InvalidReferenceToken - */ +#[Framework\Attributes\CoversClass(ReferenceToken::class)] +#[Framework\Attributes\UsesClass(Exception\InvalidReferenceToken::class)] final class ReferenceTokenTest extends Framework\TestCase { use Test\Util\Helper; - /** - * @dataProvider provideInvalidJsonStringValue - */ + #[Framework\Attributes\DataProvider('provideInvalidJsonStringValue')] public function testFromJsonStringRejectsInvalidValue(string $value): void { $this->expectException(Exception\InvalidReferenceToken::class); @@ -74,9 +68,7 @@ public static function provideInvalidJsonStringValue(): \Generator } } - /** - * @dataProvider provideInvalidUriFragmentIdentifierStringValue - */ + #[Framework\Attributes\DataProvider('provideInvalidUriFragmentIdentifierStringValue')] public function testFromUriFragmentIdentifierStringRejectsInvalidValue(string $value): void { $this->expectException(Exception\InvalidReferenceToken::class); @@ -109,9 +101,7 @@ public static function provideInvalidUriFragmentIdentifierStringValue(): \Genera } } - /** - * @dataProvider provideValueJsonStringValueAndUriFragmentIdentifierStringValue - */ + #[Framework\Attributes\DataProvider('provideValueJsonStringValueAndUriFragmentIdentifierStringValue')] public function testFromJsonStringReturnsReferenceToken( string $value, string $jsonStringValue, @@ -124,9 +114,7 @@ public function testFromJsonStringReturnsReferenceToken( self::assertSame($uriFragmentIdentifierStringValue, $referenceToken->toUriFragmentIdentifierString()); } - /** - * @dataProvider provideValueJsonStringValueAndUriFragmentIdentifierStringValue - */ + #[Framework\Attributes\DataProvider('provideValueJsonStringValueAndUriFragmentIdentifierStringValue')] public function testFromStringReturnsReferenceToken( string $value, string $jsonStringValue, @@ -139,9 +127,7 @@ public function testFromStringReturnsReferenceToken( self::assertSame($uriFragmentIdentifierStringValue, $referenceToken->toUriFragmentIdentifierString()); } - /** - * @dataProvider provideValueJsonStringValueAndUriFragmentIdentifierStringValue - */ + #[Framework\Attributes\DataProvider('provideValueJsonStringValueAndUriFragmentIdentifierStringValue')] public function testFromUriFragmentIdentifierStringReturnsReferenceToken( string $value, string $jsonStringValue, @@ -299,9 +285,7 @@ public static function provideValueJsonStringValueAndUriFragmentIdentifierString } } - /** - * @dataProvider \Ergebnis\DataProvider\IntProvider::lessThanZero() - */ + #[Framework\Attributes\DataProviderExternal(DataProvider\IntProvider::class, 'lessThanZero')] public function testFromIntRejectsInvalidValue(int $value): void { $this->expectException(Exception\InvalidReferenceToken::class); @@ -309,10 +293,8 @@ public function testFromIntRejectsInvalidValue(int $value): void ReferenceToken::fromInt($value); } - /** - * @dataProvider \Ergebnis\DataProvider\IntProvider::greaterThanZero() - * @dataProvider \Ergebnis\DataProvider\IntProvider::zero() - */ + #[Framework\Attributes\DataProviderExternal(DataProvider\IntProvider::class, 'greaterThanZero')] + #[Framework\Attributes\DataProviderExternal(DataProvider\IntProvider::class, 'zero')] public function testFromIntReturnsReferenceToken(int $value): void { $referenceToken = ReferenceToken::fromInt($value); diff --git a/test/Unit/SpecificationTest.php b/test/Unit/SpecificationTest.php index 56d28f96..cd18fa99 100644 --- a/test/Unit/SpecificationTest.php +++ b/test/Unit/SpecificationTest.php @@ -14,18 +14,14 @@ namespace Ergebnis\Json\Pointer\Test\Unit; use Ergebnis\Json\Pointer\JsonPointer; +use Ergebnis\Json\Pointer\ReferenceToken; use Ergebnis\Json\Pointer\Specification; use Ergebnis\Json\Pointer\Test; use PHPUnit\Framework; -/** - * @internal - * - * @covers \Ergebnis\Json\Pointer\Specification - * - * @uses \Ergebnis\Json\Pointer\JsonPointer - * @uses \Ergebnis\Json\Pointer\ReferenceToken - */ +#[Framework\Attributes\CoversClass(Specification::class)] +#[Framework\Attributes\UsesClass(JsonPointer::class)] +#[Framework\Attributes\UsesClass(ReferenceToken::class)] final class SpecificationTest extends Framework\TestCase { use Test\Util\Helper; diff --git a/test/Unit/phpunit.xml b/test/Unit/phpunit.xml index 9a3ee460..f61186b8 100644 --- a/test/Unit/phpunit.xml +++ b/test/Unit/phpunit.xml @@ -11,13 +11,23 @@ cacheResult="true" colors="true" columns="max" + displayDetailsOnIncompleteTests="true" + displayDetailsOnSkippedTests="true" + displayDetailsOnTestsThatTriggerDeprecations="true" + displayDetailsOnTestsThatTriggerErrors="true" + displayDetailsOnTestsThatTriggerNotices="true" + displayDetailsOnTestsThatTriggerWarnings="true" executionOrder="random" + requireCoverageMetadata="true" stopOnError="false" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" > + + + ../../src/