{"id":13616855,"url":"https://github.com/phpspec/prophecy-phpunit","last_synced_at":"2025-05-14T18:03:14.168Z","repository":{"id":9337532,"uuid":"11185298","full_name":"phpspec/prophecy-phpunit","owner":"phpspec","description":"Integrating Prophecy in PHPUnit test cases","archived":false,"fork":false,"pushed_at":"2025-05-13T13:52:33.000Z","size":74,"stargazers_count":185,"open_issues_count":3,"forks_count":40,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-05-13T23:16:30.868Z","etag":null,"topics":[],"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/phpspec.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":"CONTRIBUTING.md","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}},"created_at":"2013-07-04T19:43:48.000Z","updated_at":"2025-05-13T13:52:37.000Z","dependencies_parsed_at":"2023-01-14T11:54:25.697Z","dependency_job_id":"a72b3dbd-be81-4485-aa0f-212276c35df8","html_url":"https://github.com/phpspec/prophecy-phpunit","commit_stats":{"total_commits":71,"total_committers":15,"mean_commits":4.733333333333333,"dds":0.5211267605633803,"last_synced_commit":"8819516c1b489ecee4c60db5f5432fac1ea8ac6f"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpspec%2Fprophecy-phpunit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpspec%2Fprophecy-phpunit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpspec%2Fprophecy-phpunit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpspec%2Fprophecy-phpunit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phpspec","download_url":"https://codeload.github.com/phpspec/prophecy-phpunit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254198452,"owners_count":22030964,"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":"2024-08-01T20:01:34.120Z","updated_at":"2025-05-14T18:03:09.152Z","avatar_url":"https://github.com/phpspec.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# Prophecy\n\n[![Build Status](https://github.com/phpspec/prophecy-phpunit/actions/workflows/ci.yml/badge.svg)](https://github.com/phpspec/prophecy-phpunit/actions/workflows/ci.yml)\n\nProphecy PhpUnit integrates the [Prophecy](https://github.com/phpspec/prophecy) mocking\nlibrary with [PHPUnit](https://phpunit.de) to provide an easier mocking in your testsuite.\n\n## Installation\n\n### Prerequisites\n\nProphecy PhpUnit requires PHP 7.3 or greater.\nProphecy PhpUnit requires PHPUnit 9.1 or greater. Older versions of PHPUnit are providing the Prophecy integration themselves.\n\n### Setup through composer\n\n```bash\ncomposer require --dev phpspec/prophecy-phpunit\n```\n\nYou can read more about Composer on its [official webpage](https://getcomposer.org).\n\n## How to use it\n\nThe trait ``ProphecyTrait`` provides a method ``prophesize($classOrInterface = null)`` to use Prophecy.\nFor the usage of the Prophecy doubles, please refer to the [Prophecy documentation](https://github.com/phpspec/prophecy).\n\nBelow is a usage example:\n\n```php\n\u003c?php\n\nnamespace App;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Prophecy\\PhpUnit\\ProphecyTrait;\nuse App\\Security\\Hasher;\nuse App\\Entity\\User;\n\nclass UserTest extends TestCase\n{\n    use ProphecyTrait;\n\n    public function testPasswordHashing()\n    {\n        $hasher = $this-\u003eprophesize(Hasher::class);\n        $user   = new User($hasher-\u003ereveal());\n\n        $hasher-\u003egenerateHash($user, 'qwerty')-\u003ewillReturn('hashed_pass');\n\n        $user-\u003esetPassword('qwerty');\n\n        $this-\u003eassertEquals('hashed_pass', $user-\u003egetPassword());\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpspec%2Fprophecy-phpunit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphpspec%2Fprophecy-phpunit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpspec%2Fprophecy-phpunit/lists"}