PHP 클래스 Dotink\Parody\Mime

저자: Matthew J. Sahagian [mjs] ([email protected])
상속: extends Quip
파일 보기 프로젝트 열기: dotink/parody 1 사용 예제들

공개 메소드들

메소드 설명
__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