PHP Класс Dotink\Parody\Mime

Автор: Matthew J. Sahagian [mjs] ([email protected])
Наследование: extends Quip
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__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

Приватные методы

Метод Описание
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.

Описание методов

__call() публичный Метод

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
Результат Mime The mime for method chaining

__callStatic() публичный статический Метод

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
Результат mixed The return value for the called method

__construct() публичный Метод

Create a new Mime.
public __construct ( string | object $target = NULL ) : void
$target string | object A class name or quip to work with.
Результат void

__invoke() публичный Метод

Get the quip
public __invoke ( ) : Quip
Результат Quip The quip

define() публичный статический Метод

Define a new quip (mocked class) to work on.
public static define ( string $class ) : Mime
$class string The class to define
Результат Mime The mime object for defining the class

expect() публичный Метод

Tell an open method what to expect
public expect ( ) : Mime
Результат Mime The mime for method chaining

extending() публичный Метод

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
Результат Mime A new mime for defining the parent

give() публичный Метод

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
Результат Mime For method chaining

implementing() публичный Метод

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
Результат Mime The mime for method chaining

onCall() публичный Метод

Opens a method on the quip object
public onCall ( string $method ) : Mime
$method string The name of the method to open
Результат Mime The mime for method chaining

onGet() публичный Метод

Opens a property on the quip object
public onGet ( string $property ) : Mime
$property string The name of the property to open
Результат Mime The mime for method chaining

onNew() публичный Метод

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
Результат Mime The mime for method chaining

resolve() публичный Метод

Gets the current working quip object (for injection)
public resolve ( $target ) : Quip
Результат Quip The quip object, whose class will actually be whatever class you're mocking

using() публичный Метод

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
Результат Mime The mime for method chaining