Skip to content

Commit

Permalink
Version Bump v5.0.5: Update docs, unit tests and examples to include …
Browse files Browse the repository at this point in the history
…Sender ID
  • Loading branch information
thinkingserious committed Jul 12, 2016
1 parent 62a67d6 commit 5a2ceda
Showing 1 changed file with 82 additions and 2 deletions.
84 changes: 82 additions & 2 deletions test/unit/SendGridTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static function setUpBeforeClass()

public function testVersion()
{
$this->assertEquals(SendGrid::VERSION, '5.0.4');
$this->assertEquals(SendGrid::VERSION, '5.0.5');
$this->assertEquals(json_decode(file_get_contents(__DIR__ . '/../../composer.json'))->version, SendGrid::VERSION);
}

Expand Down Expand Up @@ -775,7 +775,7 @@ public function test_contactdb_recipients_count_get()

public function test_contactdb_recipients_search_get()
{
$query_params = json_decode('{"%7Bfield_name%7D": "test_string", "{field_name}": "test_string"}');
$query_params = json_decode('{"{field_name}": "test_string"}');
$request_headers = array("X-Mock: 200");
$response = self::$sg->client->contactdb()->recipients()->search()->get(null, $query_params, $request_headers);
$this->assertEquals($response->statusCode(), 200);
Expand Down Expand Up @@ -1411,6 +1411,86 @@ public function test_scopes_get()
$this->assertEquals($response->statusCode(), 200);
}

public function test_senders_post()
{
$request_body = json_decode('{
"address": "123 Elm St.",
"address_2": "Apt. 456",
"city": "Denver",
"country": "United States",
"from": {
"email": "[email protected]",
"name": "Example INC"
},
"nickname": "My Sender ID",
"reply_to": {
"email": "[email protected]",
"name": "Example INC"
},
"state": "Colorado",
"zip": "80202"
}');
$request_headers = array("X-Mock: 201");
$response = self::$sg->client->senders()->post($request_body, null, $request_headers);
$this->assertEquals($response->statusCode(), 201);
}

public function test_senders_get()
{
$request_headers = array("X-Mock: 200");
$response = self::$sg->client->senders()->get(null, null, $request_headers);
$this->assertEquals($response->statusCode(), 200);
}

public function test_senders__sender_id__patch()
{
$request_body = json_decode('{
"address": "123 Elm St.",
"address_2": "Apt. 456",
"city": "Denver",
"country": "United States",
"from": {
"email": "[email protected]",
"name": "Example INC"
},
"nickname": "My Sender ID",
"reply_to": {
"email": "[email protected]",
"name": "Example INC"
},
"state": "Colorado",
"zip": "80202"
}');
$sender_id = "test_url_param";
$request_headers = array("X-Mock: 200");
$response = self::$sg->client->senders()->_($sender_id)->patch($request_body, null, $request_headers);
$this->assertEquals($response->statusCode(), 200);
}

public function test_senders__sender_id__get()
{
$sender_id = "test_url_param";
$request_headers = array("X-Mock: 200");
$response = self::$sg->client->senders()->_($sender_id)->get(null, null, $request_headers);
$this->assertEquals($response->statusCode(), 200);
}

public function test_senders__sender_id__delete()
{
$sender_id = "test_url_param";
$request_headers = array("X-Mock: 204");
$response = self::$sg->client->senders()->_($sender_id)->delete(null, null, $request_headers);
$this->assertEquals($response->statusCode(), 204);
}

public function test_senders__sender_id__resend_verification_post()
{
$sender_id = "test_url_param";
$request_headers = array("X-Mock: 204");
$response = self::$sg->client->senders()->_($sender_id)->resend_verification()->post(null, null, $request_headers);
$this->assertEquals($response->statusCode(), 204);
}

public function test_stats_get()
{
$query_params = json_decode('{"aggregated_by": "day", "limit": 1, "start_date": "2016-01-01", "end_date": "2016-04-01", "offset": 1}');
Expand Down

0 comments on commit 5a2ceda

Please sign in to comment.