lithium\test\Mocker::chain()
Generate a chain class with the current rules of the mock.
Parameters
-
mixed
$mock Mock object, namespaced static mock, namespaced function name.
Returns
objectMockerChain instance
Source
public static function chain($mock) {
$results = [];
$string = is_string($mock);
if (is_object($mock) && isset($mock->results)) {
$results = static::mergeResults($mock->results, $mock::$staticResults);
} elseif ($string && class_exists($mock) && isset($mock::$staticResults)) {
$results = $mock::$staticResults;
} elseif ($string && function_exists($mock) && isset(static::$_functionResults[$mock])) {
$results = [$mock => static::$_functionResults[$mock]];
}
return new MockerChain($results);
}