My code:
public function testApiClient()
{
$mock = createMockApiClient();
dump($mock->someMethod());
}
protected function createMockApiClient()
{
$mockApiClient = $this->createMock(ApiClient::class);
return $mockApiClient
->expects($this->any())
->method('someMethod')
->will($this->returnValue('someString'))
;
}
So I have this error:
Error: Call to undefined method
PHPUnit_Framework_MockObject_Builder_InvocationMocker::someMethod()
I'm new in PHPUnit tests, so what to do? I can't understand why I do as wrote in example and no result - just error?
Aucun commentaire:
Enregistrer un commentaire