1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
<?php
namespace SendGrid\Test;
use SendGrid\Response;
class ResponseTest extends \PHPUnit_Framework_TestCase
{
public function testConstructor()
{
$response = new Response();
$this->assertAttributeEquals(null, 'statusCode', $response);
$this->assertAttributeEquals(null, 'body', $response);
$this->assertAttributeEquals(null, 'headers', $response);
$response = new Response(200, 'test', ['Content-Encoding: gzip']);
$this->assertAttributeEquals(200, 'statusCode', $response);
$this->assertAttributeEquals('test', 'body', $response);
$this->assertAttributeEquals(['Content-Encoding: gzip'], 'headers', $response);
}
public function testStatusCode()
{
$response = new Response(404);
$this->assertEquals(404, $response->statusCode());
}
public function testBody()
{
$response = new Response(null, 'foo');
$this->assertEquals('foo', $response->body());
}
public function testHeaders()
{
$response = new Response(null, null, ['Content-Type: text/html']);
$this->assertEquals(['Content-Type: text/html'], $response->headers());
}
}
|