Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F94196937
OutgoingCallerIdsTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Dec 4, 15:55
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Dec 6, 15:55 (2 d)
Engine
blob
Format
Raw Data
Handle
22754669
Attached To
rPH Phabricator
OutgoingCallerIdsTest.php
View Options
<?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
();
}
}
Event Timeline
Log In to Comment