Свойство | Тип | Описание | |
---|---|---|---|
$_blackList | array | Some of these methods are are too custom inside the Mock or Delegate, while others should simply not be filtered. | |
$_functionCallbacks | array | The key is the fully namespaced function name, and the value is the closure to be called. | |
$_functionResults | array | Results of function calls for later assertion in MockerChain. | |
$_methodFilters | Stores the closures that represent the method filters. They are indexed by called class. | ||
$_mockDelegateIngredients | array | The Delegate directly extends the class you wish to mock and makes all methods publically available to other classes but should not be accessed directly by any other classes other than Mock. | |
$_mockFunctionIngredients | array | List of code to be generated for overwriting php functions. | |
$_mockIngredients | array | The Mock class directly extends the class you wish to mock but only interacts with the Delegate directly. This class is the public interface for users. |
Метод | Описание | |
---|---|---|
applyFilter ( string $class, mixed $method = null, Closure $filter = null ) : void | Apply a closure to a method of the current static object. | |
callFunction ( string $name, array &$params = [] ) : mixed | A method to call user defined functions. | |
chain ( mixed $mock ) : object | Generate a chain class with the current rules of the mock. | |
create ( string $mockee ) : void | The main entrance to create a new Mock class. | |
invokeMethod ( string $method, array $params = [] ) : mixed | Calls a method on this object with the given parameters. Provides an OO wrapper for forward_static_call_array(). | |
mergeResults ( array $results, array $secondary ) : array | Will merge two sets of results into each other. | |
overwriteFunction ( string | boolean $name, closure | boolean $callback = null ) : void | Will overwrite namespaced functions. | |
register ( ) : void | Will register this class into the autoloader. |
Метод | Описание | |
---|---|---|
_dynamicCode ( string $type, string $key, array $tokens = [] ) : string | Will generate the code you are wanting. | |
_filter ( string $class, string | array $method, array $params, Closure $callback, array $filters = [] ) : mixed | Executes a set of filters against a method by taking a method's main implementation as a callback, and iteratively wrapping the filters around it. | |
_methodModifiers ( ReflectionMethod $method ) : string | Will determine what method mofifiers of a method. | |
_methodParams ( ReflectionFunctionAbstrac\ReflectionFunctionAbstract $method ) : string | Will determine what parameter prototype of a method. | |
_mocker ( string $mockee ) : array | Will generate the mocker from the current mockee. | |
_namespace ( string $mockee ) : string | Will generate the namespace from the current mockee. | |
_stringMethodParams ( ReflectionFunctionAbstrac\ReflectionFunctionAbstract $method ) : string | Will return the params in a way that can be placed into compact() | |
_validateMockee ( string $mockee ) : boolean | Will validate if mockee is a valid class we should mock. |
protected static _filter ( string $class, string | array $method, array $params, Closure $callback, array $filters = [] ) : mixed | ||
$class | string | Fully namespaced class to apply filters. |
$method | string | array | The name of the method being executed, or an array containing the name of the class that defined the method, and the method name. |
$params | array | An associative array containing all the parameters passed into the method. |
$callback | Closure | The method's implementation, wrapped in a closure. |
$filters | array | Additional filters to apply to the method for this call only. |
Результат | mixed |
protected static _methodModifiers ( ReflectionMethod $method ) : string | ||
$method | ReflectionMethod | |
Результат | string |
protected static _methodParams ( ReflectionFunctionAbstrac\ReflectionFunctionAbstract $method ) : string | ||
$method | ReflectionFunctionAbstrac\ReflectionFunctionAbstract | |
Результат | string |
protected static _namespace ( string $mockee ) : string | ||
$mockee | string | The fully namespaced `\Mock` class |
Результат | string |
protected static _stringMethodParams ( ReflectionFunctionAbstrac\ReflectionFunctionAbstract $method ) : string | ||
$method | ReflectionFunctionAbstrac\ReflectionFunctionAbstract | |
Результат | string |
protected static _validateMockee ( string $mockee ) : boolean | ||
$mockee | string | The fully namespaced `\Mock` class |
Результат | boolean |
public static applyFilter ( string $class, mixed $method = null, Closure $filter = null ) : void | ||
$class | string | Fully namespaced class to apply filters. |
$method | mixed | The name of the method to apply the closure to. Can either be a single method name as a string, or an array of method names. Can also be false to remove all filters on the current object. |
$filter | Closure | The closure that is used to filter the method(s), can also be false to remove all the current filters for the given method. |
Результат | void |
protected static array $_blackList | ||
Результат | array |
protected static array $_functionCallbacks | ||
Результат | array |
protected static array $_functionResults | ||
Результат | array |
protected static $_methodFilters |
protected static array $_mockDelegateIngredients | ||
Результат | array |
protected static array $_mockFunctionIngredients | ||
Результат | array |
protected static array $_mockIngredients | ||
Результат | array |