diff options
author | Elmer Thomas <elmer@thinkingserious.com> | 2015-12-15 09:04:40 -0800 |
---|---|---|
committer | Elmer Thomas <elmer@thinkingserious.com> | 2015-12-15 09:04:40 -0800 |
commit | ebf68af9d4158450b6d673bf6d31ff5297057882 (patch) | |
tree | 070960b03eeba9d367bf5b22d6c055f78d24abf4 /test | |
parent | 6f46520a1ecbd5e81562d67dadb75741e50e408b (diff) | |
download | sendgrid-php-4.0.2.zip sendgrid-php-4.0.2.tar.gz sendgrid-php-4.0.2.tar.bz2 |
Version Bump 4.0.2v4.0.2
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/SendGridTest.php | 2 | ||||
-rw-r--r-- | test/unit/resources/api_keysTest.php | 46 |
2 files changed, 47 insertions, 1 deletions
diff --git a/test/unit/SendGridTest.php b/test/unit/SendGridTest.php index bc220ee..c7ec2bf 100644 --- a/test/unit/SendGridTest.php +++ b/test/unit/SendGridTest.php @@ -12,7 +12,7 @@ class SendGridTest_SendGrid extends PHPUnit_Framework_TestCase public function testVersion() { - $this->assertEquals(SendGrid::VERSION, '4.0.1'); + $this->assertEquals(SendGrid::VERSION, '4.0.2'); $this->assertEquals(json_decode(file_get_contents(__DIR__ . '/../../composer.json'))->version, SendGrid::VERSION); } diff --git a/test/unit/resources/api_keysTest.php b/test/unit/resources/api_keysTest.php index 8045d4c..72ecff9 100644 --- a/test/unit/resources/api_keysTest.php +++ b/test/unit/resources/api_keysTest.php @@ -13,4 +13,50 @@ class SendGridTest_APIKeys extends baseTest $this->assertEquals($code, $response->getStatusCode()); $this->assertEquals($body, $response->getBody()); } + + public function testPOST() + { + $code = 200; + $headers = array('Content-Type' => 'application/json'); + $body = '{ + "api_key": "SG.xxxxxxxx.yyyyyyyy", + "api_key_id": "xxxxxxxx", + "name": "My API Key", + "scopes": [ + "mail.send", + "alerts.create", + "alerts.read" + ] + }'; + $sendgrid = $this->buildClient($code, $headers, $body); + $response = $sendgrid->api_keys->post("My API Key"); + $this->assertEquals($code, $response->getStatusCode()); + $this->assertEquals($body, $response->getBody()); + } + + public function testPATCH() + { + $code = 200; + $headers = array('Content-Type' => 'application/json'); + $body = '{ + "api_key_id": "qfTQ6KG0QBiwWdJ0-pCLCA", + "name": "A New Hope" + }'; + $sendgrid = $this->buildClient($code, $headers, $body); + $response = $sendgrid->api_keys->patch("qfTQ6KG0QBiwWdJ0-pCLCA", "Magic Key Updated"); + $this->assertEquals($code, $response->getStatusCode()); + $this->assertEquals($body, $response->getBody()); + } + + public function testDELETE() + { + $code = 204; + $headers = ''; + $body = ''; + $sendgrid = $this->buildClient($code, $headers, $body); + $response = $sendgrid->api_keys->delete("qfTQ6KG0QBiwWdJ0-pCLCA"); + $this->assertEquals($code, $response->getStatusCode()); + $this->assertEquals($body, $response->getBody()); + } + }
\ No newline at end of file |