Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F94237131
ConnectAppsTest.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 5, 00:36
Size
2 KB
Mime Type
text/x-php
Expires
Sat, Dec 7, 00:36 (2 d)
Engine
blob
Format
Raw Data
Handle
22766457
Attached To
rPH Phabricator
ConnectAppsTest.php
View Options
<?php
use
\Mockery
as
m
;
class
ConnectAppsTest
extends
PHPUnit_Framework_TestCase
{
function
testUpdateWithArray
()
{
$http
=
m
::
mock
(
new
Services_Twilio_TinyHttp
);
$http
->
shouldReceive
(
'get'
)->
once
()
->
with
(
'/2010-04-01/Accounts/AC123/ConnectApps/CN123.json'
)
->
andReturn
(
array
(
200
,
array
(
'Content-Type'
=>
'application/json'
),
json_encode
(
array
(
'friendly_name'
=>
'foo'
))
));
$http
->
shouldReceive
(
'post'
)->
once
()
->
with
(
'/2010-04-01/Accounts/AC123/ConnectApps/CN123.json'
,
array
(
'Content-Type'
=>
'application/x-www-form-urlencoded'
),
'FriendlyName=Bar'
)
->
andReturn
(
array
(
200
,
array
(
'Content-Type'
=>
'application/json'
),
json_encode
(
array
(
'friendly_name'
=>
'Bar'
))
));
$client
=
new
Services_Twilio
(
'AC123'
,
'123'
,
'2010-04-01'
,
$http
);
$cn
=
$client
->
account
->
connect_apps
->
get
(
'CN123'
);
$this
->
assertEquals
(
'foo'
,
$cn
->
friendly_name
);
$cn
->
update
(
array
(
'FriendlyName'
=>
'Bar'
));
$this
->
assertEquals
(
'Bar'
,
$cn
->
friendly_name
);
}
function
testUpdateWithOneParam
()
{
$http
=
m
::
mock
(
new
Services_Twilio_TinyHttp
);
$http
->
shouldReceive
(
'get'
)->
once
()
->
with
(
'/2010-04-01/Accounts/AC123/ConnectApps/CN123.json'
)
->
andReturn
(
array
(
200
,
array
(
'Content-Type'
=>
'application/json'
),
json_encode
(
array
(
'friendly_name'
=>
'foo'
))
));
$http
->
shouldReceive
(
'post'
)->
once
()
->
with
(
'/2010-04-01/Accounts/AC123/ConnectApps/CN123.json'
,
array
(
'Content-Type'
=>
'application/x-www-form-urlencoded'
),
'FriendlyName=Bar'
)
->
andReturn
(
array
(
200
,
array
(
'Content-Type'
=>
'application/json'
),
json_encode
(
array
(
'friendly_name'
=>
'Bar'
))
));
$client
=
new
Services_Twilio
(
'AC123'
,
'123'
,
'2010-04-01'
,
$http
);
$cn
=
$client
->
account
->
connect_apps
->
get
(
'CN123'
);
$this
->
assertEquals
(
'foo'
,
$cn
->
friendly_name
);
$cn
->
update
(
'FriendlyName'
,
'Bar'
);
$this
->
assertEquals
(
'Bar'
,
$cn
->
friendly_name
);
}
function
tearDown
()
{
m
::
close
();
}
}
Event Timeline
Log In to Comment