Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F94236039
RequestValidatorTest.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:20
Size
1 KB
Mime Type
text/x-php
Expires
Sat, Dec 7, 00:20 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22741104
Attached To
rPH Phabricator
RequestValidatorTest.php
View Options
<?php
require_once
'Twilio/RequestValidator.php'
;
class
RequestValidatorTest
extends
PHPUnit_Framework_TestCase
{
function
testRequestValidation
()
{
$token
=
"1c892n40nd03kdnc0112slzkl3091j20"
;
$validator
=
new
Services_Twilio_RequestValidator
(
$token
);
$uri
=
"http://www.postbin.org/1ed898x"
;
$params
=
array
(
"CalledZip"
=>
"94612"
,
"AccountSid"
=>
"AC9a9f9392lad99kla0sklakjs90j092j3"
,
"ApiVersion"
=>
"2010-04-01"
,
"CallSid"
=>
"CAd800bb12c0426a7ea4230e492fef2a4f"
,
"CallStatus"
=>
"ringing"
,
"Called"
=>
"+15306384866"
,
"CalledCity"
=>
"OAKLAND"
,
"CalledCountry"
=>
"US"
,
"CalledState"
=>
"CA"
,
"Caller"
=>
"+15306666666"
,
"CallerCity"
=>
"SOUTH LAKE TAHOE"
,
"CallerCountry"
=>
"US"
,
"CallerName"
=>
"CA Wireless Call"
,
"CallerState"
=>
"CA"
,
"CallerZip"
=>
"89449"
,
"Direction"
=>
"inbound"
,
"From"
=>
"+15306666666"
,
"FromCity"
=>
"SOUTH LAKE TAHOE"
,
"FromCountry"
=>
"US"
,
"FromState"
=>
"CA"
,
"FromZip"
=>
"89449"
,
"To"
=>
"+15306384866"
,
"ToCity"
=>
"OAKLAND"
,
"ToCountry"
=>
"US"
,
"ToState"
=>
"CA"
,
"ToZip"
=>
"94612"
,
);
$expected
=
"fF+xx6dTinOaCdZ0aIeNkHr/ZAA="
;
$this
->
assertEquals
(
$validator
->
computeSignature
(
$uri
,
$params
),
$expected
);
$this
->
assertTrue
(
$validator
->
validate
(
$expected
,
$uri
,
$params
));
}
}
Event Timeline
Log In to Comment