diff --git a/.github/SECURITY.md b/.github/SECURITY.md
new file mode 100644
index 0000000..0245d2a
--- /dev/null
+++ b/.github/SECURITY.md
@@ -0,0 +1,17 @@
+# Security Policy
+
+## Supported Versions
+
+The following versions of `ergebnis/data-provider` have active support:
+
+- `^1.3.0`
+
+## Unsupported Versions
+
+The following versions of `ergebnis/data-provider` have reached their end of life:
+
+- `<1.3.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 841cc15..e9bfa42 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: "data-provider"
private: false
diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml
index 3793c81..d66c7ae 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 8427108..b4f0670 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 c6b4dc9..f1cf866 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,5 @@
/.build/
-/.notes/
+/.note/
/.phive/
/vendor/
!/.phive/phars.xml
diff --git a/.phive/phars.xml b/.phive/phars.xml
index a30ffc0..b195d71 100644
--- a/.phive/phars.xml
+++ b/.phive/phars.xml
@@ -1,4 +1,4 @@
-
+
diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php
index 7b2b024..2207285 100644
--- a/.php-cs-fixer.php
+++ b/.php-cs-fixer.php
@@ -35,11 +35,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 b2129ac..af99fe0 100644
--- a/.yamllint.yaml
+++ b/.yamllint.yaml
@@ -2,7 +2,7 @@ extends: "default"
ignore: |
.build/
- .notes/
+ .note/
vendor/
rules:
diff --git a/Makefile b/Makefile
index 2550f85..fa67999 100644
--- a/Makefile
+++ b/Makefile
@@ -3,14 +3,14 @@ it: refactoring coding-standards security-analysis static-code-analysis tests ##
.PHONY: code-coverage
code-coverage: vendor ## Collects coverage from running unit tests with phpunit/phpunit
- mkdir -p .build/phpunit
+ mkdir -p .build/phpunit/
vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --coverage-text
.PHONY: coding-standards
coding-standards: vendor ## Lints YAML files with yamllint, normalizes composer.json with ergebnis/composer-normalize, and fixes code style issues with friendsofphp/php-cs-fixer
yamllint -c .yamllint.yaml --strict .
composer normalize
- mkdir -p .build/php-cs-fixer
+ mkdir -p .build/php-cs-fixer/
vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --diff --verbose
.PHONY: dependency-analysis
@@ -23,16 +23,17 @@ help: ## Displays this list of targets with descriptions
.PHONY: mutation-tests
mutation-tests: vendor ## Runs mutation tests with infection/infection
- mkdir -p .build/infection
+ mkdir -p .build/infection/
vendor/bin/infection --configuration=infection.json
.PHONY: phive
phive: .phive ## Installs dependencies with phive
- mkdir -p .build/phive
+ mkdir -p .build/phive/
PHIVE_HOME=.build/phive phive install --trust-gpg-keys 0x033E5F8D801A2F8D
.PHONY: refactoring
refactoring: vendor ## Runs automated refactoring with rector/rector
+ mkdir -p .build/rector/
vendor/bin/rector process --config=rector.php
.PHONY: security-analysis
@@ -41,19 +42,19 @@ security-analysis: vendor ## Runs a security analysis with composer
.PHONY: static-code-analysis
static-code-analysis: vendor ## Runs a static code analysis with vimeo/psalm
- mkdir -p .build/psalm
+ mkdir -p .build/psalm/
vendor/bin/psalm --config=psalm.xml --clear-cache
vendor/bin/psalm --config=psalm.xml --show-info=false --stats --threads=4
.PHONY: static-code-analysis-baseline
static-code-analysis-baseline: vendor ## Generates a baseline for static code analysis with vimeo/psalm
- mkdir -p .build/psalm
+ mkdir -p .build/psalm/
vendor/bin/psalm --config=psalm.xml --clear-cache
vendor/bin/psalm --config=psalm.xml --set-baseline=psalm-baseline.xml
.PHONY: tests
tests: vendor ## Runs unit tests with phpunit/phpunit
- mkdir -p .build/phpunit
+ mkdir -p .build/phpunit/
vendor/bin/phpunit --configuration=test/Unit/phpunit.xml
vendor: composer.json composer.lock
diff --git a/README.md b/README.md
index 854470e..409352f 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@
Run
```sh
-composer require --dev ergebnis/data-provider
+composer require ergebnis/data-provider
```
## Usage
@@ -133,6 +133,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 971e7e5..3d47d5e 100644
--- a/composer.json
+++ b/composer.json
@@ -26,6 +26,7 @@
"ergebnis/composer-normalize": "^2.31.0",
"ergebnis/license": "^2.1.0",
"ergebnis/php-cs-fixer-config": "^5.9.2",
+ "ergebnis/phpunit-slow-test-detector": "^2.3.0",
"infection/infection": "~0.27.0",
"phpunit/phpunit": "^10.2.2",
"psalm/plugin-phpunit": "~0.18.4",
diff --git a/composer.lock b/composer.lock
index 84dd876..6e9a21f 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": "d54bc6e93b3735b10231c99a3ee12981",
+ "content-hash": "65f7b369c8100038fdc60e907bbfedcc",
"packages": [
{
"name": "fakerphp/faker",
@@ -1491,6 +1491,74 @@
},
"time": "2023-06-25T20:29:44+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": "felixfbecker/advanced-json-rpc",
"version": "v3.2.1",
diff --git a/psalm-baseline.xml b/psalm-baseline.xml
index 6d70310..e34bfdc 100644
--- a/psalm-baseline.xml
+++ b/psalm-baseline.xml
@@ -74,11 +74,6 @@
assertIsArray
-
-
- $value
-
-
$closure($value)
diff --git a/rector.php b/rector.php
index 85b3e70..2a7a153 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/test/Unit/AbstractProviderTestCase.php b/test/Unit/AbstractProviderTestCase.php
index c217995..08d7e39 100644
--- a/test/Unit/AbstractProviderTestCase.php
+++ b/test/Unit/AbstractProviderTestCase.php
@@ -16,9 +16,6 @@
use Ergebnis\DataProvider\Test;
use PHPUnit\Framework;
-/**
- * @internal
- */
abstract class AbstractProviderTestCase extends Framework\TestCase
{
/**
@@ -29,7 +26,7 @@ final protected static function assertProvidesDataSetsForValues(array $values, \
{
self::assertExpectedValuesAreNotEmpty($values);
- $expectedDataSets = \array_map(static function ($value): array {
+ $expectedDataSets = \array_map(static function (mixed $value): array {
return [
$value,
];
diff --git a/test/Unit/BoolProviderTest.php b/test/Unit/BoolProviderTest.php
index 107f4ae..a563f30 100644
--- a/test/Unit/BoolProviderTest.php
+++ b/test/Unit/BoolProviderTest.php
@@ -13,23 +13,17 @@
namespace Ergebnis\DataProvider\Test\Unit;
+use Ergebnis\DataProvider\AbstractProvider;
use Ergebnis\DataProvider\BoolProvider;
use Ergebnis\DataProvider\Test;
+use PHPUnit\Framework;
-/**
- * @internal
- *
- * @covers \Ergebnis\DataProvider\AbstractProvider
- * @covers \Ergebnis\DataProvider\BoolProvider
- */
+#[Framework\Attributes\CoversClass(AbstractProvider::class)]
+#[Framework\Attributes\CoversClass(BoolProvider::class)]
final class BoolProviderTest extends AbstractProviderTestCase
{
- /**
- * @dataProvider \Ergebnis\DataProvider\BoolProvider::arbitrary()
- *
- * @param mixed $value
- */
- public function testArbitraryProvidesBool($value): void
+ #[Framework\Attributes\DataProviderExternal(BoolProvider::class, 'arbitrary')]
+ public function testArbitraryProvidesBool(mixed $value): void
{
self::assertIsBool($value);
}
@@ -46,12 +40,8 @@ public function testArbitraryReturnsGeneratorThatProvidesBoolValues(): void
self::assertProvidesDataSetsForValuesSatisfyingSpecifications($specifications, $provider);
}
- /**
- * @dataProvider \Ergebnis\DataProvider\BoolProvider::false()
- *
- * @param mixed $value
- */
- public function testFalseProvidesFalse($value): void
+ #[Framework\Attributes\DataProviderExternal(BoolProvider::class, 'false')]
+ public function testFalseProvidesFalse(mixed $value): void
{
self::assertFalse($value);
}
@@ -67,12 +57,8 @@ public function testFalseReturnsGeneratorThatProvidesFalse(): void
self::assertProvidesDataSetsForValuesSatisfyingSpecifications($specifications, $provider);
}
- /**
- * @dataProvider \Ergebnis\DataProvider\BoolProvider::true()
- *
- * @param mixed $value
- */
- public function testTrueProvidesTrue($value): void
+ #[Framework\Attributes\DataProviderExternal(BoolProvider::class, 'true')]
+ public function testTrueProvidesTrue(mixed $value): void
{
self::assertTrue($value);
}
diff --git a/test/Unit/Exception/EmptyValuesTest.php b/test/Unit/Exception/EmptyValuesTest.php
index a83f1b7..841f970 100644
--- a/test/Unit/Exception/EmptyValuesTest.php
+++ b/test/Unit/Exception/EmptyValuesTest.php
@@ -16,11 +16,7 @@
use Ergebnis\DataProvider\Exception;
use PHPUnit\Framework;
-/**
- * @internal
- *
- * @covers \Ergebnis\DataProvider\Exception\EmptyValues
- */
+#[Framework\Attributes\CoversClass(Exception\EmptyValues::class)]
final class EmptyValuesTest extends Framework\TestCase
{
public function testCreateReturnsException(): void
diff --git a/test/Unit/FloatProviderTest.php b/test/Unit/FloatProviderTest.php
index 8738d55..703086f 100644
--- a/test/Unit/FloatProviderTest.php
+++ b/test/Unit/FloatProviderTest.php
@@ -13,23 +13,17 @@
namespace Ergebnis\DataProvider\Test\Unit;
+use Ergebnis\DataProvider\AbstractProvider;
use Ergebnis\DataProvider\FloatProvider;
use Ergebnis\DataProvider\Test;
+use PHPUnit\Framework;
-/**
- * @internal
- *
- * @covers \Ergebnis\DataProvider\AbstractProvider
- * @covers \Ergebnis\DataProvider\FloatProvider
- */
+#[Framework\Attributes\CoversClass(AbstractProvider::class)]
+#[Framework\Attributes\CoversClass(FloatProvider::class)]
final class FloatProviderTest extends AbstractProviderTestCase
{
- /**
- * @dataProvider \Ergebnis\DataProvider\FloatProvider::arbitrary()
- *
- * @param mixed $value
- */
- public function testArbitraryProvidesFloat($value): void
+ #[Framework\Attributes\DataProviderExternal(FloatProvider::class, 'arbitrary')]
+ public function testArbitraryProvidesFloat(mixed $value): void
{
self::assertIsFloat($value);
}
@@ -53,9 +47,7 @@ public function testArbitraryReturnsGeneratorThatProvidesFloatValues(): void
self::assertProvidesDataSetsForValuesSatisfyingSpecifications($specifications, $provider);
}
- /**
- * @dataProvider \Ergebnis\DataProvider\FloatProvider::lessThanZero()
- */
+ #[Framework\Attributes\DataProviderExternal(FloatProvider::class, 'lessThanZero')]
public function testLessThanZeroProvidesFloatLessThanZero(float $value): void
{
self::assertLessThan(0, $value);
@@ -75,9 +67,7 @@ public function testLessThanZeroReturnsGeneratorThatProvidesFloatLessThanZero():
self::assertProvidesDataSetsForValuesSatisfyingSpecifications($specifications, $provider);
}
- /**
- * @dataProvider \Ergebnis\DataProvider\FloatProvider::zero()
- */
+ #[Framework\Attributes\DataProviderExternal(FloatProvider::class, 'zero')]
public function testZeroProvidesZero(float $value): void
{
self::assertSame(0.0, $value);
@@ -94,9 +84,7 @@ public function testZeroReturnsGeneratorThatProvidesZero(): void
self::assertProvidesDataSetsForValuesSatisfyingSpecifications($specifications, $provider);
}
- /**
- * @dataProvider \Ergebnis\DataProvider\FloatProvider::greaterThanZero()
- */
+ #[Framework\Attributes\DataProviderExternal(FloatProvider::class, 'greaterThanZero')]
public function testGreaterThanZeroProvidesFloatGreaterThanZero(float $value): void
{
self::assertGreaterThan(0.0, $value);
@@ -116,9 +104,7 @@ public function testGreaterThanZeroReturnsGeneratorThatProvidesFloatGreaterThanZ
self::assertProvidesDataSetsForValuesSatisfyingSpecifications($specifications, $provider);
}
- /**
- * @dataProvider \Ergebnis\DataProvider\FloatProvider::lessThanOne()
- */
+ #[Framework\Attributes\DataProviderExternal(FloatProvider::class, 'lessThanOne')]
public function testLessThanOneProvidesFloatLessThanOne(float $value): void
{
self::assertLessThan(1, $value);
@@ -150,9 +136,7 @@ public function testOneReturnsGeneratorThatProvidesOne(): void
self::assertProvidesDataSetsForValuesSatisfyingSpecifications($specifications, $provider);
}
- /**
- * @dataProvider \Ergebnis\DataProvider\FloatProvider::greaterThanOne()
- */
+ #[Framework\Attributes\DataProviderExternal(FloatProvider::class, 'greaterThanOne')]
public function testGreaterThanOneProvidesFloatGreaterThanOne(float $value): void
{
self::assertGreaterThan(1, $value);
diff --git a/test/Unit/IntProviderTest.php b/test/Unit/IntProviderTest.php
index 4e19ac5..88a5ff9 100644
--- a/test/Unit/IntProviderTest.php
+++ b/test/Unit/IntProviderTest.php
@@ -13,23 +13,17 @@
namespace Ergebnis\DataProvider\Test\Unit;
+use Ergebnis\DataProvider\AbstractProvider;
use Ergebnis\DataProvider\IntProvider;
use Ergebnis\DataProvider\Test;
+use PHPUnit\Framework;
-/**
- * @internal
- *
- * @covers \Ergebnis\DataProvider\AbstractProvider
- * @covers \Ergebnis\DataProvider\IntProvider
- */
+#[Framework\Attributes\CoversClass(AbstractProvider::class)]
+#[Framework\Attributes\CoversClass(IntProvider::class)]
final class IntProviderTest extends AbstractProviderTestCase
{
- /**
- * @dataProvider \Ergebnis\DataProvider\IntProvider::arbitrary()
- *
- * @param mixed $value
- */
- public function testArbitraryProvidesInt($value): void
+ #[Framework\Attributes\DataProviderExternal(IntProvider::class, 'arbitrary')]
+ public function testArbitraryProvidesInt(mixed $value): void
{
self::assertIsInt($value);
}
@@ -53,9 +47,7 @@ public function testArbitraryReturnsGeneratorThatProvidesIntValues(): void
self::assertProvidesDataSetsForValuesSatisfyingSpecifications($specifications, $provider);
}
- /**
- * @dataProvider \Ergebnis\DataProvider\IntProvider::lessThanZero()
- */
+ #[Framework\Attributes\DataProviderExternal(IntProvider::class, 'lessThanZero')]
public function testLessThanZeroProvidesIntLessThanZero(int $value): void
{
self::assertLessThan(0, $value);
@@ -75,9 +67,7 @@ public function testLessThanZeroReturnsGeneratorThatProvidesIntLessThanZero(): v
self::assertProvidesDataSetsForValuesSatisfyingSpecifications($specifications, $provider);
}
- /**
- * @dataProvider \Ergebnis\DataProvider\IntProvider::zero()
- */
+ #[Framework\Attributes\DataProviderExternal(IntProvider::class, 'zero')]
public function testZeroProvidesZero(int $value): void
{
self::assertSame(0, $value);
@@ -94,9 +84,7 @@ public function testZeroReturnsGeneratorThatProvidesZero(): void
self::assertProvidesDataSetsForValuesSatisfyingSpecifications($specifications, $provider);
}
- /**
- * @dataProvider \Ergebnis\DataProvider\IntProvider::greaterThanZero()
- */
+ #[Framework\Attributes\DataProviderExternal(IntProvider::class, 'greaterThanZero')]
public function testGreaterThanZeroProvidesIntGreaterThanZero(int $value): void
{
self::assertGreaterThan(0, $value);
@@ -116,9 +104,7 @@ public function testGreaterThanZeroReturnsGeneratorThatProvidesIntGreaterThanZer
self::assertProvidesDataSetsForValuesSatisfyingSpecifications($specifications, $provider);
}
- /**
- * @dataProvider \Ergebnis\DataProvider\IntProvider::lessThanOne()
- */
+ #[Framework\Attributes\DataProviderExternal(IntProvider::class, 'lessThanOne')]
public function testLessThanOneProvidesIntLessThanOne(int $value): void
{
self::assertLessThan(1, $value);
@@ -150,9 +136,7 @@ public function testOneReturnsGeneratorThatProvidesOne(): void
self::assertProvidesDataSetsForValuesSatisfyingSpecifications($specifications, $provider);
}
- /**
- * @dataProvider \Ergebnis\DataProvider\IntProvider::greaterThanOne()
- */
+ #[Framework\Attributes\DataProviderExternal(IntProvider::class, 'greaterThanOne')]
public function testGreaterThanOneProvidesIntGreaterThanOne(int $value): void
{
self::assertGreaterThan(1, $value);
diff --git a/test/Unit/NullProviderTest.php b/test/Unit/NullProviderTest.php
index b5486e7..b49b40c 100644
--- a/test/Unit/NullProviderTest.php
+++ b/test/Unit/NullProviderTest.php
@@ -13,23 +13,17 @@
namespace Ergebnis\DataProvider\Test\Unit;
+use Ergebnis\DataProvider\AbstractProvider;
use Ergebnis\DataProvider\NullProvider;
use Ergebnis\DataProvider\Test;
+use PHPUnit\Framework;
-/**
- * @internal
- *
- * @covers \Ergebnis\DataProvider\AbstractProvider
- * @covers \Ergebnis\DataProvider\NullProvider
- */
+#[Framework\Attributes\CoversClass(AbstractProvider::class)]
+#[Framework\Attributes\CoversClass(NullProvider::class)]
final class NullProviderTest extends AbstractProviderTestCase
{
- /**
- * @dataProvider \Ergebnis\DataProvider\NullProvider::null()
- *
- * @param mixed $value
- */
- public function testNullProvidesNull($value): void
+ #[Framework\Attributes\DataProviderExternal(NullProvider::class, 'null')]
+ public function testNullProvidesNull(mixed $value): void
{
self::assertNull($value);
}
diff --git a/test/Unit/ObjectProviderTest.php b/test/Unit/ObjectProviderTest.php
index 81f322a..69289b6 100644
--- a/test/Unit/ObjectProviderTest.php
+++ b/test/Unit/ObjectProviderTest.php
@@ -13,23 +13,17 @@
namespace Ergebnis\DataProvider\Test\Unit;
+use Ergebnis\DataProvider\AbstractProvider;
use Ergebnis\DataProvider\ObjectProvider;
use Ergebnis\DataProvider\Test;
+use PHPUnit\Framework;
-/**
- * @internal
- *
- * @covers \Ergebnis\DataProvider\AbstractProvider
- * @covers \Ergebnis\DataProvider\ObjectProvider
- */
+#[Framework\Attributes\CoversClass(AbstractProvider::class)]
+#[Framework\Attributes\CoversClass(ObjectProvider::class)]
final class ObjectProviderTest extends AbstractProviderTestCase
{
- /**
- * @dataProvider \Ergebnis\DataProvider\ObjectProvider::object()
- *
- * @param mixed $value
- */
- public function testObjectProvidesObject($value): void
+ #[Framework\Attributes\DataProviderExternal(ObjectProvider::class, 'object')]
+ public function testObjectProvidesObject(mixed $value): void
{
self::assertIsObject($value);
}
diff --git a/test/Unit/ResourceProviderTest.php b/test/Unit/ResourceProviderTest.php
index c58a7ef..db92c35 100644
--- a/test/Unit/ResourceProviderTest.php
+++ b/test/Unit/ResourceProviderTest.php
@@ -13,23 +13,17 @@
namespace Ergebnis\DataProvider\Test\Unit;
+use Ergebnis\DataProvider\AbstractProvider;
use Ergebnis\DataProvider\ResourceProvider;
use Ergebnis\DataProvider\Test;
+use PHPUnit\Framework;
-/**
- * @internal
- *
- * @covers \Ergebnis\DataProvider\AbstractProvider
- * @covers \Ergebnis\DataProvider\ResourceProvider
- */
+#[Framework\Attributes\CoversClass(AbstractProvider::class)]
+#[Framework\Attributes\CoversClass(ResourceProvider::class)]
final class ResourceProviderTest extends AbstractProviderTestCase
{
- /**
- * @dataProvider \Ergebnis\DataProvider\ResourceProvider::resource()
- *
- * @param mixed $value
- */
- public function testResourceProvidesResource($value): void
+ #[Framework\Attributes\DataProviderExternal(ResourceProvider::class, 'resource')]
+ public function testResourceProvidesResource(mixed $value): void
{
self::assertIsResource($value);
}
@@ -37,7 +31,7 @@ public function testResourceProvidesResource($value): void
public function testResourceReturnsGeneratorThatProvidesResource(): void
{
$specifications = [
- 'resource' => Test\Util\Specification\Closure::create(static function ($value): bool {
+ 'resource' => Test\Util\Specification\Closure::create(static function (mixed $value): bool {
return \is_resource($value);
}),
];
diff --git a/test/Unit/StringProviderTest.php b/test/Unit/StringProviderTest.php
index 5534cb8..fd4e3ef 100644
--- a/test/Unit/StringProviderTest.php
+++ b/test/Unit/StringProviderTest.php
@@ -13,23 +13,17 @@
namespace Ergebnis\DataProvider\Test\Unit;
+use Ergebnis\DataProvider\AbstractProvider;
use Ergebnis\DataProvider\StringProvider;
use Ergebnis\DataProvider\Test;
+use PHPUnit\Framework;
-/**
- * @internal
- *
- * @covers \Ergebnis\DataProvider\AbstractProvider
- * @covers \Ergebnis\DataProvider\StringProvider
- */
+#[Framework\Attributes\CoversClass(AbstractProvider::class)]
+#[Framework\Attributes\CoversClass(StringProvider::class)]
final class StringProviderTest extends AbstractProviderTestCase
{
- /**
- * @dataProvider \Ergebnis\DataProvider\StringProvider::arbitrary()
- *
- * @param mixed $value
- */
- public function testArbitraryProvidesString($value): void
+ #[Framework\Attributes\DataProviderExternal(StringProvider::class, 'arbitrary')]
+ public function testArbitraryProvidesString(mixed $value): void
{
self::assertIsString($value);
}
@@ -65,9 +59,7 @@ public function testArbitraryReturnsGeneratorThatProvidesArbitraryStrings(): voi
self::assertProvidesDataSetsForValuesSatisfyingSpecifications($specifications, $provider);
}
- /**
- * @dataProvider \Ergebnis\DataProvider\StringProvider::blank()
- */
+ #[Framework\Attributes\DataProviderExternal(StringProvider::class, 'blank')]
public function testBlankProvidesBlankString(string $value): void
{
self::assertSame('', \trim($value));
@@ -88,9 +80,7 @@ public function testBlankReturnsGeneratorThatProvidesStringsThatAreNeitherEmptyN
self::assertProvidesDataSetsForValuesSatisfyingSpecifications($specifications, $provider);
}
- /**
- * @dataProvider \Ergebnis\DataProvider\StringProvider::empty()
- */
+ #[Framework\Attributes\DataProviderExternal(StringProvider::class, 'empty')]
public function testEmptyProvidesEmptyString(string $value): void
{
self::assertSame('', $value);
@@ -107,9 +97,7 @@ public function testEmptyReturnsGeneratorThatProvidesAnEmptyString(): void
self::assertProvidesDataSetsForValuesSatisfyingSpecifications($specifications, $provider);
}
- /**
- * @dataProvider \Ergebnis\DataProvider\StringProvider::untrimmed()
- */
+ #[Framework\Attributes\DataProviderExternal(StringProvider::class, 'untrimmed')]
public function testUntrimmedProvidesUntrimmedString(string $value): void
{
self::assertNotSame(\trim($value), $value);
@@ -117,12 +105,8 @@ public function testUntrimmedProvidesUntrimmedString(string $value): void
self::assertNotSame('', \trim($value));
}
- /**
- * @dataProvider \Ergebnis\DataProvider\StringProvider::trimmed()
- *
- * @param mixed $value
- */
- public function testTrimmedProvidesString($value): void
+ #[Framework\Attributes\DataProviderExternal(StringProvider::class, 'trimmed')]
+ public function testTrimmedProvidesString(mixed $value): void
{
self::assertIsString($value);
}
diff --git a/test/Unit/phpunit.xml b/test/Unit/phpunit.xml
index 9a3ee46..f61186b 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/
diff --git a/test/Util/Specification/Closure.php b/test/Util/Specification/Closure.php
index ff91189..d5236a2 100644
--- a/test/Util/Specification/Closure.php
+++ b/test/Util/Specification/Closure.php
@@ -18,7 +18,7 @@
*/
final class Closure implements Specification
{
- private \Closure $closure;
+ private readonly \Closure $closure;
private function __construct(\Closure $closure)
{
@@ -32,7 +32,7 @@ public static function create(\Closure $closure): self
return new self($closure);
}
- public function isSatisfiedBy($value): bool
+ public function isSatisfiedBy(mixed $value): bool
{
$closure = $this->closure;
diff --git a/test/Util/Specification/Equal.php b/test/Util/Specification/Equal.php
index 1130bcc..236a774 100644
--- a/test/Util/Specification/Equal.php
+++ b/test/Util/Specification/Equal.php
@@ -15,28 +15,16 @@
final class Equal implements Specification
{
- /**
- * @var mixed
- */
- private $value;
-
- /**
- * @param mixed $value
- */
- private function __construct($value)
+ private function __construct(private readonly mixed $value)
{
- $this->value = $value;
}
- /**
- * @param mixed $value
- */
- public static function create($value): self
+ public static function create(mixed $value): self
{
return new self($value);
}
- public function isSatisfiedBy($value): bool
+ public function isSatisfiedBy(mixed $value): bool
{
return $this->value == $value;
}
diff --git a/test/Util/Specification/Identical.php b/test/Util/Specification/Identical.php
index 3f5c642..e0b72d9 100644
--- a/test/Util/Specification/Identical.php
+++ b/test/Util/Specification/Identical.php
@@ -18,28 +18,16 @@
*/
final class Identical implements Specification
{
- /**
- * @var mixed
- */
- private $value;
-
- /**
- * @param mixed $value
- */
- private function __construct($value)
+ private function __construct(private readonly mixed $value)
{
- $this->value = $value;
}
- /**
- * @param mixed $value
- */
- public static function create($value): self
+ public static function create(mixed $value): self
{
return new self($value);
}
- public function isSatisfiedBy($value): bool
+ public function isSatisfiedBy(mixed $value): bool
{
return $this->value === $value;
}
diff --git a/test/Util/Specification/Pattern.php b/test/Util/Specification/Pattern.php
index 9c28687..d5a851d 100644
--- a/test/Util/Specification/Pattern.php
+++ b/test/Util/Specification/Pattern.php
@@ -15,11 +15,8 @@
final class Pattern implements Specification
{
- private string $pattern;
-
- private function __construct(string $pattern)
+ private function __construct(private readonly string $pattern)
{
- $this->pattern = $pattern;
}
public static function create(string $pattern): self
@@ -27,7 +24,7 @@ public static function create(string $pattern): self
return new self($pattern);
}
- public function isSatisfiedBy($value): bool
+ public function isSatisfiedBy(mixed $value): bool
{
if (!\is_string($value)) {
return false;
diff --git a/test/Util/Specification/Specification.php b/test/Util/Specification/Specification.php
index 9cf684b..deb2e5c 100644
--- a/test/Util/Specification/Specification.php
+++ b/test/Util/Specification/Specification.php
@@ -15,8 +15,5 @@
interface Specification
{
- /**
- * @param mixed $value
- */
- public function isSatisfiedBy($value): bool;
+ public function isSatisfiedBy(mixed $value): bool;
}