namespace foo;
use phpmock\Mock;
$time = new Mock(
__NAMESPACE__,
"time",
function () {
return 3;
}
);
$time->enable();
assert (3 == time());
$time->disable();
assert (3 != time());
Показать файл
Открыть проект
Примеры использования класса
Метод | Описание | |
---|---|---|
__construct ( string $namespace, string $name, callable $function ) | Set the namespace, function name and the mock function. | |
call ( array $arguments ) : mixed | Calls the mocked function. | |
define ( ) | Defines the mocked function in the given namespace. | |
disable ( ) | Disable this mock. | |
disableAll ( ) | Disable all mocks. | |
enable ( ) | Enables this mock. | |
getFQFN ( ) : string | Returns the fully qualified function name. | |
getName ( ) : string | Returns the unqualified function name. | |
getNamespace ( ) : string | Returns the namespace without enclosing slashes. |
public define ( ) |
public getNamespace ( ) : string | ||
Результат | string | The namespace |