diff options
Diffstat (limited to 'Twilio/Tests/Integration/Notify/V1/ServiceTest.php')
-rw-r--r-- | Twilio/Tests/Integration/Notify/V1/ServiceTest.php | 256 |
1 files changed, 256 insertions, 0 deletions
diff --git a/Twilio/Tests/Integration/Notify/V1/ServiceTest.php b/Twilio/Tests/Integration/Notify/V1/ServiceTest.php new file mode 100644 index 0000000..5b8eef3 --- /dev/null +++ b/Twilio/Tests/Integration/Notify/V1/ServiceTest.php @@ -0,0 +1,256 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Tests\Integration\Notify\V1; + +use Twilio\Exceptions\DeserializeException; +use Twilio\Exceptions\TwilioException; +use Twilio\Http\Response; +use Twilio\Tests\HolodeckTestCase; +use Twilio\Tests\Request; + +class ServiceTest extends HolodeckTestCase { + public function testCreateRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->notify->v1->services->create(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertTrue($this->holodeck->hasRequest(new Request( + 'post', + 'https://notify.twilio.com/v1/Services' + ))); + } + + public function testCreateResponse() { + $this->holodeck->mock(new Response( + 201, + ' + { + "sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "friendly_name": "733c7f0f-6541-42ec-84ce-e2ae1cac588c", + "date_created": "2016-03-09T20:22:31Z", + "date_updated": "2016-03-09T20:22:31Z", + "apn_credential_sid": null, + "gcm_credential_sid": null, + "messaging_service_sid": null, + "facebook_messenger_page_id": "4", + "default_apn_notification_protocol_version": "3", + "default_gcm_notification_protocol_version": "3", + "url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "links": { + "bindings": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings", + "notifications": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications" + } + } + ' + )); + + $actual = $this->twilio->notify->v1->services->create(); + + $this->assertNotNull($actual); + } + + public function testDeleteRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->notify->v1->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->delete(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertTrue($this->holodeck->hasRequest(new Request( + 'delete', + 'https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + ))); + } + + public function testDeleteResponse() { + $this->holodeck->mock(new Response( + 204, + null + )); + + $actual = $this->twilio->notify->v1->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->delete(); + + $this->assertTrue($actual); + } + + public function testFetchRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->notify->v1->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->fetch(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertTrue($this->holodeck->hasRequest(new Request( + 'get', + 'https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + ))); + } + + public function testFetchResponse() { + $this->holodeck->mock(new Response( + 200, + ' + { + "sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "friendly_name": "733c7f0f-6541-42ec-84ce-e2ae1cac588c", + "date_created": "2016-03-09T20:22:31Z", + "date_updated": "2016-03-09T20:22:31Z", + "apn_credential_sid": null, + "gcm_credential_sid": null, + "messaging_service_sid": null, + "facebook_messenger_page_id": "4", + "default_apn_notification_protocol_version": "3", + "default_gcm_notification_protocol_version": "3", + "url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "links": { + "bindings": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings", + "notifications": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications" + } + } + ' + )); + + $actual = $this->twilio->notify->v1->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->fetch(); + + $this->assertNotNull($actual); + } + + public function testReadRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->notify->v1->services->read(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertTrue($this->holodeck->hasRequest(new Request( + 'get', + 'https://notify.twilio.com/v1/Services' + ))); + } + + public function testReadFullResponse() { + $this->holodeck->mock(new Response( + 200, + ' + { + "meta": { + "page": 0, + "page_size": 1, + "first_page_url": "https://notify.twilio.com/v1/Services?PageSize=1&Page=0", + "previous_page_url": null, + "url": "https://notify.twilio.com/v1/Services?PageSize=1&Page=0", + "next_page_url": null, + "key": "services" + }, + "services": [ + { + "sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "friendly_name": "733c7f0f-6541-42ec-84ce-e2ae1cac588c", + "date_created": "2016-03-09T20:22:31Z", + "date_updated": "2016-03-09T20:22:31Z", + "apn_credential_sid": null, + "gcm_credential_sid": null, + "messaging_service_sid": null, + "facebook_messenger_page_id": "4", + "default_apn_notification_protocol_version": "3", + "default_gcm_notification_protocol_version": "3", + "url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "links": { + "bindings": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings", + "notifications": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications" + } + } + ] + } + ' + )); + + $actual = $this->twilio->notify->v1->services->read(); + + $this->assertTrue(count($actual) > 0); + } + + public function testReadEmptyResponse() { + $this->holodeck->mock(new Response( + 200, + ' + { + "meta": { + "page": 0, + "page_size": 50, + "first_page_url": "https://notify.twilio.com/v1/Services?PageSize=50&Page=0", + "previous_page_url": null, + "url": "https://notify.twilio.com/v1/Services?PageSize=50&Page=0", + "next_page_url": null, + "key": "services" + }, + "services": [] + } + ' + )); + + $actual = $this->twilio->notify->v1->services->read(); + + $this->assertNotNull($actual); + } + + public function testUpdateRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->notify->v1->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->update(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertTrue($this->holodeck->hasRequest(new Request( + 'post', + 'https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + ))); + } + + public function testUpdateResponse() { + $this->holodeck->mock(new Response( + 200, + ' + { + "sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "friendly_name": "733c7f0f-6541-42ec-84ce-e2ae1cac588c", + "date_created": "2016-03-09T20:22:31Z", + "date_updated": "2016-03-09T20:22:31Z", + "apn_credential_sid": null, + "gcm_credential_sid": null, + "default_apn_notification_protocol_version": "3", + "default_gcm_notification_protocol_version": "3", + "messaging_service_sid": null, + "facebook_messenger_page_id": "4", + "url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "links": { + "bindings": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings", + "notifications": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications" + } + } + ' + )); + + $actual = $this->twilio->notify->v1->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->update(); + + $this->assertNotNull($actual); + } +}
\ No newline at end of file |