Slide 111
Slide 111 text
$count = 0;
$mock = new MockHttpClient(
function (string $method, string $path) use (&$count) {
$this→assertSame(0, $count++);
$this→assertSame('PUT', $method);
$this→assertSame('/users', $path);
return new MockResponse('OK');
}
);
$crm = new SalesPower($mock);
$crm→createUser($alice);
$this→assertSame(1, $count, 'Effective call to the HTTP client');
Advanced test method