/** * Calls the enabled mock, or the built-in function otherwise. * * @param string $functionName The function name. * @param string $fqfn The fully qualified function name. * @param array $arguments The arguments. * * @return mixed The result of the called function. * @see Mock::define() * @SuppressWarnings(PHPMD) */ public static function call($functionName, $fqfn, &$arguments) { $registry = MockRegistry::getInstance(); $mock = $registry->getMock($fqfn); self::removeDefaultArguments($arguments); if (empty($mock)) { // call the built-in function if the mock was not enabled. return call_user_func_array($functionName, $arguments); } else { // call the mock function. return $mock->call($arguments); } }
/** * Disable all mocks. * * @see Mock::enable() * @see Mock::disable() */ public static function disableAll() { MockRegistry::getInstance()->unregisterAll(); }
protected function tearDown() { MockRegistry::getInstance()->unregisterAll(); }