Skip to content

Releases: t-regx/phpunit-data-provider

DataProvider.entries()

18 Nov 16:27
Compare
Choose a tag to compare

We added method DataProvider.entries(), which can be used to pass both the key and the value from array rows. It's useful for using already existing collections, of which their keys should also be passed to the test cases.

Test cases are being called with two arguments, the first being the key from the array, and the other being the value (regardless of the value type).

More features will be coming, in current beta there are: DataProvider.filter(), DataProvider.reindex(), DataProvider.reindexTo(), DataProvider.flatMap() and some others.

We added DataProvider.map()

14 Aug 10:19
Compare
Choose a tag to compare

We added method DataProvider.map(), which can be used to map row's values to any other values. It's useful for separating content of the data provider from the form (if the form is non-trivial) and for adapting similar DataProviders to be used in more tests.

More features will be coming, in current beta there are: DataProvider.filter(), DataProvider.reindex(), DataProvider.reindexTo() and some others.

New editing features

08 Aug 18:33
Compare
Choose a tag to compare

In march this years, we started rewriting the library, inspired by one of our contributors pull requests: #54. As always, it appeared to be a weekend job, but took 5 months. We had 3 iterations of revamps of the library, swaping features, checking what works and what doesn't. The orginal gist of the library stays the same of course - seamless usage of PhpUnit data providers, but now with super powers.

This is what we came up with:

DataProvider::list()
DataProvider::join()
DataProvider::zip()
DataProvider::cross()
DataProvider::pairs()
DataProvider::of()
DataProvider::tuples()
DataProvider::dictionary()

Additionally: all DataProvider accepts iterable, properly names each row, always preserves duplicates, differentiates between types (int 4 and string "4") and uses helpful exception messages

The changes are released as 3.0.0 and can be used right away.

We're excited to see how the new library will be used!

Migration from previous version

To use version 3.0.0, migrating from 2.4.0 or earlier:

  • Library namespace changed from \TRegx\DataProvider\ to \TRegx\PhpUnit\DataProviders\ .
  • Change \TRegx\DataProvider\DataProviders::cross() to \TRegx\PhpUnit\DataProviders\DataProvider::cross().
  • Change \TRegx\DataProvider\CrossDataProviders::cross() to \TRegx\PhpUnit\DataProviders\DataProvider::cross().
  • Change your data providers return type from array to iterable or \TRegx\PhpUnit\DataProviders\DataProvider.
  • Removed \TRegx\DataProvider\CrossDataProviders::builder(), use \TRegx\PhpUnit\DataProviders\DataProvider::cross()
    instead.

1.0.0

07 Jun 15:59
Compare
Choose a tag to compare

First release of a small, handy tool for PhpUnit @dataProviders that's used by T-Regx in require-dev; but of course you can use it with any PhpUnit framework or application :)