| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,84 @@ |
| 1 |
+<?php |
|
| 2 |
+namespace XML; |
|
| 3 |
+ |
|
| 4 |
+use Plivo\XML\Response; |
|
| 5 |
+use Plivo\Tests\BaseTestCase; |
|
| 6 |
+ |
|
| 7 |
+/** |
|
| 8 |
+ * Class BreakTest |
|
| 9 |
+ * @package Plivo\Tests\XML |
|
| 10 |
+ */ |
|
| 11 |
+class BreakTest extends BaseTestCase |
|
| 12 |
+{
|
|
| 13 |
+ |
|
| 14 |
+ function testBreak() |
|
| 15 |
+ {
|
|
| 16 |
+ $response = new Response(); |
|
| 17 |
+ $params1 = array( |
|
| 18 |
+ 'language' => 'en-US', |
|
| 19 |
+ 'voice' => 'Polly.Joanna' |
|
| 20 |
+ ); |
|
| 21 |
+ |
|
| 22 |
+ $response->addSpeak('Hello,',$params1);
|
|
| 23 |
+ $response->addBreak() |
|
| 24 |
+ ->continueSpeak('Welcome to Plivo');
|
|
| 25 |
+ |
|
| 26 |
+ $ssml = $response->toXML(true); |
|
| 27 |
+ |
|
| 28 |
+ self::assertNotNull($ssml); |
|
| 29 |
+ |
|
| 30 |
+ self::assertXmlStringEqualsXmlFile(__DIR__ . '/../Mocks/break.xml',$ssml); |
|
| 31 |
+ } |
|
| 32 |
+ |
|
| 33 |
+ function testAttributeBreak() |
|
| 34 |
+ {
|
|
| 35 |
+ $params1 = array( |
|
| 36 |
+ 'language' => 'en-US', |
|
| 37 |
+ 'voice' => 'Polly.Joanna' |
|
| 38 |
+ ); |
|
| 39 |
+ $params2 = array( |
|
| 40 |
+ 'strength' => 'x-weak', |
|
| 41 |
+ 'time' => '3s' |
|
| 42 |
+ ); |
|
| 43 |
+ $response = new Response(); |
|
| 44 |
+ $response->addSpeak('Hello,',$params1);
|
|
| 45 |
+ $response->addBreak($params2) |
|
| 46 |
+ ->continueSpeak('Welcome to Plivo');
|
|
| 47 |
+ $ssml = $response->toXML(true); |
|
| 48 |
+ |
|
| 49 |
+ self::assertNotNull($ssml); |
|
| 50 |
+ self::assertXmlStringEqualsXmlFile(__DIR__ . '/../Mocks/paramBreak.xml',$ssml); |
|
| 51 |
+ } |
|
| 52 |
+ |
|
| 53 |
+ function testExceptionAttributeBreak() |
|
| 54 |
+ {
|
|
| 55 |
+ $this->expectPlivoException('Plivo\Exceptions\PlivoXMLException');
|
|
| 56 |
+ $params1 = array( |
|
| 57 |
+ 'language' => 'en-US', |
|
| 58 |
+ 'voice' => 'Polly.Joanna' |
|
| 59 |
+ ); |
|
| 60 |
+ $params2 = array( |
|
| 61 |
+ 'strength' => 'x-weak', |
|
| 62 |
+ 'times' => '3s' |
|
| 63 |
+ ); |
|
| 64 |
+ $response = new Response(); |
|
| 65 |
+ $response->addSpeak('Hello,',$params1);
|
|
| 66 |
+ $response->addBreak($params2) |
|
| 67 |
+ ->continueSpeak('Welcome to Plivo');
|
|
| 68 |
+ } |
|
| 69 |
+ |
|
| 70 |
+ function testExceptionSSMLSupported() |
|
| 71 |
+ {
|
|
| 72 |
+ $this->expectPlivoException('Plivo\Exceptions\PlivoXMLException');
|
|
| 73 |
+ $params1 = array( |
|
| 74 |
+ 'language' => 'en-US' |
|
| 75 |
+ ); |
|
| 76 |
+ $params2 = array( |
|
| 77 |
+ 'strength' => 'x-weak', |
|
| 78 |
+ 'times' => '3s' |
|
| 79 |
+ ); |
|
| 80 |
+ $response = new Response(); |
|
| 81 |
+ $response->addSpeak('Hello,',$params1);
|
|
| 82 |
+ $response->addBreak($params2); |
|
| 83 |
+ } |
|
| 84 |
+} |
|
| 0 | 85 |
\ No newline at end of file |
| 1 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,84 +0,0 @@ |
| 1 |
-<?php |
|
| 2 |
-namespace XML; |
|
| 3 |
- |
|
| 4 |
-use Plivo\XML\Response; |
|
| 5 |
-use Plivo\Tests\BaseTestCase; |
|
| 6 |
- |
|
| 7 |
-/** |
|
| 8 |
- * Class BreakTest |
|
| 9 |
- * @package Plivo\Tests\XML |
|
| 10 |
- */ |
|
| 11 |
-class BreakTest extends BaseTestCase |
|
| 12 |
-{
|
|
| 13 |
- |
|
| 14 |
- function testBreak() |
|
| 15 |
- {
|
|
| 16 |
- $response = new Response(); |
|
| 17 |
- $params1 = array( |
|
| 18 |
- 'language' => 'en-US', |
|
| 19 |
- 'voice' => 'Polly.Joanna' |
|
| 20 |
- ); |
|
| 21 |
- |
|
| 22 |
- $response->addSpeak('Hello,',$params1);
|
|
| 23 |
- $response->addBreak() |
|
| 24 |
- ->continueSpeak('Welcome to Plivo');
|
|
| 25 |
- |
|
| 26 |
- $ssml = $response->toXML(true); |
|
| 27 |
- |
|
| 28 |
- self::assertNotNull($ssml); |
|
| 29 |
- |
|
| 30 |
- self::assertXmlStringEqualsXmlFile(__DIR__ . '/../Mocks/break.xml',$ssml); |
|
| 31 |
- } |
|
| 32 |
- |
|
| 33 |
- function testAttributeBreak() |
|
| 34 |
- {
|
|
| 35 |
- $params1 = array( |
|
| 36 |
- 'language' => 'en-US', |
|
| 37 |
- 'voice' => 'Polly.Joanna' |
|
| 38 |
- ); |
|
| 39 |
- $params2 = array( |
|
| 40 |
- 'strength' => 'x-weak', |
|
| 41 |
- 'time' => '3s' |
|
| 42 |
- ); |
|
| 43 |
- $response = new Response(); |
|
| 44 |
- $response->addSpeak('Hello,',$params1);
|
|
| 45 |
- $response->addBreak($params2) |
|
| 46 |
- ->continueSpeak('Welcome to Plivo');
|
|
| 47 |
- $ssml = $response->toXML(true); |
|
| 48 |
- |
|
| 49 |
- self::assertNotNull($ssml); |
|
| 50 |
- self::assertXmlStringEqualsXmlFile(__DIR__ . '/../Mocks/paramBreak.xml',$ssml); |
|
| 51 |
- } |
|
| 52 |
- |
|
| 53 |
- function testExceptionAttributeBreak() |
|
| 54 |
- {
|
|
| 55 |
- $this->expectPlivoException('Plivo\Exceptions\PlivoXMLException');
|
|
| 56 |
- $params1 = array( |
|
| 57 |
- 'language' => 'en-US', |
|
| 58 |
- 'voice' => 'Polly.Joanna' |
|
| 59 |
- ); |
|
| 60 |
- $params2 = array( |
|
| 61 |
- 'strength' => 'x-weak', |
|
| 62 |
- 'times' => '3s' |
|
| 63 |
- ); |
|
| 64 |
- $response = new Response(); |
|
| 65 |
- $response->addSpeak('Hello,',$params1);
|
|
| 66 |
- $response->addBreak($params2) |
|
| 67 |
- ->continueSpeak('Welcome to Plivo');
|
|
| 68 |
- } |
|
| 69 |
- |
|
| 70 |
- function testExceptionSSMLSupported() |
|
| 71 |
- {
|
|
| 72 |
- $this->expectPlivoException('Plivo\Exceptions\PlivoXMLException');
|
|
| 73 |
- $params1 = array( |
|
| 74 |
- 'language' => 'en-US' |
|
| 75 |
- ); |
|
| 76 |
- $params2 = array( |
|
| 77 |
- 'strength' => 'x-weak', |
|
| 78 |
- 'times' => '3s' |
|
| 79 |
- ); |
|
| 80 |
- $response = new Response(); |
|
| 81 |
- $response->addSpeak('Hello,',$params1);
|
|
| 82 |
- $response->addBreak($params2); |
|
| 83 |
- } |
|
| 84 |
-} |
|
| 85 | 0 |
\ No newline at end of file |
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,84 @@ |
| 1 |
+<?php |
|
| 2 |
+namespace XML; |
|
| 3 |
+ |
|
| 4 |
+use Plivo\XML\Response; |
|
| 5 |
+use Plivo\Tests\BaseTestCase; |
|
| 6 |
+ |
|
| 7 |
+/** |
|
| 8 |
+ * Class BreakTest |
|
| 9 |
+ * @package Plivo\Tests\XML |
|
| 10 |
+ */ |
|
| 11 |
+class BreakTest extends BaseTestCase |
|
| 12 |
+{
|
|
| 13 |
+ |
|
| 14 |
+ function testBreak() |
|
| 15 |
+ {
|
|
| 16 |
+ $response = new Response(); |
|
| 17 |
+ $params1 = array( |
|
| 18 |
+ 'language' => 'en-US', |
|
| 19 |
+ 'voice' => 'Polly.Joanna' |
|
| 20 |
+ ); |
|
| 21 |
+ |
|
| 22 |
+ $response->addSpeak('Hello,',$params1);
|
|
| 23 |
+ $response->addBreak() |
|
| 24 |
+ ->continueSpeak('Welcome to Plivo');
|
|
| 25 |
+ |
|
| 26 |
+ $ssml = $response->toXML(true); |
|
| 27 |
+ |
|
| 28 |
+ self::assertNotNull($ssml); |
|
| 29 |
+ |
|
| 30 |
+ self::assertXmlStringEqualsXmlFile(__DIR__ . '/../Mocks/break.xml',$ssml); |
|
| 31 |
+ } |
|
| 32 |
+ |
|
| 33 |
+ function testAttributeBreak() |
|
| 34 |
+ {
|
|
| 35 |
+ $params1 = array( |
|
| 36 |
+ 'language' => 'en-US', |
|
| 37 |
+ 'voice' => 'Polly.Joanna' |
|
| 38 |
+ ); |
|
| 39 |
+ $params2 = array( |
|
| 40 |
+ 'strength' => 'x-weak', |
|
| 41 |
+ 'time' => '3s' |
|
| 42 |
+ ); |
|
| 43 |
+ $response = new Response(); |
|
| 44 |
+ $response->addSpeak('Hello,',$params1);
|
|
| 45 |
+ $response->addBreak($params2) |
|
| 46 |
+ ->continueSpeak('Welcome to Plivo');
|
|
| 47 |
+ $ssml = $response->toXML(true); |
|
| 48 |
+ |
|
| 49 |
+ self::assertNotNull($ssml); |
|
| 50 |
+ self::assertXmlStringEqualsXmlFile(__DIR__ . '/../Mocks/paramBreak.xml',$ssml); |
|
| 51 |
+ } |
|
| 52 |
+ |
|
| 53 |
+ function testExceptionAttributeBreak() |
|
| 54 |
+ {
|
|
| 55 |
+ $this->expectPlivoException('Plivo\Exceptions\PlivoXMLException');
|
|
| 56 |
+ $params1 = array( |
|
| 57 |
+ 'language' => 'en-US', |
|
| 58 |
+ 'voice' => 'Polly.Joanna' |
|
| 59 |
+ ); |
|
| 60 |
+ $params2 = array( |
|
| 61 |
+ 'strength' => 'x-weak', |
|
| 62 |
+ 'times' => '3s' |
|
| 63 |
+ ); |
|
| 64 |
+ $response = new Response(); |
|
| 65 |
+ $response->addSpeak('Hello,',$params1);
|
|
| 66 |
+ $response->addBreak($params2) |
|
| 67 |
+ ->continueSpeak('Welcome to Plivo');
|
|
| 68 |
+ } |
|
| 69 |
+ |
|
| 70 |
+ function testExceptionSSMLSupported() |
|
| 71 |
+ {
|
|
| 72 |
+ $this->expectPlivoException('Plivo\Exceptions\PlivoXMLException');
|
|
| 73 |
+ $params1 = array( |
|
| 74 |
+ 'language' => 'en-US' |
|
| 75 |
+ ); |
|
| 76 |
+ $params2 = array( |
|
| 77 |
+ 'strength' => 'x-weak', |
|
| 78 |
+ 'times' => '3s' |
|
| 79 |
+ ); |
|
| 80 |
+ $response = new Response(); |
|
| 81 |
+ $response->addSpeak('Hello,',$params1);
|
|
| 82 |
+ $response->addBreak($params2); |
|
| 83 |
+ } |
|
| 84 |
+} |
|
| 0 | 85 |
\ No newline at end of file |