PHP 인터페이스 FBMock_Mock

파일 보기 프로젝트 열기: facebook/fbmock 0 사용 예제들

공개 메소드들

메소드 설명
mockGetCalls ( $method_name ) : array Returns an array representing the invocations of $method_name in the following form:
mockImplementation ( $method_name, $callable ) Replace the implementation of a method with a closure
mockReturn ( ) Force the given method(s) to always return a value
mockReturnThis ( $method1 ) Force the given method(s) to return $this to allow chaining
mockThrow ( $method_name, Exception $e ) Throw exception when method is called

메소드 상세

mockGetCalls() 공개 메소드

array( array($param1, $param2, $param3 ...) // first invocation array($param1, $param2, $param3 ...) // second invocation ) Note: see MockAssertionHelpers which has helper methods for asserting calls in tests.
public mockGetCalls ( $method_name ) : array
$method_name name of method to get calls for
리턴 array of invocations

mockImplementation() 공개 메소드

Replace the implementation of a method with a closure
public mockImplementation ( $method_name, $callable )
$method_name Name of method to replace
$callable New implementation of method. Can be a Closure, string, array(obj, method), etc.

mockReturn() 공개 메소드

Force the given method(s) to always return a value
public mockReturn ( )

mockReturnThis() 공개 메소드

Force the given method(s) to return $this to allow chaining
public mockReturnThis ( $method1 )

mockThrow() 공개 메소드

Throw exception when method is called
public mockThrow ( $method_name, Exception $e )
$method_name name of method
$e Exception exception to throw