/** * Assert that the method was called a certain number of times on a mock * * @param $mock a mock object * @param $method_name name of method to check * @param $expected_num_calls expected number of calls * @param $msg message for assert (optional) */ public static function assertNumCalls(FBMock_Mock $mock, $method_name, $expected_num_calls, $msg = '') { FBMock_Utils::assertString($method_name); FBMock_Utils::assertInt($expected_num_calls); $call_count = count($mock->mockGetCalls($method_name)); PHPUnit_Framework_TestCase::assertEquals($expected_num_calls, $call_count, $msg ?: "{$method_name} called wrong number of times"); }
/** * @expectedException InvalidArgumentException * @expectedExceptionMessage Integer argument expected, string given */ public function testAssertIntFail() { FBMock_Utils::assertInt("3"); }