forked from phacility/phabricator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRequestValidatorTest.php
48 lines (41 loc) · 1.6 KB
/
RequestValidatorTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?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));
}
}