{"id":18483946,"url":"https://github.com/php-mock/php-mock-mockery","last_synced_at":"2025-08-21T06:31:12.288Z","repository":{"id":29728600,"uuid":"33271848","full_name":"php-mock/php-mock-mockery","owner":"php-mock","description":"Mock non deterministic built-in PHP functions (e.g. time() or rand()) with Mockery.","archived":false,"fork":false,"pushed_at":"2023-12-23T12:22:00.000Z","size":109,"stargazers_count":38,"open_issues_count":1,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-06T13:49:37.480Z","etag":null,"topics":["builtin-functions","mockery","php","php-mock"],"latest_commit_sha":null,"homepage":null,"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-04-01T20:41:11.000Z","updated_at":"2024-08-30T12:09:11.000Z","dependencies_parsed_at":"2023-12-01T23:23:20.708Z","dependency_job_id":"a9a9aaef-2123-454b-b7db-812d7c674e6f","html_url":"https://github.com/php-mock/php-mock-mockery","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-mock%2Fphp-mock-mockery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-mock%2Fphp-mock-mockery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-mock%2Fphp-mock-mockery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-mock%2Fphp-mock-mockery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/php-mock","download_url":"https://codeload.github.com/php-mock/php-mock-mockery/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230494921,"owners_count":18235046,"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","mockery","php","php-mock"],"created_at":"2024-11-06T12:37:58.235Z","updated_at":"2024-12-19T20:08:31.139Z","avatar_url":"https://github.com/php-mock.png","language":"PHP","readme":"[![.github/workflows/tests.yml](https://github.com/php-mock/php-mock-mockery/actions/workflows/tests.yml/badge.svg)](https://github.com/php-mock/php-mock-mockery/actions/workflows/tests.yml)\n\n# Mock PHP built-in functions with Mockery\n\nThis package integrates the function mock library\n[PHP-Mock](https://github.com/php-mock/php-mock) with Mockery.\n\n## Installation\n\nUse [Composer](https://getcomposer.org/):\n\n```sh\ncomposer require --dev php-mock/php-mock-mockery\n```\n\n## Usage\n\n[`PHPMockery::mock()`](http://php-mock.github.io/php-mock-mockery/api/class-phpmock.mockery.PHPMockery.html#_mock)\nlet's you build a function mock which can be equiped\nwith Mockery's expectations. After your test you'll have to disable all created\nfunction mocks by calling `Mockery::close()`.\n\n### Example\n\n```php\nnamespace foo;\n\nuse phpmock\\mockery\\PHPMockery;\n\n$mock = PHPMockery::mock(__NAMESPACE__, \"time\")-\u003eandReturn(3);\nassert (3 == time());\n\n\\Mockery::close();\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 mocked.\n  E.g. a call for `time()` in the namespace `foo` is mockable,\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 [`PHPMockery::define()`](http://php-mock.github.io/php-mock-mockery/api/class-phpmock.mockery.PHPMockery.html#_define)\n  before that first call. This would define a side effectless namespaced function.\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-mockery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphp-mock%2Fphp-mock-mockery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-mock%2Fphp-mock-mockery/lists"}