mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-21 04:50:55 +01:00
e96c363eef
Summary: Provides a working SMS implementation with support for Twilio. This version doesn't really retry if we get any gruff at all. Future versions should retry. Test Plan: used bin/sms to send messages and look at them. Reviewers: chad, epriestley Reviewed By: epriestley Subscribers: aurelijus, epriestley, Korvin Maniphest Tasks: T920 Differential Revision: https://secure.phabricator.com/D8930
56 lines
1.3 KiB
PHP
Executable file
56 lines
1.3 KiB
PHP
Executable file
<?php
|
|
|
|
require_once 'Twilio.php';
|
|
|
|
class BuildQueryTest extends PHPUnit_Framework_TestCase {
|
|
|
|
public function testSimpleQueryString() {
|
|
$data = array(
|
|
'foo' => 'bar',
|
|
'baz' => 'bin',
|
|
);
|
|
|
|
$this->assertEquals(Services_Twilio::buildQuery($data), 'foo=bar&baz=bin');
|
|
}
|
|
|
|
public function testSameKey() {
|
|
$data = array(
|
|
'foo' => array(
|
|
'bar',
|
|
'baz',
|
|
'bin',
|
|
),
|
|
'boo' => 'bah',
|
|
);
|
|
|
|
$this->assertEquals(Services_Twilio::buildQuery($data),
|
|
'foo=bar&foo=baz&foo=bin&boo=bah');
|
|
}
|
|
|
|
public function testKeylessData() {
|
|
$data = array(
|
|
'bar',
|
|
'baz',
|
|
'bin',
|
|
);
|
|
|
|
$this->assertEquals(Services_Twilio::buildQuery($data), '0=bar&1=baz&2=bin');
|
|
}
|
|
|
|
public function testKeylessDataPrefix() {
|
|
$data = array(
|
|
'bar',
|
|
'baz',
|
|
'bin',
|
|
);
|
|
|
|
$this->assertEquals(Services_Twilio::buildQuery($data, 'var'), 'var0=bar&var1=baz&var2=bin');
|
|
}
|
|
|
|
public function testQualifiedUserAgent() {
|
|
$expected = Services_Twilio::USER_AGENT . " (php 5.4)";
|
|
$this->assertEquals(Services_Twilio::qualifiedUserAgent("5.4"), $expected);
|
|
}
|
|
|
|
}
|
|
|