diff --git a/CHANGELOG.md b/CHANGELOG.md index c5636ad5..9bb3b0bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,10 @@ For a full diff see [`1.1.0...main`][1.1.0...main]. * Added `DataProvider\BooleanProvider` ([#326]), by [@localheinz] * Added `DataProvider\NullProvider` ([#327]), by [@localheinz] * Added `DataProvider\StringProvider` ([#328]), by [@localheinz] +* +### Changed + +* Renamed `DataProvider\BooleanProvider` to `DataProvider\BoolProvider` ([#334]), by [@localheinz] ## [`1.1.0`][1.1.0] @@ -117,6 +121,7 @@ For a full diff see [`0.7.0...0.8.0`][0.7.0...0.8.0]. [#326]: https://github.com/ergebnis/test-util/pull/326 [#327]: https://github.com/ergebnis/test-util/pull/327 [#328]: https://github.com/ergebnis/test-util/pull/328 +[#334]: https://github.com/ergebnis/test-util/pull/334 [@ergebnis]: https://github.com/ergebnis [@localheinz]: https://github.com/localheinz diff --git a/README.md b/README.md index eadcf40d..1f38c332 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ In addition to the assertions made available by extending from `PHPUnit\Framewor This package provides the following generic data providers: -* [`Ergebnis\Test\Util\DataProvider\BooleanProvider`](https://github.com/ergebnis/test-util#dataproviderbooleanprovider) +* [`Ergebnis\Test\Util\DataProvider\BoolProvider`](https://github.com/ergebnis/test-util#dataproviderboolprovider) * [`Ergebnis\Test\Util\DataProvider\NullProvider`](https://github.com/ergebnis/test-util#dataprovidernullprovider) * [`Ergebnis\Test\Util\DataProvider\StringProvider`](https://github.com/ergebnis/test-util#dataproviderstringprovider) @@ -134,13 +134,13 @@ final class ExampleTest extends Framework\TestCase } ``` -#### `DataProvider\BooleanProvider` +#### `DataProvider\BoolProvider` * `arbitrary()` provides `true`, `false` * `false()` provides `false` * `true()` provides `true` -For examples, see [`Ergebnis\Test\Util\Test\Unit\DataProvider\BooleanProviderTest`](test/Unit/DataProvider/BooleanProviderTest.php). +For examples, see [`Ergebnis\Test\Util\Test\Unit\DataProvider\BoolProviderTest`](test/Unit/DataProvider/BoolProviderTest.php). #### `DataProvider\NullProvider` diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 6a74247a..6cf03715 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,119 +1,119 @@ parameters: ignoreErrors: - - message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BooleanProvider\\:\\:faker\\(\\) is protected, but since the containing class is final, it can be private\\.$#" + message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BoolProvider\\:\\:faker\\(\\) is protected, but since the containing class is final, it can be private\\.$#" count: 1 - path: src/DataProvider/BooleanProvider.php + path: src/DataProvider/BoolProvider.php - - message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BooleanProvider\\:\\:assertClassesAreAbstractOrFinal\\(\\) is protected, but since the containing class is final, it can be private\\.$#" + message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BoolProvider\\:\\:assertClassesAreAbstractOrFinal\\(\\) is protected, but since the containing class is final, it can be private\\.$#" count: 1 - path: src/DataProvider/BooleanProvider.php + path: src/DataProvider/BoolProvider.php - message: "#^Parameter \\#1 \\$argument of class ReflectionClass constructor expects class\\-string\\\\|T of object, string given\\.$#" count: 2 - path: src/DataProvider/BooleanProvider.php + path: src/DataProvider/BoolProvider.php - - message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BooleanProvider\\:\\:assertClassesHaveTests\\(\\) is protected, but since the containing class is final, it can be private\\.$#" + message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BoolProvider\\:\\:assertClassesHaveTests\\(\\) is protected, but since the containing class is final, it can be private\\.$#" count: 1 - path: src/DataProvider/BooleanProvider.php + path: src/DataProvider/BoolProvider.php - - message: "#^Call to an undefined static method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BooleanProvider\\:\\:assertEmpty\\(\\)\\.$#" + message: "#^Call to an undefined static method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BoolProvider\\:\\:assertEmpty\\(\\)\\.$#" count: 2 - path: src/DataProvider/BooleanProvider.php + path: src/DataProvider/BoolProvider.php - - message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BooleanProvider\\:\\:assertClassyConstructsSatisfySpecification\\(\\) is protected, but since the containing class is final, it can be private\\.$#" + message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BoolProvider\\:\\:assertClassyConstructsSatisfySpecification\\(\\) is protected, but since the containing class is final, it can be private\\.$#" count: 1 - path: src/DataProvider/BooleanProvider.php + path: src/DataProvider/BoolProvider.php - - message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BooleanProvider\\:\\:assertClassExists\\(\\) is protected, but since the containing class is final, it can be private\\.$#" + message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BoolProvider\\:\\:assertClassExists\\(\\) is protected, but since the containing class is final, it can be private\\.$#" count: 1 - path: src/DataProvider/BooleanProvider.php + path: src/DataProvider/BoolProvider.php - - message: "#^Call to an undefined static method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BooleanProvider\\:\\:assertTrue\\(\\)\\.$#" + message: "#^Call to an undefined static method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BoolProvider\\:\\:assertTrue\\(\\)\\.$#" count: 11 - path: src/DataProvider/BooleanProvider.php + path: src/DataProvider/BoolProvider.php - - message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BooleanProvider\\:\\:assertClassExtends\\(\\) is protected, but since the containing class is final, it can be private\\.$#" + message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BoolProvider\\:\\:assertClassExtends\\(\\) is protected, but since the containing class is final, it can be private\\.$#" count: 1 - path: src/DataProvider/BooleanProvider.php + path: src/DataProvider/BoolProvider.php - - message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BooleanProvider\\:\\:assertClassImplementsInterface\\(\\) is protected, but since the containing class is final, it can be private\\.$#" + message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BoolProvider\\:\\:assertClassImplementsInterface\\(\\) is protected, but since the containing class is final, it can be private\\.$#" count: 1 - path: src/DataProvider/BooleanProvider.php + path: src/DataProvider/BoolProvider.php - - message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BooleanProvider\\:\\:assertClassIsAbstract\\(\\) is protected, but since the containing class is final, it can be private\\.$#" + message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BoolProvider\\:\\:assertClassIsAbstract\\(\\) is protected, but since the containing class is final, it can be private\\.$#" count: 1 - path: src/DataProvider/BooleanProvider.php + path: src/DataProvider/BoolProvider.php - - message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BooleanProvider\\:\\:assertClassIsFinal\\(\\) is protected, but since the containing class is final, it can be private\\.$#" + message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BoolProvider\\:\\:assertClassIsFinal\\(\\) is protected, but since the containing class is final, it can be private\\.$#" count: 1 - path: src/DataProvider/BooleanProvider.php + path: src/DataProvider/BoolProvider.php - - message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BooleanProvider\\:\\:assertClassSatisfiesSpecification\\(\\) is protected, but since the containing class is final, it can be private\\.$#" + message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BoolProvider\\:\\:assertClassSatisfiesSpecification\\(\\) is protected, but since the containing class is final, it can be private\\.$#" count: 1 - path: src/DataProvider/BooleanProvider.php + path: src/DataProvider/BoolProvider.php - - message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BooleanProvider\\:\\:assertClassUsesTrait\\(\\) is protected, but since the containing class is final, it can be private\\.$#" + message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BoolProvider\\:\\:assertClassUsesTrait\\(\\) is protected, but since the containing class is final, it can be private\\.$#" count: 1 - path: src/DataProvider/BooleanProvider.php + path: src/DataProvider/BoolProvider.php - - message: "#^Call to an undefined static method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BooleanProvider\\:\\:assertContains\\(\\)\\.$#" + message: "#^Call to an undefined static method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BoolProvider\\:\\:assertContains\\(\\)\\.$#" count: 1 - path: src/DataProvider/BooleanProvider.php + path: src/DataProvider/BoolProvider.php - - message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BooleanProvider\\:\\:assertInterfaceExists\\(\\) is protected, but since the containing class is final, it can be private\\.$#" + message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BoolProvider\\:\\:assertInterfaceExists\\(\\) is protected, but since the containing class is final, it can be private\\.$#" count: 1 - path: src/DataProvider/BooleanProvider.php + path: src/DataProvider/BoolProvider.php - - message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BooleanProvider\\:\\:assertInterfaceExtends\\(\\) is protected, but since the containing class is final, it can be private\\.$#" + message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BoolProvider\\:\\:assertInterfaceExtends\\(\\) is protected, but since the containing class is final, it can be private\\.$#" count: 1 - path: src/DataProvider/BooleanProvider.php + path: src/DataProvider/BoolProvider.php - - message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BooleanProvider\\:\\:assertInterfaceSatisfiesSpecification\\(\\) is protected, but since the containing class is final, it can be private\\.$#" + message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BoolProvider\\:\\:assertInterfaceSatisfiesSpecification\\(\\) is protected, but since the containing class is final, it can be private\\.$#" count: 1 - path: src/DataProvider/BooleanProvider.php + path: src/DataProvider/BoolProvider.php - - message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BooleanProvider\\:\\:assertTraitExists\\(\\) is protected, but since the containing class is final, it can be private\\.$#" + message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BoolProvider\\:\\:assertTraitExists\\(\\) is protected, but since the containing class is final, it can be private\\.$#" count: 1 - path: src/DataProvider/BooleanProvider.php + path: src/DataProvider/BoolProvider.php - - message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BooleanProvider\\:\\:assertTraitSatisfiesSpecification\\(\\) is protected, but since the containing class is final, it can be private\\.$#" + message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BoolProvider\\:\\:assertTraitSatisfiesSpecification\\(\\) is protected, but since the containing class is final, it can be private\\.$#" count: 1 - path: src/DataProvider/BooleanProvider.php + path: src/DataProvider/BoolProvider.php - - message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BooleanProvider\\:\\:provideDataForValues\\(\\) is protected, but since the containing class is final, it can be private\\.$#" + message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BoolProvider\\:\\:provideDataForValues\\(\\) is protected, but since the containing class is final, it can be private\\.$#" count: 1 - path: src/DataProvider/BooleanProvider.php + path: src/DataProvider/BoolProvider.php - - message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BooleanProvider\\:\\:provideDataForValuesWhere\\(\\) is protected, but since the containing class is final, it can be private\\.$#" + message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BoolProvider\\:\\:provideDataForValuesWhere\\(\\) is protected, but since the containing class is final, it can be private\\.$#" count: 1 - path: src/DataProvider/BooleanProvider.php + path: src/DataProvider/BoolProvider.php - - message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BooleanProvider\\:\\:provideDataForValuesWhereNot\\(\\) is protected, but since the containing class is final, it can be private\\.$#" + message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\BoolProvider\\:\\:provideDataForValuesWhereNot\\(\\) is protected, but since the containing class is final, it can be private\\.$#" count: 1 - path: src/DataProvider/BooleanProvider.php + path: src/DataProvider/BoolProvider.php - message: "#^Method Ergebnis\\\\Test\\\\Util\\\\DataProvider\\\\NullProvider\\:\\:faker\\(\\) is protected, but since the containing class is final, it can be private\\.$#" diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 03ed7099..eec48d3e 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,6 +1,6 @@ - + \Generator<string, array{0: bool}> \Generator<string, array{0: bool}> diff --git a/src/DataProvider/BooleanProvider.php b/src/DataProvider/BoolProvider.php similarity index 92% rename from src/DataProvider/BooleanProvider.php rename to src/DataProvider/BoolProvider.php index 84980a99..06802b8a 100644 --- a/src/DataProvider/BooleanProvider.php +++ b/src/DataProvider/BoolProvider.php @@ -15,7 +15,7 @@ use Ergebnis\Test\Util; -final class BooleanProvider +final class BoolProvider { use Util\Helper; @@ -53,8 +53,8 @@ public static function true(): \Generator private static function values(): array { return [ - 'boolean-false' => false, - 'boolean-true' => true, + 'bool-false' => false, + 'bool-true' => true, ]; } } diff --git a/test/Unit/DataProvider/BooleanProviderTest.php b/test/Unit/DataProvider/BoolProviderTest.php similarity index 61% rename from test/Unit/DataProvider/BooleanProviderTest.php rename to test/Unit/DataProvider/BoolProviderTest.php index aa09f46b..73f88765 100644 --- a/test/Unit/DataProvider/BooleanProviderTest.php +++ b/test/Unit/DataProvider/BoolProviderTest.php @@ -13,39 +13,39 @@ namespace Ergebnis\Test\Util\Test\Unit\DataProvider; -use Ergebnis\Test\Util\DataProvider\BooleanProvider; +use Ergebnis\Test\Util\DataProvider\BoolProvider; /** * @internal * - * @covers \Ergebnis\Test\Util\DataProvider\BooleanProvider + * @covers \Ergebnis\Test\Util\DataProvider\BoolProvider */ -final class BooleanProviderTest extends AbstractProviderTestCase +final class BoolProviderTest extends AbstractProviderTestCase { /** - * @dataProvider \Ergebnis\Test\Util\DataProvider\BooleanProvider::arbitrary() + * @dataProvider \Ergebnis\Test\Util\DataProvider\BoolProvider::arbitrary() * * @param mixed $value */ - public function testArbitraryProvidesBoolean($value): void + public function testArbitraryProvidesBool($value): void { self::assertIsBool($value); } - public function testArbitraryReturnsGeneratorThatProvidesBooleanValues(): void + public function testArbitraryReturnsGeneratorThatProvidesBoolValues(): void { $values = [ - 'boolean-false' => false, - 'boolean-true' => true, + 'bool-false' => false, + 'bool-true' => true, ]; - $provider = BooleanProvider::arbitrary(); + $provider = BoolProvider::arbitrary(); self::assertProvidesDataForValues($values, $provider); } /** - * @dataProvider \Ergebnis\Test\Util\DataProvider\BooleanProvider::false() + * @dataProvider \Ergebnis\Test\Util\DataProvider\BoolProvider::false() * * @param mixed $value */ @@ -57,16 +57,16 @@ public function testFalseProvidesFalse($value): void public function testFalseReturnsGeneratorThatProvidesFalse(): void { $values = [ - 'boolean-false' => false, + 'bool-false' => false, ]; - $provider = BooleanProvider::false(); + $provider = BoolProvider::false(); self::assertProvidesDataForValues($values, $provider); } /** - * @dataProvider \Ergebnis\Test\Util\DataProvider\BooleanProvider::true() + * @dataProvider \Ergebnis\Test\Util\DataProvider\BoolProvider::true() * * @param mixed $value */ @@ -78,10 +78,10 @@ public function testTrueProvidesTrue($value): void public function testTrueReturnsGeneratorThatProvidesTrue(): void { $values = [ - 'boolean-true' => true, + 'bool-true' => true, ]; - $provider = BooleanProvider::true(); + $provider = BoolProvider::true(); self::assertProvidesDataForValues($values, $provider); } diff --git a/test/Unit/Exception/InvalidExcludeClassNameTest.php b/test/Unit/Exception/InvalidExcludeClassNameTest.php index 2b1f53e7..99735fa1 100644 --- a/test/Unit/Exception/InvalidExcludeClassNameTest.php +++ b/test/Unit/Exception/InvalidExcludeClassNameTest.php @@ -63,8 +63,8 @@ public function providerInvalidClassName(): \Generator 'bar', 'baz', ], - 'boolean-false' => false, - 'boolean-true' => true, + 'bool-false' => false, + 'bool-true' => true, 'float' => 3.14, 'integer' => 9000, 'null' => null, diff --git a/test/Unit/HelperTest.php b/test/Unit/HelperTest.php index 9bb05293..28b26b06 100644 --- a/test/Unit/HelperTest.php +++ b/test/Unit/HelperTest.php @@ -188,8 +188,8 @@ public function providerInvalidExcludeClassyName(): \Generator 'bar', 'baz', ], - 'boolean-false' => false, - 'boolean-true' => true, + 'bool-false' => false, + 'bool-true' => true, 'float' => 3.14, 'integer' => 9000, 'null' => null,