lithium\test\Mocker::_dynamicCode()
Will generate the code you are wanting.
This pulls from $_mockDelegateIngredients and $_mockIngredients.
Parameters
-
string
$type
The name of the array of ingredients to use
-
string
$key
The key from the array of ingredients
-
array
$tokens Tokens, if any, that should be inserted
Returns
stringSource
protected static function _dynamicCode($type, $key, $tokens = array()) {
$defaults = array(
'master' => '\lithium\test\Mocker',
);
$tokens += $defaults;
$name = '_' . $type . 'Ingredients';
$code = implode("\n", self::${$name}[$key]);
return String::insert($code, $tokens) . "\n";
}