mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-26 23:40:57 +01:00
e96c363eef
Summary: Provides a working SMS implementation with support for Twilio. This version doesn't really retry if we get any gruff at all. Future versions should retry. Test Plan: used bin/sms to send messages and look at them. Reviewers: chad, epriestley Reviewed By: epriestley Subscribers: aurelijus, epriestley, Korvin Maniphest Tasks: T920 Differential Revision: https://secure.phabricator.com/D8930
30 lines
1.2 KiB
PHP
Executable file
30 lines
1.2 KiB
PHP
Executable file
<?php
|
|
|
|
use \Mockery as m;
|
|
|
|
class OutgoingCallerIdsTest extends PHPUnit_Framework_TestCase {
|
|
protected $formHeaders = array('Content-Type' => 'application/x-www-form-urlencoded');
|
|
function testPost() {
|
|
$http = m::mock(new Services_Twilio_TinyHttp);
|
|
$http->shouldReceive('post')->once()
|
|
->with('/2010-04-01/Accounts/AC123/OutgoingCallerIds.json',
|
|
$this->formHeaders, 'PhoneNumber=%2B14158675309&FriendlyName=My+Home+Phone+Number')
|
|
->andReturn(array(200, array('Content-Type' => 'application/json'),
|
|
json_encode(array(
|
|
'account_sid' => 'AC123',
|
|
'phone_number' => '+14158675309',
|
|
'friendly_name' => 'My Home Phone Number',
|
|
'validation_code' => 123456,
|
|
))
|
|
));
|
|
$client = new Services_Twilio('AC123', '123', '2010-04-01', $http);
|
|
$request = $client->account->outgoing_caller_ids->create('+14158675309', array(
|
|
'FriendlyName' => 'My Home Phone Number',
|
|
));
|
|
$this->assertEquals(123456, $request->validation_code);
|
|
}
|
|
|
|
function tearDown() {
|
|
m::close();
|
|
}
|
|
}
|