{"id":25652986,"url":"https://github.com/devlop/phpunit-exception-assertions","last_synced_at":"2026-05-15T11:32:58.126Z","repository":{"id":56966807,"uuid":"341156930","full_name":"devlop/phpunit-exception-assertions","owner":"devlop","description":"PHPUnit assertions for exceptions.","archived":false,"fork":false,"pushed_at":"2025-09-16T10:21:37.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-16T12:42:36.752Z","etag":null,"topics":["phpunit","phpunit-assertions"],"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/devlop.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-22T10:09:39.000Z","updated_at":"2025-09-16T10:21:21.000Z","dependencies_parsed_at":"2022-08-21T11:20:26.388Z","dependency_job_id":null,"html_url":"https://github.com/devlop/phpunit-exception-assertions","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/devlop/phpunit-exception-assertions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlop%2Fphpunit-exception-assertions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlop%2Fphpunit-exception-assertions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlop%2Fphpunit-exception-assertions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlop%2Fphpunit-exception-assertions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devlop","download_url":"https://codeload.github.com/devlop/phpunit-exception-assertions/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlop%2Fphpunit-exception-assertions/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33065363,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-15T02:00:06.351Z","response_time":103,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["phpunit","phpunit-assertions"],"created_at":"2025-02-23T19:18:36.045Z","updated_at":"2026-05-15T11:32:58.105Z","avatar_url":"https://github.com/devlop.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://packagist.org/packages/devlop/phpunit-exception-assertions\"\u003e\u003cimg src=\"https://img.shields.io/packagist/v/devlop/phpunit-exception-assertions\" alt=\"Latest Stable Version\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/devlop/phpunit-exception-assertions/blob/master/LICENSE.md\"\u003e\u003cimg src=\"https://img.shields.io/packagist/l/devlop/phpunit-exception-assertions\" alt=\"License\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n# PHPUnit Exception Assertions\n\nTrait containing assertions for easier testing of thrown (or not thrown) exceptions.\n\n# Installation\n\n```bash\ncomposer require --dev devlop/phpunit-exception-assertions\n```\n\n# Usage\n\nInclude the trait to get access to the assertions.\n\n```php\nuse Devlop\\PHPUnit\\ExceptionAssertions;\n\nclass YourTest extends TestCase\n{\n    use ExceptionAssertions;\n}\n```\n\n# Available Assertions\n\n## assertExceptionThrown\n\nAsserts that a specific exception was thrown during the execution of the callback,\nif the callback finishes without the exception being thrown, the assertion fails.\n\nTo check for any exception, use `\\Throwable::class` as first argument since all exceptions inherits from [`\\Throwable`](https://www.php.net/manual/en/class.throwable.php).\n\n```php\n$this-\u003eassertExceptionThrown(\\InvalidArgumentException::class, function () : void {\n    // code that should throw the expected exception\n});\n```\n\n## assertExceptionNotThrown\n\nAsserts that a specific exception was not thrown during the execution of the callback,\nif the specified exception was thrown during execution the assertion fails.\n\n**use with caution** - this will only assert that a specific exception was not thrown and\nthe assertion will pass for any other exceptions thrown, intentional or accidental.\nIn most cases it is probably better to `assertNoExceptionsThrown` instead.\n\n```php\n$this-\u003eassertExceptionNotThrown(\\InvalidArgumentException::class, function () : void {\n    // code that should not throw the exception\n});\n```\n\n## assertNoExceptionsThrown\n\nAsserts that no exceptions was thrown during the execution of the callback,\nif any exceptions was thrown during the execution the assertion fails.\n\n```php\n$this-\u003eassertNoExceptionsThrown(function () : void {\n    // code that should not throw any exceptions\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevlop%2Fphpunit-exception-assertions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevlop%2Fphpunit-exception-assertions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevlop%2Fphpunit-exception-assertions/lists"}