summaryrefslogtreecommitdiffstats
path: root/test/unit/ResponseTest.php
diff options
context:
space:
mode:
authormisantron <misantron@gmail.com>2016-07-09 01:06:33 +0300
committermisantron <misantron@gmail.com>2016-07-09 01:06:33 +0300
commit5af53adbcadf57f3a154e7ae8d8a50b64c414390 (patch)
tree4448d3d1b4fb1819b62a84017f98f1a1561308d2 /test/unit/ResponseTest.php
parent1c766087ca9e180c37000534c97b43fc8c1d66ad (diff)
downloadphp-http-client-5af53adbcadf57f3a154e7ae8d8a50b64c414390.zip
php-http-client-5af53adbcadf57f3a154e7ae8d8a50b64c414390.tar.gz
php-http-client-5af53adbcadf57f3a154e7ae8d8a50b64c414390.tar.bz2
Bump composer PHP version to 5.4, library refactoring to PSR-2 and PSR-4 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