Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F95046196
AccountsTest.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
Thu, Dec 12, 10:33
Size
853 B
Mime Type
text/x-php
Expires
Sat, Dec 14, 10:33 (1 d, 21 h)
Engine
blob
Format
Raw Data
Handle
22777113
Attached To
rPH Phabricator
AccountsTest.php
View Options
<?php
use
\Mockery
as
m
;
class
AccountsTest
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.json'
,
$this
->
formHeaders
,
'FriendlyName=foo'
)
->
andReturn
(
array
(
200
,
array
(
'Content-Type'
=>
'application/json'
),
json_encode
(
array
(
'sid'
=>
'AC345'
))
));
$client
=
new
Services_Twilio
(
'AC123'
,
'123'
,
'2010-04-01'
,
$http
);
$account
=
$client
->
accounts
->
create
(
array
(
'FriendlyName'
=>
'foo'
,
));
$this
->
assertEquals
(
'AC345'
,
$account
->
sid
);
}
function
tearDown
()
{
m
::
close
();
}
}
Event Timeline
Log In to Comment