{"id":15226355,"url":"https://github.com/henryruhs/phpunit-autoprovide","last_synced_at":"2025-04-09T20:24:12.791Z","repository":{"id":41568160,"uuid":"137463316","full_name":"henryruhs/phpunit-autoprovide","owner":"henryruhs","description":"Magic helper to autoload CSV, JSON, PHP, XML and YAML data provider in PHPUnit","archived":false,"fork":false,"pushed_at":"2024-05-14T11:03:30.000Z","size":51,"stargazers_count":21,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-09-29T20:04:40.758Z","etag":null,"topics":["autoloader","json","phpunit","provider"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/henryruhs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":"henryruhs","custom":"https://paypal.me/henryruhs"}},"created_at":"2018-06-15T08:42:18.000Z","updated_at":"2024-05-14T11:03:34.000Z","dependencies_parsed_at":"2023-11-28T15:28:37.557Z","dependency_job_id":"99be7401-400c-4993-9675-2cac9198f1f8","html_url":"https://github.com/henryruhs/phpunit-autoprovide","commit_stats":{"total_commits":62,"total_committers":3,"mean_commits":"20.666666666666668","dds":"0.11290322580645162","last_synced_commit":"060e131bd39186794de6aa9115493bffe1872f7e"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henryruhs%2Fphpunit-autoprovide","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henryruhs%2Fphpunit-autoprovide/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henryruhs%2Fphpunit-autoprovide/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henryruhs%2Fphpunit-autoprovide/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/henryruhs","download_url":"https://codeload.github.com/henryruhs/phpunit-autoprovide/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219855700,"owners_count":16556091,"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":["autoloader","json","phpunit","provider"],"created_at":"2024-09-28T20:04:45.370Z","updated_at":"2024-10-12T13:02:09.413Z","avatar_url":"https://github.com/henryruhs.png","language":"PHP","funding_links":["https://github.com/sponsors/henryruhs","https://paypal.me/henryruhs"],"categories":[],"sub_categories":[],"readme":"PHPUnit AutoProvide\n===================\n\n\u003e Magic helper to autoload CSV, JSON, PHP, XML and YAML data provider in PHPUnit.\n\n[![Build Status](https://img.shields.io/github/actions/workflow/status/henryruhs/phpunit-autoprovide/ci.yml.svg?branch=master)](https://github.com/henryruhs/phpunit-autoprovide/actions?query=workflow:ci)\n[![Packagist Version](https://img.shields.io/packagist/v/henryruhs/phpunit-autoprovide.svg)](https://packagist.org/packages/henryruhs/phpunit-autoprovide)\n[![License](https://img.shields.io/packagist/l/henryruhs/phpunit-autoprovide.svg)](https://packagist.org/packages/henryruhs/phpunit-autoprovide)\n\n\nInstallation\n------------\n\n```\ncomposer require henryruhs/phpunit-autoprovide\n```\n\n\nSetup\n-----\n\nCreate the `TestCaseAbstract` for your testing suite:\n\n```php\n\u003c?php\nnamespace ExampleProject\\Tests;\n\nuse PHPUnitAutoProvide;\n\n/**\n * TestCaseAbstract\n *\n * @package ExampleProject\n * @category Tests\n */\n\nabstract class TestCaseAbstract extends PHPUnitAutoProvide\\TestCaseAbstract\n{\n\t/**\n\t * directory of the provider\n\t */\n\n\tprotected $_providerDirectory = 'tests' . DIRECTORY_SEPARATOR . 'provider';\n\n\t/**\n\t * namespace of the testing suite\n\t */\n\n\tprotected $_testNamespace = __NAMESPACE__;\n}\n```\n\n\nUsage\n-----\n\nExtend `ExampleTest` from `TestCaseAbstract` and set `@dataProvider` as needed:\n\n```php\n\u003c?php\nnamespace ExampleProject\\Tests;\n\n/**\n * ExampleTest\n *\n * @package ExampleProject\n * @category Tests\n */\n\nclass ExampleTest extends TestCaseAbstract\n{\n\t/**\n\t * testMethod\n\t *\n\t * @param string $expect\n\t *\n\t * @dataProvider autoProvide\n\t */\n\n\tpublic function testMethod(string $expect) : void\n\t{\n\t\t$this-\u003eassertEquals($expect, 'test');\n\t}\n}\n```\n\nCreate the `ExampleTest{_testMethod}.{csv|json|php|xml|yml}` file:\n\n```json\n[\n\t[\n\t\t\"test\"\n\t]\n]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhenryruhs%2Fphpunit-autoprovide","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhenryruhs%2Fphpunit-autoprovide","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhenryruhs%2Fphpunit-autoprovide/lists"}