|
@@ 29-45 (lines=17) @@
|
| 26 |
|
class ResponsesTest extends AbstractKleinTest |
| 27 |
|
{ |
| 28 |
|
|
| 29 |
|
public function testProtocolVersionGetSet() |
| 30 |
|
{ |
| 31 |
|
$version_reg_ex = '/^[0-9]\.[0-9]$/'; |
| 32 |
|
|
| 33 |
|
// Empty constructor |
| 34 |
|
$response = new Response(); |
| 35 |
|
|
| 36 |
|
$this->assertNotNull($response->protocolVersion()); |
| 37 |
|
$this->assertInternalType('string', $response->protocolVersion()); |
| 38 |
|
$this->assertRegExp($version_reg_ex, $response->protocolVersion()); |
| 39 |
|
|
| 40 |
|
// Set in method |
| 41 |
|
$response = new Response(); |
| 42 |
|
$response->protocolVersion('2.0'); |
| 43 |
|
|
| 44 |
|
$this->assertSame('2.0', $response->protocolVersion()); |
| 45 |
|
} |
| 46 |
|
|
| 47 |
|
public function testBodyGetSet() |
| 48 |
|
{ |
|
@@ 66-84 (lines=19) @@
|
| 63 |
|
$this->assertSame('testing', $response->body()); |
| 64 |
|
} |
| 65 |
|
|
| 66 |
|
public function testCodeGetSet() |
| 67 |
|
{ |
| 68 |
|
// Empty constructor |
| 69 |
|
$response = new Response(); |
| 70 |
|
|
| 71 |
|
$this->assertNotNull($response->code()); |
| 72 |
|
$this->assertInternalType('int', $response->code()); |
| 73 |
|
|
| 74 |
|
// Code set in constructor |
| 75 |
|
$response = new Response(null, 503); |
| 76 |
|
|
| 77 |
|
$this->assertSame(503, $response->code()); |
| 78 |
|
|
| 79 |
|
// Code set in method |
| 80 |
|
$response = new Response(); |
| 81 |
|
$response->code(204); |
| 82 |
|
|
| 83 |
|
$this->assertSame(204, $response->code()); |
| 84 |
|
} |
| 85 |
|
|
| 86 |
|
public function testStatusGetter() |
| 87 |
|
{ |