public function testRecorderIsDumpingTapes() { $mock = SimpleMockHandler::create()->withMultipleResponses(5, 200)->withMultipleResponses(5, 403)->withMultipleResponses(5, 404)->build(); $client = SimpleMockedClient::createMockedClient($mock, $this->recorder); for ($i = 0; $i < 15; $i++) { try { $client->get('/'); } catch (RequestException $e) { } } $this->recorder->dump(); $successTapeFile = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'record_tape-success.json'; $AllTapeFile = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'record_tape-all.json'; $UnauthTapeFile = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'record_tape-unauthorized.json'; $this->assertFileExists($successTapeFile); $this->assertFileExists($AllTapeFile); $this->assertFileExists($UnauthTapeFile); }
public function onKernelFinishRequest(FinishRequestEvent $event) { $this->recorder->dump(); }