{"id":16929578,"url":"https://github.com/ozh/phpunit-overassertive","last_synced_at":"2025-04-11T18:07:52.369Z","repository":{"id":33183475,"uuid":"36825162","full_name":"ozh/phpunit-overassertive","owner":"ozh","description":"Reports tests that contain a high number of assertions","archived":false,"fork":false,"pushed_at":"2020-03-25T13:08:49.000Z","size":5,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-11T18:06:36.615Z","etag":null,"topics":["assertions","extension","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ozh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-03T19:21:08.000Z","updated_at":"2020-03-25T13:08:52.000Z","dependencies_parsed_at":"2022-07-31T10:48:02.639Z","dependency_job_id":null,"html_url":"https://github.com/ozh/phpunit-overassertive","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozh%2Fphpunit-overassertive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozh%2Fphpunit-overassertive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozh%2Fphpunit-overassertive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozh%2Fphpunit-overassertive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ozh","download_url":"https://codeload.github.com/ozh/phpunit-overassertive/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248456370,"owners_count":21106603,"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":["assertions","extension","phpunit"],"created_at":"2024-10-13T20:39:37.505Z","updated_at":"2025-04-11T18:07:52.346Z","avatar_url":"https://github.com/ozh.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# phpunit-overassertive\n\nHaving several assertions in the same test is fine, but when an assertion fails,\nthe whole test aborts and other assertions in the same test are not tested.\n\nDepending on what you test and how you coded it, you may want to split some tests\nin several sub tests.\n\n**OverAssertive** is a PHPUnit extension that reports right in the console\nwhich tests have \"too many\" assertions, where \"too many\" is what you define, to\nhelp you inspect and maybe refactor some tests.\n\n![overassertive](https://cloud.githubusercontent.com/assets/223647/7969423/0d90aaee-0a37-11e5-9f40-a7d29c613017.png)\n\n## Usage\n\nEnable it with all defaults by adding the following to your test suite's `phpunit.xml` file:\n\n```xml\n\u003cphpunit bootstrap=\"vendor/autoload.php\"\u003e\n...\n    \u003clisteners\u003e\n        \u003clistener class=\"Ozh\\PHPUnit\\Listener\\OverAssertiveTestsListener\" /\u003e\n    \u003c/listeners\u003e\n\u003c/phpunit\u003e\n```\n\nIf you're not using an autoloader you can also specify the library location:\n\n```xml\n\u003cphpunit bootstrap=\"boostrap.php\"\u003e\n...\n    \u003clisteners\u003e\n        \u003clistener class=\"Ozh\\PHPUnit\\Listener\\OverAssertiveTestsListener\" file=\"/path/to/OverAssertiveTestsListener.php\" /\u003e\n    \u003c/listeners\u003e\n\u003c/phpunit\u003e\n```\n\nNow run your test suite as normal. OverAssertive will report over assertive tests in the console after the suite completes.\n\n## Configuration\n\nOverAssertive has two configurable parameters:\n\n* **alertThreshold** - Number of assertions that will make a test over assertive (default: 10 assertions)\n* **reportLength** - Number of over assertive tests included in the report (default: 10 tests)\n\nThese configuration parameters are set in `phpunit.xml` when adding the listener:\n\n```xml\n\u003cphpunit ...\u003e\n    \u003c!-- ... other suite configuration here ... --\u003e\n\n    \u003clisteners\u003e\n        \u003clistener class=\"Ozh\\PHPUnit\\Listener\\OverAssertiveTestsListener\"\u003e\n            \u003carguments\u003e\n                \u003carray\u003e\n                    \u003celement key=\"alertThreshold\"\u003e\n                        \u003cinteger\u003e10\u003c/integer\u003e\n                    \u003c/element\u003e\n                    \u003celement key=\"reportLength\"\u003e\n                        \u003cinteger\u003e10\u003c/integer\u003e\n                    \u003c/element\u003e\n                \u003c/array\u003e\n            \u003c/arguments\u003e\n        \u003c/listener\u003e\n    \u003c/listeners\u003e\n\u003c/phpunit\u003e\n```\n\n## Inspiration\n\nMuch thanks to [phpunit-speedtrap](https://github.com/johnkary/phpunit-speedtrap)\n\n## License\n\nDo whatever the hell you want to.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fozh%2Fphpunit-overassertive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fozh%2Fphpunit-overassertive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fozh%2Fphpunit-overassertive/lists"}