Метод | Описание | |
---|---|---|
__construct ( string $class, string $mock_class ) | Builds initial reflection object. | |
generate ( array $methods ) | Clones a class' interface and creates a mock version that can have return values and expectations set. | |
generatePartial ( array $methods ) | Generates a version of a class with selected methods mocked only. | |
generateSubclass ( array $methods ) | Subclasses a class and overrides every method with a mock one that can have return values and expectations set. |
Метод | Описание | |
---|---|---|
addMethodList ( array $methods ) : string | Creates a list of mocked methods for error checking. | |
bailOutIfNotMocked ( string $alias ) : string | Creates code to abandon the expectation if not mocked. | |
chainMockExpectations ( ) : string | Creates source code for chaining to an aggregated mock object. | |
chainMockReturns ( ) : string | Creates source code for chaining to the composited mock object. | |
chainThrowMethods ( ) : string | Adds code for chaining the throw methods. | |
createClassCode ( array $methods ) : string | The new mock class code as a string. | |
createConstructorCode ( ) : string | Creates source code for late calling the constructor of the composited mock object. | |
createHandlerCode ( array $methods ) | Creates code within a class to generate replaced methods. | |
createNewMethodCode ( array $methods ) | Creates code within a class to generate a newmethods. | |
createSubclassCode ( array $methods ) : string | The new mock class code as a string. | |
extendClassCode ( array $methods ) : string | The extension class code as a string. | |
isConstructorOrDeconstructor ( string $method ) : boolean | Tests to see if a special PHP method is about to be stubbed by mistake. | |
overrideMethods ( array $methods ) : string | Creates source code to override a list of methods with mock versions. |
public __construct ( string $class, string $mock_class ) | ||
$class | string | Class to be mocked. |
$mock_class | string | New class with identical interface, but no behaviour. |
protected addMethodList ( array $methods ) : string | ||
$methods | array | Mocked methods. |
Результат | string | Code for a method list. |
protected bailOutIfNotMocked ( string $alias ) : string | ||
$alias | string | Parameter name of method name. |
Результат | string | Code for bail out. |
protected chainMockExpectations ( ) : string | ||
Результат | string | Code for expectations. |
protected chainMockReturns ( ) : string | ||
Результат | string | Code for mock set up. |
protected chainThrowMethods ( ) : string | ||
Результат | string | Code for chains. |
protected createClassCode ( array $methods ) : string | ||
$methods | array | Additional methods. |
Результат | string | Code for new mock class. |
protected createConstructorCode ( ) : string | ||
Результат | string | Code for late calls. |
protected createHandlerCode ( array $methods ) | ||
$methods | array | Additional methods. |
protected createNewMethodCode ( array $methods ) | ||
$methods | array | Additional methods. |
protected createSubclassCode ( array $methods ) : string | ||
$methods | array | Additional methods. |
Результат | string | Code for new mock class. |
protected extendClassCode ( array $methods ) : string | ||
$methods | array | Mocked methods. |
Результат | string | Code for a new class. |
public generatePartial ( array $methods ) | ||
$methods | array | Methods to be overridden with mock versions. |
public generateSubclass ( array $methods ) | ||
$methods | array | Additional methods to add beyond those in the cloned class. Use this to emulate the dynamic addition of methods in the cloned class or when the class hasn't been written yet. |
protected isConstructorOrDeconstructor ( string $method ) : boolean | ||
$method | string | Method name. |
Результат | boolean | True if special. |
protected overrideMethods ( array $methods ) : string | ||
$methods | array | Methods to be overridden with mock versions. |
Результат | string | Code for overridden chains. |