Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2363367
AvailablePhoneNumbersTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
AvailablePhoneNumbersTest.php
View Options
<?php
use
\Mockery
as
m
;
class
AvailablePhoneNumbersTest
extends
PHPUnit_Framework_TestCase
{
function
testPartialApplication
()
{
$http
=
m
::
mock
(
new
Services_Twilio_TinyHttp
);
$http
->
shouldReceive
(
'get'
)->
once
()
->
with
(
'/2010-04-01/Accounts/AC123/AvailablePhoneNumbers/US/Local.json?AreaCode=510'
)
->
andReturn
(
array
(
200
,
array
(
'Content-Type'
=>
'application/json'
),
json_encode
(
array
(
'available_phone_numbers'
=>
array
(
'friendly_name'
=>
'(510) 564-7903'
)))
));
$client
=
new
Services_Twilio
(
'AC123'
,
'123'
,
'2010-04-01'
,
$http
);
$nums
=
$client
->
account
->
available_phone_numbers
->
getLocal
(
'US'
);
$numsList
=
$nums
->
getList
(
array
(
'AreaCode'
=>
'510'
));
foreach
(
$numsList
as
$num
)
{
$this
->
assertEquals
(
'(510) 564-7903'
,
$num
->
friendly_name
);
}
}
function
testPagePhoneNumberResource
()
{
$http
=
m
::
mock
(
new
Services_Twilio_TinyHttp
);
$http
->
shouldReceive
(
'get'
)->
once
()
->
with
(
'/2010-04-01/Accounts/AC123/AvailablePhoneNumbers.json?Page=0&PageSize=50'
)
->
andReturn
(
array
(
200
,
array
(
'Content-Type'
=>
'application/json'
),
json_encode
(
array
(
'total'
=>
1
,
'countries'
=>
array
(
array
(
'country_code'
=>
'CA'
))
))
));
$client
=
new
Services_Twilio
(
'AC123'
,
'123'
,
'2010-04-01'
,
$http
);
$page
=
$client
->
account
->
available_phone_numbers
->
getPage
(
'0'
);
$this
->
assertEquals
(
'CA'
,
$page
->
countries
[
0
]->
country_code
);
}
function
testGetMobile
()
{
$http
=
m
::
mock
(
new
Services_Twilio_TinyHttp
);
$http
->
shouldReceive
(
'get'
)->
once
()
->
with
(
'/2010-04-01/Accounts/AC123/AvailablePhoneNumbers/GB/Mobile.json'
)
->
andReturn
(
array
(
200
,
array
(
'Content-Type'
=>
'application/json'
),
json_encode
(
array
(
'available_phone_numbers'
=>
array
(
'friendly_name'
=>
'(510) 564-7903'
)))
));
$client
=
new
Services_Twilio
(
'AC123'
,
'123'
,
'2010-04-01'
,
$http
);
$nums
=
$client
->
account
->
available_phone_numbers
->
getMobile
(
'GB'
)->
getList
();
foreach
(
$nums
as
$num
)
{
$this
->
assertEquals
(
'(510) 564-7903'
,
$num
->
friendly_name
);
}
}
function
tearDown
()
{
m
::
close
();
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Sep 16, 4:58 PM (1 d, 23 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
447631
Default Alt Text
AvailablePhoneNumbersTest.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment