[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/externals/twilio-php/tests/resources/ -> OutgoingCallerIdsTest.php (source)

   1  <?php
   2  
   3  use \Mockery as m;
   4  
   5  class OutgoingCallerIdsTest extends PHPUnit_Framework_TestCase {
   6      protected $formHeaders = array('Content-Type' => 'application/x-www-form-urlencoded');
   7      function testPost() {
   8          $http = m::mock(new Services_Twilio_TinyHttp);
   9          $http->shouldReceive('post')->once()
  10              ->with('/2010-04-01/Accounts/AC123/OutgoingCallerIds.json',
  11                  $this->formHeaders, 'PhoneNumber=%2B14158675309&FriendlyName=My+Home+Phone+Number')
  12              ->andReturn(array(200, array('Content-Type' => 'application/json'),
  13                  json_encode(array(
  14                      'account_sid' => 'AC123',
  15                      'phone_number' => '+14158675309',
  16                      'friendly_name' => 'My Home Phone Number',
  17                      'validation_code' => 123456,
  18                  ))
  19              ));
  20          $client = new Services_Twilio('AC123', '123', '2010-04-01', $http);
  21          $request = $client->account->outgoing_caller_ids->create('+14158675309', array(
  22              'FriendlyName' => 'My Home Phone Number',
  23          ));
  24          $this->assertEquals(123456, $request->validation_code);
  25      }
  26  
  27      function tearDown() {
  28          m::close();
  29      }
  30  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1