PHP Trait FBMock_AssertionHelpers

Datei anzeigen Open project: facebook/fbmock

Public Methods

Method Description
assertCalledOnce ( FBMock_Mock $mock, $method_name, $args = null, $msg = '' ) Assert that the method was called once. If $args is given, check that it matches the args $method_name was called with.
assertCalls ( FBMock_Mock $mock, $method_name ) Assert that the method calls match the array of calls.
assertNotCalled ( FBMock_Mock $mock, $method_name, $msg = '' ) Assert that the method was not called.
assertNumCalls ( FBMock_Mock $mock, $method_name, $expected_num_calls, $msg = '' ) Assert that the method was called a certain number of times on a mock

Method Details

assertCalledOnce() public static method

Assert that the method was called once. If $args is given, check that it matches the args $method_name was called with.
public static assertCalledOnce ( FBMock_Mock $mock, $method_name, $args = null, $msg = '' )
$mock FBMock_Mock a mock object
$method_name name of method to check
$args expected arguments (optional)
$msg message for assert (optional)

assertCalls() public static method

Example usage: Code under test calls method $mock->testMethod(1,2,3); $mock->testMethod('a', 'b', 'c'); Test asserts calls self::assertCalls( $mock, 'testMethod', array(1,2,3), array('a', 'b', 'c') );
public static assertCalls ( FBMock_Mock $mock, $method_name )
$mock FBMock_Mock a mock object
$method_name name of method to check

assertNotCalled() public static method

Assert that the method was not called.
public static assertNotCalled ( FBMock_Mock $mock, $method_name, $msg = '' )
$mock FBMock_Mock a mock object
$method_name name of method to check
$msg message for assert (optional)

assertNumCalls() public static method

Assert that the method was called a certain number of times on a mock
public static assertNumCalls ( FBMock_Mock $mock, $method_name, $expected_num_calls, $msg = '' )
$mock FBMock_Mock a mock object
$method_name name of method to check
$expected_num_calls expected number of calls
$msg message for assert (optional)