Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add failing test

  • Loading branch information...
commit 9f9376d0cdcaa5f845b9b71fbce80fdff95a900a 1 parent 1337732
Kevin Burke authored
Showing with 30 additions and 1 deletion.
  1. +30 −1 tests/TwilioTest.php
View
31 tests/TwilioTest.php
@@ -159,7 +159,7 @@ function testListResource() {
$this->assertEquals(1, $page->total);
}
- function testInstanceResourceUriConstructedProperly() {
+ function testInstanceResourceUriConstructionFromList() {
$http = m::mock(new Services_Twilio_TinyHttp);
$http->shouldReceive('get')->once()
->with('/2010-04-01/Accounts/AC123/Calls.json?Page=0&PageSize=10')
@@ -193,6 +193,35 @@ function testInstanceResourceUriConstructedProperly() {
$this->assertSame($call->status, 'completed');
}
+ function testInstanceResourceUriConstructionFromGet() {
+ $http = m::mock(new Services_Twilio_TinyHttp);
+ $http->shouldReceive('get')->once()
+ ->with('/2010-04-01/Accounts/AC123/IncomingPhoneNumbers/PN123.json')
+ ->andReturn(array(200, array('Content-Type' => 'application/json'),
+ json_encode(array(
+ 'sms_method' => 'POST',
+ 'sid' => 'PN123',
+ 'uri' => 'junk_uri',
+ ))
+ ));
+ $http->shouldReceive('post')->once()
+ ->with('/2010-04-01/Accounts/AC123/IncomingPhoneNumbers/PN123.json',
+ $this->formHeaders, 'SmsMethod=GET')
+ ->andReturn(array(200, array('Content-Type' => 'application/json'),
+ json_encode(array(
+ 'sms_method' => 'GET',
+ 'sid' => 'PN123',
+ 'uri' => 'junk_uri'
+ ))
+ ));
+ $client = new Services_Twilio('AC123', '123', '2010-04-01', $http);
+ $number = $client->account->incoming_phone_numbers->get('PN123');
+ $this->assertSame($number->sms_method, 'POST');
+
+ $number->update(array('SmsMethod' => 'GET'));
+ $this->assertSame($number->sms_method, 'GET');
+ }
+
function testIterateOverPage() {
$http = m::mock(new Services_Twilio_TinyHttp);
$http->shouldReceive('get')->once()
Please sign in to comment.
Something went wrong with that request. Please try again.