{"id":20862359,"url":"https://github.com/jpkleemans/phpunit-expect","last_synced_at":"2026-03-13T14:33:04.936Z","repository":{"id":57002006,"uuid":"51204317","full_name":"jpkleemans/phpunit-expect","owner":"jpkleemans","description":"BDD-style assertions for PHPUnit","archived":false,"fork":false,"pushed_at":"2019-04-17T08:18:18.000Z","size":18,"stargazers_count":14,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-17T13:22:02.305Z","etag":null,"topics":["bdd","expect","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/jpkleemans.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":"2016-02-06T13:53:40.000Z","updated_at":"2022-12-21T03:01:42.000Z","dependencies_parsed_at":"2022-08-21T12:10:34.880Z","dependency_job_id":null,"html_url":"https://github.com/jpkleemans/phpunit-expect","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/jpkleemans/phpunit-expect","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpkleemans%2Fphpunit-expect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpkleemans%2Fphpunit-expect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpkleemans%2Fphpunit-expect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpkleemans%2Fphpunit-expect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jpkleemans","download_url":"https://codeload.github.com/jpkleemans/phpunit-expect/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpkleemans%2Fphpunit-expect/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30468318,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-13T11:00:43.441Z","status":"ssl_error","status_checked_at":"2026-03-13T11:00:23.173Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["bdd","expect","phpunit"],"created_at":"2024-11-18T05:20:55.062Z","updated_at":"2026-03-13T14:33:04.900Z","avatar_url":"https://github.com/jpkleemans.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHPUnit Expect\nBDD-style assertions for PHPUnit\n\n## Usage\n\n``` php\n$number = 10;\n\n// Simple expectation\nexpect($number)-\u003etoBe(10);\n\n// Negative expectation\nexpect($number)-\u003enotToBeOfType('string');\n\n// Chained expectations\nexpect($number)\n    -\u003etoBeOfType('int')\n    -\u003etoBeGreaterThan(5)\n    -\u003etoBeLessThan(20);\n```\n\n## Install\n\nWith Composer:\n\n``` bash\ncomposer require jpkleemans/phpunit-expect --dev\n```\n\nOr if you've installed PHPUnit globally:\n\n``` bash\ncomposer global require jpkleemans/phpunit-expect\n```\n\n## Expectations\n\n### toBe\nExpect that two variables have the same type and value.\nUsed on objects, it asserts that two variables reference the same object.\n\n### notToBe\nExpect that two variables do not have the same type and value.\nUsed on objects, it asserts that two variables do not reference the same object.\n\n### toEqual\nExpect that two variables are equal.\n\n### notToEqual\nExpect that two variables are not equal.\n\n### toHaveKey\nExpect that an array has a specified key.\n\n### notToHaveKey\nExpect that an array does not have a specified key.\n\n### toHaveSubset\nExpect that an array has a specified subset.\n\n### toContain\nExpect that a haystack contains a needle.\n\n### notToContain\nExpect that a haystack does not contain a needle.\n\n### toContainOnly\nExpect that a haystack contains only values of a given type.\n\n### notToContainOnly\nExpect that a haystack does not contain only values of a given type.\n\n### toContainOnlyInstancesOf\nExpect that a haystack contains only instances of a given classname\n\n### toHaveCount\nExpect the number of elements of an array, Countable or Traversable.\n\n### notToHaveCount\nExpect the number of elements of an array, Countable or Traversable.\n\n### toBeEmpty\nExpect that a variable is empty.\n\n### notToBeEmpty\nExpect that a variable is not empty.\n\n### toBeGreaterThan\nExpect that a value is greater than another value.\n\n### toBeGreaterThanOrEqualTo\nExpect that a value is greater than or equal to another value.\n\n### toBeLessThan\nExpect that a value is smaller than another value.\n\n### toBeLessThanOrEqualTo\nExpect that a value is smaller than or equal to another value.\n\n### toEqualFile\nExpect that the contents of one file or a string is equal to the contents of another file.\n\n### notToEqualFile\nExpect that the contents of one file or a string is not equal to the contents of another file.\n\n### toExist\nExpect that a file exists.\n\n### notToExist\nExpect that a file does not exist.\n\n### toBeTrue\nExpect that a condition is true.\n\n### notToBeTrue\nExpect that a condition is not true.\n\n### toBeFalse\nExpect that a condition is false.\n\n### notToBeFalse\nExpect that a condition is not false.\n\n### toBeNull\nExpect that a variable is null.\n\n### notToBeNull\nExpect that a variable is not null.\n\n### toBeFinite\nExpect that a variable is finite.\n\n### toBeInfinite\nExpect that a variable is infinite.\n\n### toBeNan\nExpect that a variable is nan.\n\n### toHaveAttribute\nExpect that a class or an object has a specified attribute.\n\n### notToHaveAttribute\nExpect that a class or an object does not have a specified attribute.\n\n### toHaveStaticAttribute\nExpect that a class has a specified static attribute.\n\n### notToHaveStaticAttribute\nExpect that a class does not have a specified static attribute.\n\n### toBeInstanceOf\nExpect that a variable is of a given type.\n\n### notToBeInstanceOf\nExpect that a variable is not of a given type.\n\n### toBeOfType\nExpect that a variable is of a given type.\n\n### notToBeOfType\nExpect that a variable is not of a given type.\n\n### toMatchRegExp\nExpect that a string matches a given regular expression.\n\n### notToMatchRegExp\nExpect that a string does not match a given regular expression.\n\n### toHaveSameSizeAs\nAssert that the size of two arrays (or `Countable` or `Traversable` objects) is the same.\n\n### notToHaveSameSizeAs\nAssert that the size of two arrays (or `Countable` or `Traversable` objects) is not the same.\n\n### toMatchFormat\nExpect that a string matches a given format string.\n\n### notToMatchFormat\nExpect that a string does not match a given format string.\n\n### toMatchFormatFile\nExpect that a string matches a given format file.\n\n### notToMatchFormatFile\nExpect that a string does not match a given format string.\n\n### toStartWith\nExpect that a string starts with a given prefix.\n\n### notToStartWith\nExpect that a string starts not with a given prefix.\n\n### toEndWith\nExpect that a string ends with a given suffix.\n\n### notToEndWith\nExpect that a string ends not with a given suffix.\n\n### toEqualXmlFile\nExpect that two XML files or documents are equal.\n\n### notToEqualXmlFile\nExpect that two XML files or documents are not equal.\n\n### toEqualXml\nExpect that two XML documents are equal.\n\n### notToEqualXml\nExpect that two XML documents are not equal.\n\n### toHaveSameXMLStructureAs\nExpect that a hierarchy of DOMElements matches.\n\n### toBeJson\nExpect that a string is a valid JSON string.\n\n### toEqualJson\nExpect that two given JSON encoded objects or arrays are equal.\n\n### notToEqualJson\nExpect that two given JSON encoded objects or arrays are not equal.\n\n### toEqualJsonFile\nExpect that the generated JSON encoded object and the content of the given file or JSON string are equal.\n\n### notToEqualJsonFile\nExpect that the generated JSON encoded object and the content of the given file or JSON string are not equal.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpkleemans%2Fphpunit-expect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjpkleemans%2Fphpunit-expect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpkleemans%2Fphpunit-expect/lists"}