Skip to content

Commit 5a2ceda

Browse files
Version Bump v5.0.5: Update docs, unit tests and examples to include Sender ID
1 parent 62a67d6 commit 5a2ceda

1 file changed

Lines changed: 82 additions & 2 deletions

File tree

test/unit/SendGridTest.php

Lines changed: 82 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public static function setUpBeforeClass()
5959

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

@@ -775,7 +775,7 @@ public function test_contactdb_recipients_count_get()
775775

776776
public function test_contactdb_recipients_search_get()
777777
{
778-
$query_params = json_decode('{"%7Bfield_name%7D": "test_string", "{field_name}": "test_string"}');
778+
$query_params = json_decode('{"{field_name}": "test_string"}');
779779
$request_headers = array("X-Mock: 200");
780780
$response = self::$sg->client->contactdb()->recipients()->search()->get(null, $query_params, $request_headers);
781781
$this->assertEquals($response->statusCode(), 200);
@@ -1411,6 +1411,86 @@ public function test_scopes_get()
14111411
$this->assertEquals($response->statusCode(), 200);
14121412
}
14131413

1414+
public function test_senders_post()
1415+
{
1416+
$request_body = json_decode('{
1417+
"address": "123 Elm St.",
1418+
"address_2": "Apt. 456",
1419+
"city": "Denver",
1420+
"country": "United States",
1421+
"from": {
1422+
"email": "from@example.com",
1423+
"name": "Example INC"
1424+
},
1425+
"nickname": "My Sender ID",
1426+
"reply_to": {
1427+
"email": "replyto@example.com",
1428+
"name": "Example INC"
1429+
},
1430+
"state": "Colorado",
1431+
"zip": "80202"
1432+
}');
1433+
$request_headers = array("X-Mock: 201");
1434+
$response = self::$sg->client->senders()->post($request_body, null, $request_headers);
1435+
$this->assertEquals($response->statusCode(), 201);
1436+
}
1437+
1438+
public function test_senders_get()
1439+
{
1440+
$request_headers = array("X-Mock: 200");
1441+
$response = self::$sg->client->senders()->get(null, null, $request_headers);
1442+
$this->assertEquals($response->statusCode(), 200);
1443+
}
1444+
1445+
public function test_senders__sender_id__patch()
1446+
{
1447+
$request_body = json_decode('{
1448+
"address": "123 Elm St.",
1449+
"address_2": "Apt. 456",
1450+
"city": "Denver",
1451+
"country": "United States",
1452+
"from": {
1453+
"email": "from@example.com",
1454+
"name": "Example INC"
1455+
},
1456+
"nickname": "My Sender ID",
1457+
"reply_to": {
1458+
"email": "replyto@example.com",
1459+
"name": "Example INC"
1460+
},
1461+
"state": "Colorado",
1462+
"zip": "80202"
1463+
}');
1464+
$sender_id = "test_url_param";
1465+
$request_headers = array("X-Mock: 200");
1466+
$response = self::$sg->client->senders()->_($sender_id)->patch($request_body, null, $request_headers);
1467+
$this->assertEquals($response->statusCode(), 200);
1468+
}
1469+
1470+
public function test_senders__sender_id__get()
1471+
{
1472+
$sender_id = "test_url_param";
1473+
$request_headers = array("X-Mock: 200");
1474+
$response = self::$sg->client->senders()->_($sender_id)->get(null, null, $request_headers);
1475+
$this->assertEquals($response->statusCode(), 200);
1476+
}
1477+
1478+
public function test_senders__sender_id__delete()
1479+
{
1480+
$sender_id = "test_url_param";
1481+
$request_headers = array("X-Mock: 204");
1482+
$response = self::$sg->client->senders()->_($sender_id)->delete(null, null, $request_headers);
1483+
$this->assertEquals($response->statusCode(), 204);
1484+
}
1485+
1486+
public function test_senders__sender_id__resend_verification_post()
1487+
{
1488+
$sender_id = "test_url_param";
1489+
$request_headers = array("X-Mock: 204");
1490+
$response = self::$sg->client->senders()->_($sender_id)->resend_verification()->post(null, null, $request_headers);
1491+
$this->assertEquals($response->statusCode(), 204);
1492+
}
1493+
14141494
public function test_stats_get()
14151495
{
14161496
$query_params = json_decode('{"aggregated_by": "day", "limit": 1, "start_date": "2016-01-01", "end_date": "2016-04-01", "offset": 1}');

0 commit comments

Comments
 (0)