Skip to content
This repository has been archived by the owner on Jan 4, 2022. It is now read-only.

Fix: Rename data provider #334

Merged
merged 1 commit into from
Oct 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down Expand Up @@ -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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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`

Expand Down
90 changes: 45 additions & 45 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -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\\>\\|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\\.$#"
Expand Down
2 changes: 1 addition & 1 deletion psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="3.16@d03e5ef057d6adc656c0ff7e166c50b73b4f48f3">
<file src="src/DataProvider/BooleanProvider.php">
<file src="src/DataProvider/BoolProvider.php">
<MoreSpecificReturnType occurrences="3">
<code>\Generator&lt;string, array{0: bool}&gt;</code>
<code>\Generator&lt;string, array{0: bool}&gt;</code>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

use Ergebnis\Test\Util;

final class BooleanProvider
final class BoolProvider
{
use Util\Helper;

Expand Down Expand Up @@ -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,
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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
*/
Expand All @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions test/Unit/Exception/InvalidExcludeClassNameTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions test/Unit/HelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down