/**
  * @dataProvider testCaseProvider
  */
 public function testPassesComplianceTest($about, Service $service, $name, array $expectedResult, $res)
 {
     $parser = Service::createParser($service);
     $command = new Command($name);
     // Create a response based on the serialized property of the test.
     $response = new Response($res['status_code'], $res['headers'], Stream::factory($res['body']));
     $result = $parser($command, $response)->toArray();
     $this->fixTimestamps($result, $service->getOperation($name)->getOutput());
     $this->assertEquals($expectedResult, $result);
 }
 private function applyParser()
 {
     $parser = Service::createParser($this->api);
     $this->getEmitter()->on('process', static function (ProcessEvent $e) use($parser) {
         // Guard against exceptions and injected results.
         if ($e->getException() || $e->getResult()) {
             return;
         }
         // Ensure a response exists in order to parse.
         $response = $e->getResponse();
         if (!$response) {
             throw new \RuntimeException('No response was received.');
         }
         $e->setResult($parser($e->getCommand(), $response));
     });
 }