{"id":28399401,"url":"https://github.com/codeception/assertthrows","last_synced_at":"2025-06-28T19:30:52.580Z","repository":{"id":45233653,"uuid":"111463219","full_name":"Codeception/AssertThrows","owner":"Codeception","description":"Assert exception handling without stopping a test. For PHPUnit 6+","archived":false,"fork":false,"pushed_at":"2025-04-07T15:59:34.000Z","size":24,"stargazers_count":19,"open_issues_count":1,"forks_count":10,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-06-27T12:23:32.735Z","etag":null,"topics":[],"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/Codeception.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-11-20T21:10:28.000Z","updated_at":"2025-03-27T22:12:27.000Z","dependencies_parsed_at":"2022-07-29T22:49:32.482Z","dependency_job_id":"f6d2b203-704c-4b09-b0a0-53d8216d433c","html_url":"https://github.com/Codeception/AssertThrows","commit_stats":{"total_commits":18,"total_committers":9,"mean_commits":2.0,"dds":0.7222222222222222,"last_synced_commit":"e87f75390fccc90037b9411268432fbb69b3f7e9"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/Codeception/AssertThrows","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Codeception%2FAssertThrows","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Codeception%2FAssertThrows/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Codeception%2FAssertThrows/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Codeception%2FAssertThrows/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Codeception","download_url":"https://codeload.github.com/Codeception/AssertThrows/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Codeception%2FAssertThrows/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262483947,"owners_count":23318370,"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":[],"created_at":"2025-06-01T08:09:00.900Z","updated_at":"2025-06-28T19:30:52.564Z","avatar_url":"https://github.com/Codeception.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AssertThrows\n\nHandle exceptions inside a test without a stop! Works with **PHPUnit** and Codeception.\n\n[![Actions Status](https://github.com/Codeception/AssertThrows/workflows/CI/badge.svg)](https://github.com/Codeception/AssertThrows/actions)\n[![Latest Stable Version](https://poser.pugx.org/codeception/Assert-Throws/v/stable)](https://github.com/Codeception/AssertThrows/releases)\n[![Total Downloads](https://poser.pugx.org/codeception/Assert-Throws/downloads)](https://packagist.org/packages/codeception/Assert-Throws)\n[![License](https://poser.pugx.org/codeception/Assert-Throws/license)](/LICENSE)\n\n## Installation\n\n```\ncomposer require \"codeception/assert-throws\" --dev\n```\n\nInclude `AssertThrows` trait it to a TestCase:\n\n```php\n\u003c?php\n\nclass MyTest extends PHPUnit\\Framework\\TestCase\n{\n    use Codeception\\AssertThrows;\n\n    //...\n} \n```\n\n## Usage\n\nCatch exception thrown inside a code block.\n\n```php\n\u003c?php\n\n$this-\u003eassertThrows(NotFoundException::class, function() {\n\t$this-\u003euserController-\u003eshow(99);\n});\n\n// alternatively\n$this-\u003eassertThrows(new NotFoundException(), function() {\n\t$this-\u003euserController-\u003eshow(99);\n});\n\n// you can also assert that an exception is not throw\n$this-\u003eassertDoesNotThrow(NotFoundException::class, function() {\n    $this-\u003euserController-\u003eshow(99);\n});\n```\n\nYou can optionally test the exception message:\n\n```php\n\u003c?php\n\n$this-\u003eassertThrowsWithMessage(\n    NotFoundException::class, 'my error message', function() {\n\tthrow new NotFoundException('my error message');\n    }\n);\n```\n\n## License\n\n`Codeception AssertThrows` is open-sourced software licensed under the [MIT](/LICENSE) License.\n\n© Codeception PHP Testing Framework\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeception%2Fassertthrows","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodeception%2Fassertthrows","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeception%2Fassertthrows/lists"}