Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100734270
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
Sun, Feb 2, 07:38
Size
853 B
Mime Type
text/x-php
Expires
Tue, Feb 4, 07:38 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
24016940
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