Property | Type | Description | |
---|---|---|---|
$_call_list | array | @var array | |
$_defaults | array | Array of defaults for a given class and method | |
$_instanceid_counter | integer | Each mock instance needs a unique string ID, which we build by incrementing this counter @var int | |
$_is_interface | array | Records whether a given class is an interface, to avoid repeatedly generating reflection objects just to re-call type registrar | |
$_responses | array | .n], each item is an array of ('args' => the method args, 'responses' => stubbed responses) | |
$ignore_finals | - If true, don't warn when doubling classes with final methods, just ignore the methods. If false, throw warnings when final methods encountered | ||
$type_registrar | - Class name of a class with a static "register_double" method that will be called with any double to inject into some other type tracking system |
Method | Description | |
---|---|---|
__called ( $class, $instance, $method, $args ) | Called by the mock instances when a method is called. Records the call and returns a response if one has been stubbed in | |
__perform_response ( $response, $args ) | ||
_arguments_match ( $mockclass, $method, $a, $b ) | Checks if the two argument sets (passed as arrays) match. Simple serialized check for now, to be replaced by something that can handle anyString etc matchers later | |
_has_namespaces ( ) | * Should we attempt to support namespaces? Is PHP >= 5.3, basically | |
include_hamcrest ( $include_globals = true ) | Includes the Hamcrest matchers. You don't have to, but if you don't you can't to nice generic stubbing and verification | |
mock ( $class ) | Aternative name for mock_instance | |
mock_class ( string $class ) : string | Given a class name as a string, return a new class name as a string which acts as a mock of the passed class name. Probably not useful by itself until we start supporting static method stubbing | |
mock_instance ( string $class ) : Object | Given a class name as a string, return a new instance which acts as a mock of that class | |
reset ( Phockito_Mock $mock, $method = null ) | Reset a mock instance. Forget all calls and stubbed responses for a given instance | |
spy ( ) | ||
spy_class ( $class ) | ||
spy_instance ( $class ) | ||
verify ( Phockito_Mock $mock, string $times = 1 ) : Phockito_VerifyBuilder | Verify builder. Takes a mock instance and an optional number of times to verify against. Returns a DSL object that catches the method to verify | |
when ( $arg = null ) : Phockito_WhenBuilder | When builder. Starts stubbing the method called to build the argument passed to when |
Method | Description | |
---|---|---|
build_test_double ( boolean $partial, string $mockedClass ) : string | Passed a class as a string to create the mock as, and the class as a string to mock, create the mocking class php and eval it into the current running environment |
public static __called ( $class, $instance, $method, $args ) |
public static _arguments_match ( $mockclass, $method, $a, $b ) |
public static _has_namespaces ( ) |
static public include_hamcrest ( $include_globals = true ) |
static public mock_class ( string $class ) : string | ||
$class | string | - The class to mock |
return | string | - The class that acts as a Phockito mock of the passed class |
static public mock_instance ( string $class ) : Object | ||
$class | string | - The class to mock |
return | Object | - A mock of that class |
static public reset ( Phockito_Mock $mock, $method = null ) | ||
$mock | Phockito_Mock | - The mock instance to reset |
static public when ( $arg = null ) : Phockito_WhenBuilder | ||
return | Phockito_WhenBuilder |
public static array $_defaults | ||
return | array |
public static int $_instanceid_counter | ||
return | integer |
public static array $_is_interface | ||
return | array |
public static array $_responses | ||
return | array |
public static $ignore_finals |