PHP Class Dotink\Parody\Mime

Author: Matthew J. Sahagian [mjs] ([email protected])
Inheritance: extends Quip
Afficher le fichier Open project: dotink/parody Class Usage Examples

Méthodes publiques

Méthode Description
__call ( string $method, array $args ) : Mime Handle missing calls which, in short, means we should be looking for an extension.
__callStatic ( string $method, array $args ) : mixed Allow us to call certain method statically, specifically create
__construct ( string | object $target = NULL ) : void Create a new Mime.
__invoke ( ) : Quip Get the quip
define ( string $class ) : Mime Define a new quip (mocked class) to work on.
expect ( ) : Mime Tell an open method what to expect
extending ( string $parent_class ) : Mime Tells the class we're defining to extend a parent class, creating it if it does not exist.
give ( mixed $value = NULL ) : Mime Define a value to give for the open method or property
implementing ( string $interface ) : Mime Tells the class we're defining to implement interfaces, creating it if it does not exist.
onCall ( string $method ) : Mime Opens a method on the quip object
onGet ( string $property ) : Mime Opens a property on the quip object
onNew ( ) : Mime Register a factory for adding methods/property mocks to objects instantiated later.
resolve ( $target ) : Quip Gets the current working quip object (for injection)
using ( string $trait ) : Mime Tell the class we're defining to use a given trait and if it doesn't exist, create it

Private Methods

Méthode Description
create ( string $class, string $overload_static = FALSE ) : Mime Create a new quip (mocked object) of a particular class to work on.
make ( string $class ) : string Literally makes (evals) a class.

Method Details

__call() public méthode

Handle missing calls which, in short, means we should be looking for an extension.
public __call ( string $method, array $args ) : Mime
$method string The method we tried to call
$args array The arguments we passed to it
Résultat Mime The mime for method chaining

__callStatic() public static méthode

Allow us to call certain method statically, specifically create
public static __callStatic ( string $method, array $args ) : mixed
$method string The method that was called
$args array The arguments passed to the method
Résultat mixed The return value for the called method

__construct() public méthode

Create a new Mime.
public __construct ( string | object $target = NULL ) : void
$target string | object A class name or quip to work with.
Résultat void

__invoke() public méthode

Get the quip
public __invoke ( ) : Quip
Résultat Quip The quip

define() public static méthode

Define a new quip (mocked class) to work on.
public static define ( string $class ) : Mime
$class string The class to define
Résultat Mime The mime object for defining the class

expect() public méthode

Tell an open method what to expect
public expect ( ) : Mime
Résultat Mime The mime for method chaining

extending() public méthode

Tells the class we're defining to extend a parent class, creating it if it does not exist.
public extending ( string $parent_class ) : Mime
$parent_class string The parent class to define
Résultat Mime A new mime for defining the parent

give() public méthode

Define a value to give for the open method or property
public give ( mixed $value = NULL ) : Mime
$value mixed The value to return for the open method or property
Résultat Mime For method chaining

implementing() public méthode

Tells the class we're defining to implement interfaces, creating it if it does not exist.
public implementing ( string $interface ) : Mime
$interface string The interface to implement
Résultat Mime The mime for method chaining

onCall() public méthode

Opens a method on the quip object
public onCall ( string $method ) : Mime
$method string The name of the method to open
Résultat Mime The mime for method chaining

onGet() public méthode

Opens a property on the quip object
public onGet ( string $property ) : Mime
$property string The name of the property to open
Résultat Mime The mime for method chaining

onNew() public méthode

This is useful if the code you are testing has a call such as new Class(). Since the code is dependent on that object, but it is not injected we essentially want to delay our method/property configuration for the mock till after that call. Once the factory is run it is removed from the stack automatically.
public onNew ( ) : Mime
Résultat Mime The mime for method chaining

resolve() public méthode

Gets the current working quip object (for injection)
public resolve ( $target ) : Quip
Résultat Quip The quip object, whose class will actually be whatever class you're mocking

using() public méthode

Tell the class we're defining to use a given trait and if it doesn't exist, create it
public using ( string $trait ) : Mime
$trait string The trait to use
Résultat Mime The mime for method chaining