/** * Debug a response. * @param Response $response The driver response object. */ public function response(Response $response) { print '<td style="vertical-align: top; padding: 10px; padding-left: 20px; width: 400px"><h3>Response from server</h3>'; if ($response->getStatusCode() >= 400) { print '<p style="color: red"><strong>' . $response->getStatusCode() . '</strong> ' . $response->getStatus() . '</p>'; } else { print '<p style="color: green"><strong>' . $response->getStatusCode() . '</strong> ' . $response->getStatus() . '</p>'; } //Headers print "<pre>"; foreach ($response->getHeaders() as $header => $value) { print "{$header} : {$value}\n"; } print "</pre>"; //Body if ($response->getBody()) { $body = json_decode($response->getBody()); if ($body) { print "<pre>" . json_encode($body, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . "</pre>"; } elseif ($response->getBody()) { print "<pre>" . $response->getBody() . "</pre>"; } } print '<p>Time taken: ' . $response->getTimeTaken() * 1000 . ' ms</pre>'; print "</td></tr></table>"; }
/** * @covers DNSMadeEasy\driver\Response::getTimeTaken */ public function testGetTimeTaken() { $this->assertEquals(1.1, $this->response->getTimeTaken(), 'The time taken does not match'); }