{"id":15014446,"url":"https://github.com/codeception/verify","last_synced_at":"2025-05-16T12:00:21.021Z","repository":{"id":408272,"uuid":"11649069","full_name":"Codeception/Verify","owner":"Codeception","description":"BDD Assertions for PHPUnit and Codeception","archived":false,"fork":false,"pushed_at":"2025-04-16T14:33:21.000Z","size":1253,"stargazers_count":146,"open_issues_count":2,"forks_count":26,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-05-14T05:38:08.998Z","etag":null,"topics":["assertions","bdd","bdd-assertions","codeception","php","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Codeception.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"docs/supported_expectations.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2013-07-25T01:19:47.000Z","updated_at":"2025-04-16T07:12:06.000Z","dependencies_parsed_at":"2023-12-23T23:02:44.167Z","dependency_job_id":"fb50101b-c8b8-4d35-a380-b3520104f380","html_url":"https://github.com/Codeception/Verify","commit_stats":{"total_commits":108,"total_committers":25,"mean_commits":4.32,"dds":0.8240740740740741,"last_synced_commit":"2e5e707dfbdf4fbe722ba3d06ebd95bb564e2bb2"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Codeception%2FVerify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Codeception%2FVerify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Codeception%2FVerify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Codeception%2FVerify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Codeception","download_url":"https://codeload.github.com/Codeception/Verify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254527071,"owners_count":22085917,"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","bdd","bdd-assertions","codeception","php","phpunit"],"created_at":"2024-09-24T19:45:38.724Z","updated_at":"2025-05-16T12:00:20.748Z","avatar_url":"https://github.com/Codeception.png","language":"PHP","readme":"Verify\n======\n\nBDD Assertions for [PHPUnit][1] or [Codeception][2]\n\n[![Latest Stable Version](https://poser.pugx.org/codeception/verify/v/stable)](https://packagist.org/packages/codeception/verify)\n[![Total Downloads](https://poser.pugx.org/codeception/verify/downloads)](https://packagist.org/packages/codeception/verify)\n[![Build Status](https://travis-ci.org/Codeception/Verify.png?branch=master)](https://travis-ci.org/Codeception/Verify)\n[![License](https://poser.pugx.org/codeception/specify/license)](https://packagist.org/packages/codeception/verify)\n[![StandWithUkraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)\n\n\nThis is very tiny wrapper for PHPUnit assertions, that are aimed to make tests a bit more readable.\nWith [BDD][3] assertions influenced by [Chai][4], [Jasmine][5], and [RSpec][6] your assertions would be a bit closer to natural language.\n\n⚠️ This is the Verify 2.0 documentation, to see v1.x docs click [here.](https://github.com/Codeception/Verify/tree/1.x)\n\n## Installation\n\n*Requires PHP  7.4 or higher*\n\n```\ncomposer require codeception/verify --dev\n```\n\n\u003e :arrow_up: **Upgrade from 1.x by following [the upgrade guide.][10]**\n\n\n## Usage\n\nUse in any test `verify` function instead of `$this-\u003eassert*` methods:\n\n```php\nuse Codeception\\Verify\\Verify;\n\n$user = User::find(1);\n\n// equals\nverify($user-\u003egetName())-\u003eequals('davert');\n\nverify($user-\u003egetNumPosts())\n    -\u003eequals(5, 'user have 5 posts')\n    -\u003enotEquals(3);\n\n// contains\nVerify::Array($user-\u003egetRoles())\n    -\u003econtains('admin', 'first user is admin')\n    -\u003enotContains('banned', 'first user is not banned');\n\n\n// greater / less\nverify($user-\u003egetRate())\n    -\u003egreaterThan(5)\n    -\u003elessThan(10)\n    -\u003eequals(7, 'first user rate is 7');\n\n// true / false / null\nverify($user-\u003eisAdmin())-\u003etrue();\nverify($user-\u003eisBanned())-\u003efalse();\nverify($user-\u003einvitedBy)-\u003enull();\nverify($user-\u003egetPosts())-\u003enotNull();\n\n// empty\nverify($user-\u003egetComments())-\u003eempty();\nverify($user-\u003egetRoles())-\u003enotEmpty();\n\n// throws\nVerify::Callable($callback)\n    -\u003ethrows()\n    -\u003ethrows(Exception::class)\n    -\u003ethrows(Exception::class, 'exception message')\n    -\u003ethrows(new Exception())\n    -\u003ethrows(new Exception('message'));\n\n// does not throw\nVerify::Callable($callback)\n    -\u003edoesNotThrow()\n    -\u003ethrows(Exception::class)\n    -\u003edoesNotThrow(new Exception());\n\n// and many more !\n```\n\n\u003e :page_facing_up: **See Verifiers full list [here.][7]**\n\n## Alternative Syntax\n\nIf you follow TDD/BDD you'd rather use `expect` instead of `verify`:\n\n```php\nexpect($user-\u003egetNumPosts())\n    -\u003enotToBeNull()\n    -\u003etoBeInt()\n    -\u003etoEqual(5, 'user have 5 posts');\n```\n\u003e :page_facing_up: **See Expectations full list [here.][8]**\n\u003e\nOr `verify_that` which is just an alias function:\n\n```php\nverify_that($user-\u003egetRate())-\u003eequals(7, 'first user rate is 7');\n```\n\n## Extending\n\nIn order to add more assertions you can extend the abstract class `Verify`:\n\n```php\nuse Codeception\\Verify\\Verify;\nuse PHPUnit\\Framework\\Assert;\n\nclass MyVerify extends Verify {\n\n    //you can type $actual to only receive a specific data type\n\n    public function __construct($actual = null)\n    {\n        parent::__construct($actual);\n    }\n\n    public function success(string $message = '')\n    {\n        Assert::assertTrue(true, $message);\n    }\n\n}\n```\n\nAnd use it!\n\n```php\n$myVerify = new MyVerify;\n\n$myVerify-\u003esuccess('it works!');\n\n$myVerify::Mixed('this also')-\u003enotEquals('works');\n```\n\n## License\n\nVerify is open-sourced software licensed under the [MIT][9] License.\n© Codeception PHP Testing Framework\n\n[1]: https://phpunit.de/\n[2]: https://codeception.com/\n[3]: https://en.wikipedia.org/wiki/Behavior-driven_development\n[4]: https://chaijs.com/\n[5]: https://jasmine.github.io/\n[6]: https://rspec.info/\n[7]: ./docs/supported_verifiers.md\n[8]: ./docs/supported_expectations.md\n[9]: ./LICENSE\n[10]: ./UPGRADE.md\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeception%2Fverify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodeception%2Fverify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeception%2Fverify/lists"}