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

Commit

Permalink
Merge pull request #334 from ergebnis/fix/rename
Browse files Browse the repository at this point in the history
Fix: Rename data provider
  • Loading branch information
ergebnis-bot committed Oct 3, 2020
2 parents c1e0f3e + 28bad3f commit e034b38
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 71 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
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
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
@@ -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
@@ -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
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,
];
}
}
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
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
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

0 comments on commit e034b38

Please sign in to comment.