{"id":87285,"library":"php-mock-php-mock-phpunit","title":"PHP-Mock PHPUnit Integration","description":"Mock built-in PHP functions (e.g. time()) with PHPUnit. This package relies on PHP's namespace fallback policy. No further extension is needed.","status":"active","version":"2.15.0","language":"php","source_language":null,"source_url":"https://github.com/php-mock/php-mock-phpunit","tags":["testing","mocking","phpunit","built-in-functions"],"install":[{"cmd":"composer require php-mock/php-mock-phpunit","lang":"bash","label":"composer require"}],"dependencies":[],"imports":[{"symbol":"PHPMock","correct":"use phpmock\\phpunit\\PHPMock;"}],"quickstart":{"code":"use phpmock\\phpunit\\PHPMock;\n\nclass MyTest extends \\PHPUnit\\Framework\\TestCase\n{\n    use PHPMock;\n\n    public function testTime()\n    {\n        $time = $this->getFunctionMock('MyNamespace', 'time');\n        $time->expects($this->once())->willReturn(1234567890);\n        // Now time() in MyNamespace returns 1234567890\n    }\n}","lang":"php","description":"Mock the time() function in a specific namespace"},"warnings":[{"fix":"Ensure the tested code uses the function without leading backslash","message":"Only mocks functions in the same namespace as the tested code; does not affect global namespace.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'built':8,34 'built-in':7 'built-in-funct':33 'e.g':12 'extens':27 'fallback':23 'function':11,36 'integr':5 'mock':3,6,31 'namespac':22 'need':29 'packag':17 'php':2,10,20 'php-mock':1 'phpunit':4,15,32 'polici':24 'reli':18 'test':30 'time':13","created_at":"2026-06-19T08:15:57.291396+00:00","updated_at":"2026-06-19T08:15:57.291396+00:00","problems":[],"ecosystem":"packagist","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/php-mock/php-mock-phpunit","github":"https://github.com/php-mock/php-mock-phpunit","docs":null,"changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-19","next_check":"2026-12-16","install_tag":null}}