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

Fix: Remove data providers #552

Merged
merged 1 commit into from
Jan 3, 2022
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
23 changes: 21 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,23 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## Unreleased

For a full diff see [`1.6.0...main`][1.6.0...main].
For a full diff see [`2.0.0...main`][2.0.0...main].

## [`2.0.0`][2.0.0]

For a full diff see [`1.6.0...2.0.0`][1.6.0...2.0.0].

### Removed

- Removed all data providers ([#552]), by [@localheinz]

If you use any of the data providers, run

```shell
composer require --dev ergebnis/data-provider
```

and replace occurrences of `Ergebnis\Test\Util\DataProvider` with `Ergebnis\DataProvider`.

## [`1.6.0`][1.6.0]

Expand Down Expand Up @@ -162,6 +178,7 @@ For a full diff see [`0.7.0...0.8.0`][0.7.0...0.8.0].
[1.4.0]: https://github.com/ergebnis/test-util/releases/tag/1.4.0
[1.5.0]: https://github.com/ergebnis/test-util/releases/tag/1.5.0
[1.6.0]: https://github.com/ergebnis/test-util/releases/tag/1.6.0
[2.0.0]: https://github.com/ergebnis/test-util/releases/tag/2.0.0

[0.7.0...0.8.0]: https://github.com/ergebnis/test-util/compare/0.7.0...0.8.0
[0.8.0...0.9.0]: https://github.com/ergebnis/test-util/compare/0.8.0...0.9.0
Expand All @@ -175,7 +192,8 @@ For a full diff see [`0.7.0...0.8.0`][0.7.0...0.8.0].
[1.3.1...1.4.0]: https://github.com/ergebnis/test-util/compare/1.3.1...1.4.0
[1.4.0...1.5.0]: https://github.com/ergebnis/test-util/compare/1.4.0...1.5.0
[1.5.0...1.6.0]: https://github.com/ergebnis/test-util/compare/1.5.0...1.6.0
[1.6.0...main]: https://github.com/ergebnis/test-util/compare/1.6.0...main
[1.6.0...2.0.0]: https://github.com/ergebnis/test-util/compare/1.6.0...2.0.0
[2.0.0...main]: https://github.com/ergebnis/test-util/compare/2.0.0...main

[#118]: https://github.com/ergebnis/test-util/pull/118
[#119]: https://github.com/ergebnis/test-util/pull/119
Expand All @@ -202,6 +220,7 @@ For a full diff see [`0.7.0...0.8.0`][0.7.0...0.8.0].
[#540]: https://github.com/ergebnis/test-util/pull/540
[#548]: https://github.com/ergebnis/test-util/pull/548
[#549]: https://github.com/ergebnis/test-util/pull/549
[#552]: https://github.com/ergebnis/test-util/pull/552

[@dependabot]: https://github.com/dependabot
[@ergebnis]: https://github.com/ergebnis
Expand Down
106 changes: 1 addition & 105 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
[![Latest Stable Version](https://poser.pugx.org/ergebnis/test-util/v/stable)](https://packagist.org/packages/ergebnis/test-util)
[![Total Downloads](https://poser.pugx.org/ergebnis/test-util/downloads)](https://packagist.org/packages/ergebnis/test-util)

Provides a helper trait and generic data providers for tests.
Provides a helper trait for tests.

## Installation

Expand Down Expand Up @@ -99,110 +99,6 @@ In addition to the assertions made available by extending from `PHPUnit\Framewor
* `assertTraitExists(string $traitName)`
* `assertTraitSatisfiesSpecification(callable $specification, string $traitName, string $message = '')`

### Data Providers

:exclamation: The data providers have been deprecated. Use [`ergebnis/data-provider`](https://github.com/ergebnis/data-provider) instead.

This package provides the following generic data providers:

* [`Ergebnis\Test\Util\DataProvider\BoolProvider`](https://github.com/ergebnis/test-util#dataproviderboolprovider)
* [`Ergebnis\Test\Util\DataProvider\FloatProvider`](https://github.com/ergebnis/test-util#dataproviderfloatprovider)
* [`Ergebnis\Test\Util\DataProvider\IntProvider`](https://github.com/ergebnis/test-util#dataproviderintprovider)
* [`Ergebnis\Test\Util\DataProvider\NullProvider`](https://github.com/ergebnis/test-util#dataprovidernullprovider)
* [`Ergebnis\Test\Util\DataProvider\ObjectProvider`](https://github.com/ergebnis/test-util#dataproviderobjectprovider)
* [`Ergebnis\Test\Util\DataProvider\ResourceProvider`](https://github.com/ergebnis/test-util#dataproviderresourceprovider)
* [`Ergebnis\Test\Util\DataProvider\StringProvider`](https://github.com/ergebnis/test-util#dataproviderstringprovider)

Since it is possible to use multiple `@dataProvider` annotations for test methods, these generic data providers allow for reuse and composition of data providers:

```php
<?php

declare(strict_types=1);

namespace Example\Test;

use PHPUnit\Framework;

final class ExampleTest extends Framework\TestCase
{
/**
* @dataProvider \Ergebnis\Test\Util\DataProvider\StringProvider::blank()
* @dataProvider \Ergebnis\Test\Util\DataProvider\StringProvider::empty()
*
* @param string $value
*/
public function testFromNameRejectsBlankOrEmptyStrings(string $value): void
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Value can not be an empty or blank string.');

UserName::fromString($value);
}
}
```

#### `DataProvider\BoolProvider`

* `arbitrary()` provides `true`, `false`
* `false()` provides `false`
* `true()` provides `true`

For examples, see [`Ergebnis\Test\Util\Test\Unit\DataProvider\BoolProviderTest`](test/Unit/DataProvider/BoolProviderTest.php).

#### `DataProvider\FloatProvider`

* `arbitrary()` provides arbitrary `float`s
* `greaterThanOne()` provides `int`s greater than `1.0`
* `greaterThanZero()` provides `int`s greater than `0.0`
* `lessThanOne()` provides `int`s less than `1.0`
* `lessThanZero()` provides `int`s less than `0.0`
* `one()` provides `1.0`
* `zero()` provides `0.0`

For examples, see [`Ergebnis\Test\Util\Test\Unit\DataProvider\FloatProviderTest`](test/Unit/DataProvider/FloatProviderTest.php).

#### `DataProvider\IntProvider`

* `arbitrary()` provides arbitrary `int`s
* `greaterThanOne()` provides `int`s greater than `1`
* `greaterThanZero()` provides `int`s greater than `0`
* `lessThanOne()` provides `int`s less than `1`
* `lessThanZero()` provides `int`s less than `0`
* `one()` provides `1`
* `zero()` provides `0`

For examples, see [`Ergebnis\Test\Util\Test\Unit\DataProvider\IntProviderTest`](test/Unit/DataProvider/IntProviderTest.php).

#### `DataProvider\NullProvider`

* `null()` provides `null`

For examples, see [`Ergebnis\Test\Util\Test\Unit\DataProvider\NullProviderTest`](test/Unit/DataProvider/NullProviderTest.php).

#### `DataProvider\ObjectProvider`

* `object()` provides an instance of `stdClass`

For examples, see [`Ergebnis\Test\Util\Test\Unit\DataProvider\ObjectProviderTest`](test/Unit/DataProvider/ObjectProviderTest.php).

#### `DataProvider\ResourceProvider`

* `resource()` provides a `resource`

For examples, see [`Ergebnis\Test\Util\Test\Unit\DataProvider\ResourceProviderTest`](test/Unit/DataProvider/ResourceProviderTest.php).

#### `DataProvider\StringProvider`

* `arbitrary()` provides arbitrary `string`s
* `blank()` provides `string`s consisting of whitespace characters only
* `empty()` provides an empty `string`
* `trimmed()` provides non-empty, non-blank `strings` without leading and trailing whitespace
* `untrimmed()` provides non-empty, non-blank `string`s with additional leading and trailing whitespace
* `withWhitespace()` provides non-empty, non-blank, trimmed `string`s containing whitespace

For examples, see [`Ergebnis\Test\Util\Test\Unit\DataProvider\StringProviderTest`](test/Unit/DataProvider/StringProviderTest.php).

## Changelog

Please have a look at [`CHANGELOG.md`](CHANGELOG.md).
Expand Down
4 changes: 2 additions & 2 deletions infection.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"logs": {
"text": ".build/infection/infection-log.txt"
},
"minCoveredMsi": 89,
"minMsi": 89,
"minCoveredMsi": 92,
"minMsi": 92,
"phpUnit": {
"configDir": "test\/Unit"
},
Expand Down
Loading