示例#1
0
 public function testLogRequest()
 {
     $response = new ConsoleResponse('http://url.com/', 'POST', ['mykey1' => 'asdsd'], ['mykey2' => 'wegewg'], ['mykey3' => 'gwegerg'], ['Content-Type' => 'text']);
     $this->assertEquals('http://url.com/', $response->getUrl());
     $this->assertEquals('POST', $response->getMethod());
     $this->assertEquals(['mykey1' => 'asdsd'], $response->getPostFields());
     $this->assertEquals(['mykey2' => 'wegewg'], $response->getGetFields());
     $this->assertEquals(['mykey3' => 'gwegerg'], $response->getCookieFields());
     $this->assertEquals(['Content-Type' => 'text'], $response->getHeaders());
     $this->assertNull($response->getResponseCode());
     $this->assertFalse($response->isError());
     $response->logRequest(202, 'asdsafsdgdsg', 'responseheadersd', 145);
     $this->assertEquals('asdsafsdgdsg', $response->getResponseBody());
     $this->assertEquals('responseheadersd', $response->getResponseHeaders());
     $this->assertEquals('asdsafsdgdsg', $response->getFormattedJsonBody());
     $this->assertEquals(145, $response->getResponseTime());
     $this->assertFalse($response->isError());
     $this->assertEquals(202, $response->getResponseCode());
 }