phpunit-data-provider

Allows you to mix multiple PhpUnit @dataProvider without duplication

MIT License

Downloads
74.6K
Stars
58
Committers
1
phpunit-data-provider - DataProvider.entries() Latest Release

Published by danon 11 months ago

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.

phpunit-data-provider - We added DataProvider.map()

Published by danon about 1 year ago

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.

phpunit-data-provider - New editing features

Published by danon about 1 year ago

In march this years, we started rewriting the library, inspired by one of our contributors pull requests: https://github.com/t-regx/phpunit-data-provider/pull/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.
phpunit-data-provider - Pairs!

Published by danon almost 5 years ago

We created another utility method, DataProviders::pairs()! that lets you run your phpUnit method with two arguments, for each combination of your data provider elements.

return DataProviders::pairs('png', 'bmp', 'jpg', 'gif');

There's a throughout example in ReadMe.md.


We also dropped support for PHP 5.6 (only PHP 7.0 is supported) and changed the namespace from /TRegx/CrossData to /TRegx/DataProvider.

phpunit-data-provider - CrossDataProviders restructure

Published by danon almost 5 years ago

Previous design wasn't that good, it was more of a personal tool, for the sake of unit tests for T-Regx, but as I saw it was being used, well it's time for a more proper design of methods :)

This means a complete drop of development of 1.0.0.

phpunit-data-provider -

Published by danon over 5 years ago

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 :)

Package Rankings
Top 30.89% on Packagist.org
Badges
Extracted from project README
Build Status Coverage Status Dependencies License Composer lock PHP Version PHP Version PHP Version PHP Version PHP Version PHP Version PHP Version PRs Welcome
Related Projects