{"id":15284068,"url":"https://github.com/lloople/phpunit-extensions","last_synced_at":"2025-04-12T23:20:51.124Z","repository":{"id":62518370,"uuid":"231756899","full_name":"Lloople/phpunit-extensions","owner":"Lloople","description":"📦  Some cool extensions for PHPUnit","archived":false,"fork":false,"pushed_at":"2023-09-12T21:24:09.000Z","size":35,"stargazers_count":37,"open_issues_count":1,"forks_count":7,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T17:21:18.369Z","etag":null,"topics":["csv","database","log","php","php-package","phpunit","phpunit-extensions","phpunit-package","testing"],"latest_commit_sha":null,"homepage":"","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/Lloople.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-04T12:09:55.000Z","updated_at":"2025-01-24T11:28:06.000Z","dependencies_parsed_at":"2023-01-22T18:15:11.504Z","dependency_job_id":null,"html_url":"https://github.com/Lloople/phpunit-extensions","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lloople%2Fphpunit-extensions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lloople%2Fphpunit-extensions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lloople%2Fphpunit-extensions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lloople%2Fphpunit-extensions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lloople","download_url":"https://codeload.github.com/Lloople/phpunit-extensions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248644044,"owners_count":21138547,"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":["csv","database","log","php","php-package","phpunit","phpunit-extensions","phpunit-package","testing"],"created_at":"2024-09-30T14:49:04.422Z","updated_at":"2025-04-12T23:20:51.095Z","avatar_url":"https://github.com/Lloople.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHPUnit Extensions\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/lloople/phpunit-extensions.svg?style=flat-square)](https://packagist.org/packages/lloople/phpunit-extensions)\n[![Build Status](https://img.shields.io/travis/lloople/phpunit-extensions/master.svg?style=flat-square)](https://travis-ci.org/lloople/phpunit-extensions)\n[![Quality Score](https://img.shields.io/scrutinizer/g/lloople/phpunit-extensions.svg?style=flat-square)](https://scrutinizer-ci.com/g/lloople/phpunit-extensions)\n[![Total Downloads](https://img.shields.io/packagist/dt/lloople/phpunit-extensions.svg?style=flat-square)](https://packagist.org/packages/lloople/phpunit-extensions)\n[![Buy us a tree](https://img.shields.io/badge/Buy%20James%20a%20tree-🌳-lightgreen)](https://plant.treeware.earth/Lloople/phpunit-extensions)\n\nThis package provides you a few useful extensions for your testsuite in an effort to improve your code.\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require lloople/phpunit-extensions --dev\n```\n\nAdd the Extension to your `phpunit.xml` file:\n\n```xml\n\u003cextensions\u003e\n    \u003cextension class=\"Lloople\\PHPUnitExtensions\\Runners\\SlowestTests\\Console\" /\u003e\n\u003c/extensions\u003e\n```\n\n## Extensions\n\n### Console\n\nOutput the slowest tests on the console.\n\n```xml\n\u003cextension class=\"Lloople\\PHPUnitExtensions\\Runners\\SlowestTests\\Console\"/\u003e\n```\n\n```\nShowing the top 5 slowest tests:\n  543 ms: Tests\\Feature\\ProfileTest::can_upload_new_profile_image\n   26 ms: Tests\\Feature\\ProfileTest::can_visit_profile_page\n   25 ms: Tests\\Feature\\ProfileTest::throws_validation_error_if_password_not_match\n```\n\nDefault options are:\n\n- rows: `5` (Report 5 tests max)\n- min: `200` (Report tests slower than 200ms)\n\n### Csv\n\nWrite the tests in a CSV file ready for import.\n\n```xml\n\u003cextension class=\"Lloople\\PHPUnitExtensions\\Runners\\SlowestTests\\Csv\"/\u003e\n```\n\nDefault options are:\n\n- file: `phpunit_results.csv`\n- rows: `null` (all the tests)\n- min: `200`\n\n### Json\n\nWrite the tests in a JSON file ready for import.\n\n```xml\n\u003cextension class=\"Lloople\\PHPUnitExtensions\\Runners\\SlowestTests\\Json\"/\u003e\n```\n\nDefault options are:\n\n- file: `phpunit_results.json`\n- rows: `null` (all the tests)\n- min: `200`\n\n### MySQL\n\nStore the test name and the time into a MySQL database. It will override existing records\n\n```xml\n\u003cextension class=\"Lloople\\PHPUnitExtensions\\Runners\\SlowestTests\\MySQL\"/\u003e\n```\n\nDefault credentials are (as array):\n\n- database: `phpunit_results`\n- table: `default`\n- username: `root`\n- password: ``\n- host: `127.0.0.1`\n- rows: `null` (all the tests)\n- min: `200`\n\n### SQLite\n\nStore the test name and the time into a SQLite database. It will override existing records\n\n```xml\n\u003cextension class=\"Lloople\\PHPUnitExtensions\\Runners\\SlowestTests\\SQLite\"/\u003e\n```\n\nDefault credentials are (as array):\n\n- database: `phpunit_results.db`\n- table: `default`\n- rows: `null` (all the tests)\n- min: `200`\n\n## Arguments\n\nTo override the default configuration per extension, you need to use `\u003carguments\u003e`in your `phpunit.xml` file\n\n```xml\n\u003cextension class=\"Lloople\\PHPUnitExtensions\\Runners\\SlowestTests\\Json\"\u003e\n  \u003carguments\u003e\n    \u003cstring\u003ephpunit_results_as_json.json\u003c/string\u003e\n    \u003cinteger\u003e10\u003c/integer\u003e \u003c!-- Max number of tests to report. --\u003e\n    \u003cinteger\u003e400\u003c/integer\u003e \u003c!-- Min miliseconds to report a test. --\u003e\n  \u003c/arguments\u003e\n\u003c/extension\u003e\n```\n\nIn the case of the MySQL and SQLite, which needs a database connection, configuration goes as array\n\n```xml\n\u003cextension class=\"Lloople\\PHPUnitExtensions\\Runners\\SlowestTests\\MySQL\"\u003e\n  \u003carguments\u003e\n    \u003carray\u003e\n      \u003celement key=\"database\"\u003e\n        \u003cstring\u003emy_phpunit_results\u003c/string\u003e\n      \u003c/element\u003e\n      \u003celement key=\"table\"\u003e\n        \u003cstring\u003eproject1_test_results\u003c/string\u003e\n      \u003c/element\u003e\n      \u003celement key=\"username\"\u003e\n        \u003cstring\u003ehomestead\u003c/string\u003e\n      \u003c/element\u003e\n      \u003celement key=\"password\"\u003e\n        \u003cstring\u003esecret\u003c/string\u003e\n      \u003c/element\u003e\n      \u003celement key=\"host\"\u003e\n        \u003cstring\u003e192.168.12.14\u003c/string\u003e\n      \u003c/element\u003e\n    \u003c/array\u003e\n  \u003c/arguments\u003e\n\u003c/extension\u003e\n```\n\nYou don't need to override those credentials that already fit to your \nusecase, since the class will merge your configuration with the default one\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Security\n\nIf you discover any security related issues, please email d.lloople@icloud.com instead of using the issue tracker.\n\n## Credits\n\n- [David Llop](https://github.com/lloople)\n- [All Contributors](../../contributors)\n\n## Treeware\n\nYou're free to use this package, but if it is really useful for you I would highly appreciate you [buying the world a tree](https://plant.treeware.earth/Lloople/phpunit-extensions).\n\nIt’s now common knowledge that one of the best tools to tackle the climate crisis and keep our temperatures from rising above 1.5C is to plant trees. If you contribute to [Treeware](https://plant.treeware.earth/Lloople/phpunit-extensions)'s forest you’ll be creating employment for local families and restoring wildlife habitats.\n\nYou can buy trees here [offset.earth/treeware](https://plant.treeware.earth/Lloople/phpunit-extensions)\n\nRead more about Treeware at [treeware.earth](http://treeware.earth)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flloople%2Fphpunit-extensions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flloople%2Fphpunit-extensions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flloople%2Fphpunit-extensions/lists"}