Releases: t-regx/phpunit-data-provider
DataProvider.entries()
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()
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 DataProvider
s 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
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
toiterable
or\TRegx\PhpUnit\DataProviders\DataProvider
. - Removed
\TRegx\DataProvider\CrossDataProviders::builder()
, use\TRegx\PhpUnit\DataProviders\DataProvider::cross()
instead.