{"id":18483941,"url":"https://github.com/php-mock/php-mock-prophecy","last_synced_at":"2025-04-08T18:32:58.109Z","repository":{"id":55820520,"uuid":"45322212","full_name":"php-mock/php-mock-prophecy","owner":"php-mock","description":"Mock built-in PHP functions (e.g. time()) with Prophecy (phpspec).","archived":false,"fork":false,"pushed_at":"2023-12-23T12:22:53.000Z","size":111,"stargazers_count":16,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-24T18:13:39.553Z","etag":null,"topics":["builtin-functions","mock","php","php-mock","prophecy"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"wtfpl","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/php-mock.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}},"created_at":"2015-10-31T23:49:21.000Z","updated_at":"2024-06-18T18:35:29.290Z","dependencies_parsed_at":"2023-12-01T23:25:52.868Z","dependency_job_id":"790f7768-1bef-4bad-8d1d-a1f5ff66939f","html_url":"https://github.com/php-mock/php-mock-prophecy","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-mock%2Fphp-mock-prophecy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-mock%2Fphp-mock-prophecy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-mock%2Fphp-mock-prophecy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-mock%2Fphp-mock-prophecy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/php-mock","download_url":"https://codeload.github.com/php-mock/php-mock-prophecy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247902675,"owners_count":21015494,"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":["builtin-functions","mock","php","php-mock","prophecy"],"created_at":"2024-11-06T12:37:57.643Z","updated_at":"2025-04-08T18:32:53.100Z","avatar_url":"https://github.com/php-mock.png","language":"PHP","readme":"# Mock PHP built-in functions with Prophecy\n\nThis package integrates the function mock library\n[PHP-Mock](https://github.com/php-mock/php-mock) with Prophecy.\n\n# Installation\n\nUse [Composer](https://getcomposer.org/):\n\n```sh\ncomposer require --dev php-mock/php-mock-prophecy\n```\n\n# Usage\n\nBuild a new [`PHPProphet`](http://php-mock.github.io/php-mock-prophecy/api/class-phpmock.prophecy.PHPProphet.html)\nand create function prophecies for a given namespace\nwith [`PHPProphet::prophesize()`](http://php-mock.github.io/php-mock-prophecy/api/class-phpmock.prophecy.PHPProphet.html#_prophesize):\n\n```php\nnamespace foo;\n\nuse phpmock\\prophecy\\PHPProphet;\n\n$prophet = new PHPProphet();\n\n$prophecy = $prophet-\u003eprophesize(__NAMESPACE__);\n$prophecy-\u003etime()-\u003ewillReturn(123);\n$prophecy-\u003ereveal();\n\nassert(123 == time());\n$prophet-\u003echeckPredictions();\n```\n\n## Restrictions\n\nThis library comes with the same restrictions as the underlying\n[`php-mock`](https://github.com/php-mock/php-mock#requirements-and-restrictions):\n\n* Only *unqualified* function calls in a namespace context can be prophesized.\n  E.g. a call for `time()` in the namespace `foo` is prophesizable,\n  a call for `\\time()` is not.\n\n* The mock has to be defined before the first call to the unqualified function\n  in the tested class. This is documented in [Bug #68541](https://bugs.php.net/bug.php?id=68541).\n  In most cases you can ignore this restriction. But if you happen to run into\n  this issue you can call [`PHPProphet::define()`](http://php-mock.github.io/php-mock-prophecy/api/class-phpmock.prophecy.PHPProphet.html#_define)\n  before that first call. This would define a side effectless namespaced function.\n\n* Additionally it shares restrictions from Prophecy as well:\n  Prophecy [doesn't support pass-by-reference](https://github.com/phpspec/prophecy/issues/225).\n  If you need pass-by-reference in prophecies, consider using another framework\n  (e.g. [php-mock-phpunit](https://github.com/php-mock/php-mock-phpunit)).\n\n# License and authors\n\nThis project is free and under the WTFPL.\nResponsable for this project is Markus Malkusch markus@malkusch.de.\n\n## Donations\n\nIf you like this project and feel generous donate a few Bitcoins here:\n[1335STSwu9hST4vcMRppEPgENMHD2r1REK](bitcoin:1335STSwu9hST4vcMRppEPgENMHD2r1REK)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-mock%2Fphp-mock-prophecy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphp-mock%2Fphp-mock-prophecy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-mock%2Fphp-mock-prophecy/lists"}