{"id":20180562,"url":"https://github.com/ergebnis/data-provider","last_synced_at":"2025-04-06T15:13:37.505Z","repository":{"id":37853165,"uuid":"431960211","full_name":"ergebnis/data-provider","owner":"ergebnis","description":"👓 Provides a composer package with generic data providers for use with phpunit/phpunit.","archived":false,"fork":false,"pushed_at":"2024-10-23T17:15:18.000Z","size":3246,"stargazers_count":27,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-24T00:48:09.955Z","etag":null,"topics":["data-provider","phpunit"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ergebnis.png","metadata":{"funding":{"github":["ergebnis","localheinz"]},"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-25T19:46:21.000Z","updated_at":"2024-10-23T17:15:20.000Z","dependencies_parsed_at":"2023-12-03T14:26:31.510Z","dependency_job_id":"31affcb6-f529-48b7-9e87-0417a556e456","html_url":"https://github.com/ergebnis/data-provider","commit_stats":{"total_commits":201,"total_committers":3,"mean_commits":67.0,"dds":0.1840796019900498,"last_synced_commit":"8d850c0eccc9c937f2988975dbfcf21e143007c2"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":"ergebnis/php-package-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ergebnis%2Fdata-provider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ergebnis%2Fdata-provider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ergebnis%2Fdata-provider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ergebnis%2Fdata-provider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ergebnis","download_url":"https://codeload.github.com/ergebnis/data-provider/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247500469,"owners_count":20948880,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-provider","phpunit"],"created_at":"2024-11-14T02:31:43.720Z","updated_at":"2025-04-06T15:13:37.490Z","avatar_url":"https://github.com/ergebnis.png","language":"PHP","funding_links":["https://github.com/sponsors/ergebnis","https://github.com/sponsors/localheinz"],"categories":[],"sub_categories":[],"readme":"# data-provider\n\n[![Integrate](https://github.com/ergebnis/data-provider/workflows/Integrate/badge.svg)](https://github.com/ergebnis/data-provider/actions)\n[![Merge](https://github.com/ergebnis/data-provider/workflows/Merge/badge.svg)](https://github.com/ergebnis/data-provider/actions)\n[![Release](https://github.com/ergebnis/data-provider/workflows/Release/badge.svg)](https://github.com/ergebnis/data-provider/actions)\n[![Renew](https://github.com/ergebnis/data-provider/workflows/Renew/badge.svg)](https://github.com/ergebnis/data-provider/actions)\n\n[![Code Coverage](https://codecov.io/gh/ergebnis/data-provider/branch/main/graph/badge.svg)](https://codecov.io/gh/ergebnis/data-provider)\n\n[![Latest Stable Version](https://poser.pugx.org/ergebnis/data-provider/v/stable)](https://packagist.org/packages/ergebnis/data-provider)\n[![Total Downloads](https://poser.pugx.org/ergebnis/data-provider/downloads)](https://packagist.org/packages/ergebnis/data-provider)\n[![Monthly Downloads](http://poser.pugx.org/ergebnis/data-provider/d/monthly)](https://packagist.org/packages/ergebnis/data-provider)\n\nThis project provides a [`composer`](https://getcomposer.org) package with generic data providers for use with [`phpunit/phpunit`](https://github.com/sebastianbergmann/phpunit).\n\n## Installation\n\nRun\n\n```sh\ncomposer require ergebnis/data-provider\n```\n\n## Usage\n\nThis package provides the following generic data providers:\n\n- [`Ergebnis\\DataProvider\\BoolProvider`](https://github.com/ergebnis/data-provider#dataproviderboolprovider)\n- [`Ergebnis\\DataProvider\\FloatProvider`](https://github.com/ergebnis/data-provider#dataproviderfloatprovider)\n- [`Ergebnis\\DataProvider\\IntProvider`](https://github.com/ergebnis/data-provider#dataproviderintprovider)\n- [`Ergebnis\\DataProvider\\NullProvider`](https://github.com/ergebnis/data-provider#dataprovidernullprovider)\n- [`Ergebnis\\DataProvider\\ObjectProvider`](https://github.com/ergebnis/data-provider#dataproviderobjectprovider)\n- [`Ergebnis\\DataProvider\\ResourceProvider`](https://github.com/ergebnis/data-provider#dataproviderresourceprovider)\n- [`Ergebnis\\DataProvider\\StringProvider`](https://github.com/ergebnis/data-provider#dataproviderstringprovider)\n- [`Ergebnis\\DataProvider\\UuidProvider`](https://github.com/ergebnis/data-provider#dataprovideruuidprovider)\n\nSince it is possible to use multiple [`@dataProvider` annotations](https://docs.phpunit.de/en/10.4/annotations.html#dataprovider) or [`PHPUnit\\Framework\\Attribute\\DataProviderExternal` attributes](https://docs.phpunit.de/en/10.4/attributes.html#dataproviderexternal) for test methods, these generic data providers allow for reuse and composition of data providers:\n\n```php\n\u003c?php\n\ndeclare(strict_types=1);\n\nnamespace Example\\Test;\n\nuse Ergebnis\\DataProvider;\nuse PHPUnit\\Framework;\n\nfinal class ExampleTest extends Framework\\TestCase\n{\n    /**\n     * @dataProvider \\Ergebnis\\DataProvider\\StringProvider::blank()\n     * @dataProvider \\Ergebnis\\DataProvider\\StringProvider::empty()\n     */\n    public function testFromNameRejectsInvalidValueWithAnnotation(string $value): void\n    {\n        $this-\u003eexpectException(\\InvalidArgumentException::class);\n        $this-\u003eexpectExceptionMessage('Value can not be an empty or blank string.');\n\n        UserName::fromString($value);\n    }\n\n    #[Framework\\DataProviderExternal(DataProvider\\StringProvider::class, 'blank')]\n    #[Framework\\DataProviderExternal(DataProvider\\StringProvider::class, 'empty')]\n    public function testFromNameRejectsInvalidValueWithAttribute(string $value): void\n    {\n        $this-\u003eexpectException(\\InvalidArgumentException::class);\n        $this-\u003eexpectExceptionMessage('Value can not be an empty or blank string.');\n\n        UserName::fromString($value);\n    }\n}\n```\n\n#### `DataProvider\\BoolProvider`\n\n- `arbitrary()` provides `true`, `false`\n- `false()` provides `false`\n- `true()` provides `true`\n\nFor examples, see [`Ergebnis\\DataProvider\\Test\\Unit\\BoolProviderTest`](test/Unit/BoolProviderTest.php).\n\n#### `DataProvider\\FloatProvider`\n\n- `arbitrary()` provides arbitrary `float`s\n- `greaterThanOne()` provides `int`s greater than `1.0`\n- `greaterThanZero()` provides `int`s greater than `0.0`\n- `lessThanOne()` provides `int`s less than `1.0`\n- `lessThanZero()` provides `int`s less than `0.0`\n- `one()` provides `1.0`\n- `zero()` provides `0.0`\n\nFor examples, see [`Ergebnis\\DataProvider\\Test\\Unit\\FloatProviderTest`](test/Unit/FloatProviderTest.php).\n\n#### `DataProvider\\IntProvider`\n\n- `arbitrary()` provides arbitrary `int`s\n- `greaterThanOne()` provides `int`s greater than `1`\n- `greaterThanZero()` provides `int`s greater than `0`\n- `lessThanOne()` provides `int`s less than `1`\n- `lessThanZero()` provides `int`s less than `0`\n- `one()` provides `1`\n- `zero()` provides `0`\n\nFor examples, see [`Ergebnis\\DataProvider\\Test\\Unit\\IntProviderTest`](test/Unit/IntProviderTest.php).\n\n#### `DataProvider\\NullProvider`\n\n- `null()` provides `null`\n\nFor examples, see [`Ergebnis\\DataProvider\\Test\\Unit\\NullProviderTest`](test/Unit/NullProviderTest.php).\n\n#### `DataProvider\\ObjectProvider`\n\n- `object()` provides an instance of `stdClass`\n\nFor examples, see [`Ergebnis\\DataProvider\\Test\\Unit\\ObjectProviderTest`](test/Unit/ObjectProviderTest.php).\n\n#### `DataProvider\\ResourceProvider`\n\n- `resource()` provides a `resource`\n\nFor examples, see [`Ergebnis\\DataProvider\\Test\\Unit\\ResourceProviderTest`](test/Unit/ResourceProviderTest.php).\n\n#### `DataProvider\\StringProvider`\n\n- `arbitrary()` provides arbitrary `string`s\n- `blank()` provides `string`s consisting of whitespace characters only\n- `empty()` provides an empty `string`\n- `trimmed()` provides non-empty, non-blank `strings` without leading and trailing whitespace\n- `untrimmed()` provides non-empty, non-blank `string`s with additional leading and trailing whitespace\n- `withWhitespace()` provides non-empty, non-blank, trimmed `string`s containing whitespace\n\nFor examples, see [`Ergebnis\\DataProvider\\Test\\Unit\\StringProviderTest`](test/Unit/StringProviderTest.php).\n\n#### `DataProvider\\UuidProvider`\n\n- `arbitrary()` provides lower- and upper-case UUIDs\n- `caseLower()` provides a lower-case UUIDs\n- `caseUpper()` provides an upper-case UUIDs\n\nFor examples, see [`Ergebnis\\DataProvider\\Test\\Unit\\UuidProviderTest`](test/Unit/UuidProviderTest.php).\n\n## Changelog\n\nThe maintainers of this project record notable changes to this project in a [changelog](CHANGELOG.md).\n\n## Contributing\n\nThe maintainers of this project suggest following the [contribution guide](.github/CONTRIBUTING.md).\n\n## Code of Conduct\n\nThe maintainers of this project ask contributors to follow the [code of conduct](https://github.com/ergebnis/.github/blob/main/CODE_OF_CONDUCT.md).\n\n## General Support Policy\n\nThe maintainers of this project provide limited support.\n\nYou can support the maintenance of this project by [sponsoring @localheinz](https://github.com/sponsors/localheinz) or [requesting an invoice for services related to this project](mailto:am@localheinz.com?subject=ergebnis/data-provider:%20Requesting%20invoice%20for%20services).\n\n## PHP Version Support Policy\n\nThis project supports PHP versions with [active and security support](https://www.php.net/supported-versions.php).\n\nThe maintainers of this project add support for a PHP version following its initial release and drop support for a PHP version when it has reached the end of security support.\n\n## Security Policy\n\nThis project has a [security policy](.github/SECURITY.md).\n\n## License\n\nThis project uses the [MIT license](LICENSE.md).\n\n## Social\n\nFollow [@localheinz](https://twitter.com/intent/follow?screen_name=localheinz) and [@ergebnis](https://twitter.com/intent/follow?screen_name=ergebnis) on Twitter.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fergebnis%2Fdata-provider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fergebnis%2Fdata-provider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fergebnis%2Fdata-provider/lists"}