summaryrefslogtreecommitdiffstats
path: root/test/unit/ResponseTest.php
diff options
context:
space:
mode:
authorElmer Thomas <elmer@ThinkingSerious.com>2016-09-13 09:26:57 -0700
committerGitHub <noreply@github.com>2016-09-13 09:26:57 -0700
commit55ffd690f9309e0d3331bf9e2daa4ac2eac4ab94 (patch)
tree9a94aec7e6879e6e9ffbb448782277bf4e75f582 /test/unit/ResponseTest.php
parent23193453f681d77adf3f4ac6981e62e26c698537 (diff)
parente5de48e78b1d2d8421562a5a424a170813c0e69c (diff)
downloadphp-http-client-3.2.0.zip
php-http-client-3.2.0.tar.gz
php-http-client-3.2.0.tar.bz2
Merge pull request #6 from misantron/refactoringv3.2.0
Library refactoring around PSR-2 / PSR-4 code standards
Diffstat (limited to 'test/unit/ResponseTest.php')
-rw-r--r--test/unit/ResponseTest.php44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/unit/ResponseTest.php b/test/unit/ResponseTest.php
new file mode 100644
index 0000000..04bd27b
--- /dev/null
+++ b/test/unit/ResponseTest.php
@@ -0,0 +1,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());
+ }
+} \ No newline at end of file