forked from mheadd/tropo-webapi-php-original
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug TROPO-12574 name shouldn't be a necessary parameter in WebAPI SDK
- Loading branch information
Showing
8 changed files
with
185 additions
and
406 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,21 +7,15 @@ class CallTest extends PHPUnit_Framework_TestCase | |
|
||
public function testCallWithMinOptions() { | ||
$tropo = new Tropo(); | ||
$params = array( | ||
'name' => 'foo' | ||
); | ||
$tropo->call("sip:[email protected]:5678", $params); | ||
$this->assertEquals(sprintf($tropo), '{"tropo":[{"call":{"to":"sip:[email protected]:5678","name":"foo"}}]}'); | ||
$tropo->call("sip:[email protected]:5678"); | ||
$this->assertEquals(sprintf($tropo), '{"tropo":[{"call":{"to":"sip:[email protected]:5678"}}]}'); | ||
} | ||
|
||
public function testCallWithExtraToOptiions() { | ||
$tropo = new Tropo(); | ||
$call = array('sip:[email protected]:5678', 'sip:[email protected]:5678'); | ||
$params = array( | ||
'name' => 'foo' | ||
); | ||
$tropo->call($call, $params); | ||
$this->assertEquals(sprintf($tropo), '{"tropo":[{"call":{"to":["sip:[email protected]:5678","sip:[email protected]:5678"],"name":"foo"}}]}'); | ||
$tropo->call($call); | ||
$this->assertEquals(sprintf($tropo), '{"tropo":[{"call":{"to":["sip:[email protected]:5678","sip:[email protected]:5678"]}}]}'); | ||
} | ||
|
||
public function testCallWithAllOptions() { | ||
|
@@ -36,7 +30,6 @@ public function testCallWithAllOptions() { | |
'from' => '3055551000', | ||
'headers' => $headers, | ||
'machineDetection' => false, | ||
'name' => 'foo', | ||
'network' => Network::$sip, | ||
'required' => true, | ||
'timeout' => 30.0, | ||
|
@@ -46,7 +39,7 @@ public function testCallWithAllOptions() { | |
'label' => 'callLabel' | ||
); | ||
$tropo->call($call, $params); | ||
$this->assertEquals(sprintf($tropo), '{"tropo":[{"call":{"to":["sip:[email protected]:5678","sip:[email protected]:5678"],"from":"3055551000","network":"SIP","channel":"VOICE","timeout":30,"answerOnMedia":false,"headers":{"foo":"bar","bling":"baz"},"allowSignals":["exit","quit"],"machineDetection":false,"voice":"allison","name":"foo","required":true,"callbackUrl":"http://192.168.26.203/result.php","promptLogSecurity":"suppress","label":"callLabel"}}]}'); | ||
$this->assertEquals(sprintf($tropo), '{"tropo":[{"call":{"to":["sip:[email protected]:5678","sip:[email protected]:5678"],"from":"3055551000","network":"SIP","channel":"VOICE","timeout":30,"answerOnMedia":false,"headers":{"foo":"bar","bling":"baz"},"allowSignals":["exit","quit"],"machineDetection":false,"voice":"allison","required":true,"callbackUrl":"http://192.168.26.203/result.php","promptLogSecurity":"suppress","label":"callLabel"}}]}'); | ||
} | ||
|
||
public function testCallWithAllOptions1() { | ||
|
@@ -61,7 +54,6 @@ public function testCallWithAllOptions1() { | |
'from' => '3055551000', | ||
'headers' => $headers, | ||
'machineDetection' => 'For the most accurate results, the "introduction" should be long enough to give Tropo time to detect a human or machine. The longer the introduction, the more time we have to determine how the call was answered.', | ||
'name' => 'foo', | ||
'network' => Network::$sip, | ||
'required' => true, | ||
'timeout' => 30.0, | ||
|
@@ -71,32 +63,32 @@ public function testCallWithAllOptions1() { | |
'label' => 'callLabel' | ||
); | ||
$tropo->call($call, $params); | ||
$this->assertEquals(sprintf($tropo), '{"tropo":[{"call":{"to":["sip:[email protected]:5678","sip:[email protected]:5678"],"from":"3055551000","network":"SIP","channel":"VOICE","timeout":30,"answerOnMedia":false,"headers":{"foo":"bar","bling":"baz"},"allowSignals":["exit","quit"],"machineDetection":{"introduction":"For the most accurate results, the \"introduction\" should be long enough to give Tropo time to detect a human or machine. The longer the introduction, the more time we have to determine how the call was answered.","voice":"allison"},"voice":"allison","name":"foo","required":true,"callbackUrl":"http://192.168.26.203/result.php","promptLogSecurity":"suppress","label":"callLabel"}}]}'); | ||
$this->assertEquals(sprintf($tropo), '{"tropo":[{"call":{"to":["sip:[email protected]:5678","sip:[email protected]:5678"],"from":"3055551000","network":"SIP","channel":"VOICE","timeout":30,"answerOnMedia":false,"headers":{"foo":"bar","bling":"baz"},"allowSignals":["exit","quit"],"machineDetection":{"introduction":"For the most accurate results, the \"introduction\" should be long enough to give Tropo time to detect a human or machine. The longer the introduction, the more time we have to determine how the call was answered.","voice":"allison"},"voice":"allison","required":true,"callbackUrl":"http://192.168.26.203/result.php","promptLogSecurity":"suppress","label":"callLabel"}}]}'); | ||
} | ||
|
||
public function testCreateMinObject() { | ||
$tropo = new Tropo(); | ||
$call = new Call("sip:[email protected]:5678", null, null, null, null, null, null, null, null, null, null, "foo"); | ||
$call = new Call("sip:[email protected]:5678"); | ||
$tropo->call($call); | ||
$this->assertEquals(sprintf($tropo), '{"tropo":[{"call":{"to":"sip:[email protected]:5678","name":"foo"}}]}'); | ||
$this->assertEquals(sprintf($tropo), '{"tropo":[{"call":{"to":"sip:[email protected]:5678"}}]}'); | ||
} | ||
|
||
public function testCreateObject1() { | ||
$tropo = new Tropo(); | ||
$to = array("sip:[email protected]:5678", "sip:[email protected]:5678"); | ||
$call = new Call($to, null, null, null, null, null, null, null, null, null, null, "foo"); | ||
$call = new Call($to); | ||
$tropo->call($call); | ||
$this->assertEquals(sprintf($tropo), '{"tropo":[{"call":{"to":["sip:[email protected]:5678","sip:[email protected]:5678"],"name":"foo"}}]}'); | ||
$this->assertEquals(sprintf($tropo), '{"tropo":[{"call":{"to":["sip:[email protected]:5678","sip:[email protected]:5678"]}}]}'); | ||
} | ||
|
||
public function testCreateObject2() { | ||
$tropo = new Tropo(); | ||
$to = array("sip:[email protected]:5678", "sip:[email protected]:5678"); | ||
$allowSignals = array('exit', 'quit'); | ||
$headers = array('foo' => 'bar', 'bling' => 'baz'); | ||
$call = new Call($to, "3055551000", Network::$sip, Channel::$voice, false, 30.0, $headers, null, $allowSignals, false, Voice::$US_English_female_allison, "foo", true, "http://192.168.26.203/result.php", "suppress", "callLabel"); | ||
$call = new Call($to, "3055551000", Network::$sip, Channel::$voice, false, 30.0, $headers, null, $allowSignals, false, Voice::$US_English_female_allison, null, true, "http://192.168.26.203/result.php", "suppress", "callLabel"); | ||
$tropo->call($call); | ||
$this->assertEquals(sprintf($tropo), '{"tropo":[{"call":{"to":["sip:[email protected]:5678","sip:[email protected]:5678"],"from":"3055551000","network":"SIP","channel":"VOICE","timeout":30,"answerOnMedia":false,"headers":{"foo":"bar","bling":"baz"},"allowSignals":["exit","quit"],"machineDetection":false,"voice":"allison","name":"foo","required":true,"callbackUrl":"http://192.168.26.203/result.php","promptLogSecurity":"suppress","label":"callLabel"}}]}'); | ||
$this->assertEquals(sprintf($tropo), '{"tropo":[{"call":{"to":["sip:[email protected]:5678","sip:[email protected]:5678"],"from":"3055551000","network":"SIP","channel":"VOICE","timeout":30,"answerOnMedia":false,"headers":{"foo":"bar","bling":"baz"},"allowSignals":["exit","quit"],"machineDetection":false,"voice":"allison","required":true,"callbackUrl":"http://192.168.26.203/result.php","promptLogSecurity":"suppress","label":"callLabel"}}]}'); | ||
} | ||
|
||
public function testCreateObject3() { | ||
|
@@ -105,9 +97,9 @@ public function testCreateObject3() { | |
$allowSignals = array('exit', 'quit'); | ||
$headers = array('foo' => 'bar', 'bling' => 'baz'); | ||
$machineDetection = 'For the most accurate results, the "introduction" should be long enough to give Tropo time to detect a human or machine. The longer the introduction, the more time we have to determine how the call was answered.'; | ||
$call = new Call($to, "3055551000", Network::$sip, Channel::$voice, false, 30.0, $headers, null, $allowSignals, $machineDetection, Voice::$US_English_female_allison, "foo", true, "http://192.168.26.203/result.php", "suppress", "callLabel"); | ||
$call = new Call($to, "3055551000", Network::$sip, Channel::$voice, false, 30.0, $headers, null, $allowSignals, $machineDetection, Voice::$US_English_female_allison, null, true, "http://192.168.26.203/result.php", "suppress", "callLabel"); | ||
$tropo->call($call); | ||
$this->assertEquals(sprintf($tropo), '{"tropo":[{"call":{"to":["sip:[email protected]:5678","sip:[email protected]:5678"],"from":"3055551000","network":"SIP","channel":"VOICE","timeout":30,"answerOnMedia":false,"headers":{"foo":"bar","bling":"baz"},"allowSignals":["exit","quit"],"machineDetection":{"introduction":"For the most accurate results, the \"introduction\" should be long enough to give Tropo time to detect a human or machine. The longer the introduction, the more time we have to determine how the call was answered.","voice":"allison"},"voice":"allison","name":"foo","required":true,"callbackUrl":"http://192.168.26.203/result.php","promptLogSecurity":"suppress","label":"callLabel"}}]}'); | ||
$this->assertEquals(sprintf($tropo), '{"tropo":[{"call":{"to":["sip:[email protected]:5678","sip:[email protected]:5678"],"from":"3055551000","network":"SIP","channel":"VOICE","timeout":30,"answerOnMedia":false,"headers":{"foo":"bar","bling":"baz"},"allowSignals":["exit","quit"],"machineDetection":{"introduction":"For the most accurate results, the \"introduction\" should be long enough to give Tropo time to detect a human or machine. The longer the introduction, the more time we have to determine how the call was answered.","voice":"allison"},"voice":"allison","required":true,"callbackUrl":"http://192.168.26.203/result.php","promptLogSecurity":"suppress","label":"callLabel"}}]}'); | ||
} | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.