| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,143 @@ |
| 1 |
+<?php |
|
| 2 |
+namespace XML; |
|
| 3 |
+ |
|
| 4 |
+use Plivo\XML\Response; |
|
| 5 |
+use Plivo\Tests\BaseTestCase; |
|
| 6 |
+ |
|
| 7 |
+/** |
|
| 8 |
+ * Class SayAsTest |
|
| 9 |
+ * @package Plivo\Tests\XML |
|
| 10 |
+ */ |
|
| 11 |
+class SayAsTest extends BaseTestCase |
|
| 12 |
+{
|
|
| 13 |
+ |
|
| 14 |
+ function testAddProsody() |
|
| 15 |
+ {
|
|
| 16 |
+ $response = new Response(); |
|
| 17 |
+ $params1 = array( |
|
| 18 |
+ 'language' => 'en-US', |
|
| 19 |
+ 'voice' => 'Polly.Joanna' |
|
| 20 |
+ ); |
|
| 21 |
+ |
|
| 22 |
+ $params2 = array( |
|
| 23 |
+ 'interpret-as' => 'date', |
|
| 24 |
+ 'format' => 'dmy' |
|
| 25 |
+ ); |
|
| 26 |
+ |
|
| 27 |
+ $response->addSpeak('I was born on ',$params1)
|
|
| 28 |
+ ->addSayAs('12-31-1977',$params2);
|
|
| 29 |
+ $ssml = $response->toXML(true); |
|
| 30 |
+ // $actual = new \DOMDocument; |
|
| 31 |
+ // $actual->loadXML($ssml); |
|
| 32 |
+ |
|
| 33 |
+ self::assertNotNull($ssml); |
|
| 34 |
+ |
|
| 35 |
+ self::assertXmlStringEqualsXmlFile(__DIR__ . '/../Mocks/sayAsSpeak.xml',$ssml); |
|
| 36 |
+ } |
|
| 37 |
+ |
|
| 38 |
+ function testExceptionAddProsody() |
|
| 39 |
+ {
|
|
| 40 |
+ $this->expectPlivoException('Plivo\Exceptions\PlivoXMLException');
|
|
| 41 |
+ $response = new Response(); |
|
| 42 |
+ $params1 = array( |
|
| 43 |
+ 'language' => 'en-US', |
|
| 44 |
+ 'voice' => 'Polly.Joanna' |
|
| 45 |
+ ); |
|
| 46 |
+ |
|
| 47 |
+ $params2 = array( |
|
| 48 |
+ 'interpret-as' => 'date', |
|
| 49 |
+ 'format' => 'dmy' |
|
| 50 |
+ ); |
|
| 51 |
+ |
|
| 52 |
+ $response->addSpeak('I was born on ',$params1)
|
|
| 53 |
+ ->addSayAs('',$params2);
|
|
| 54 |
+ } |
|
| 55 |
+ |
|
| 56 |
+ function testExceptionAttributeInterpretAsAddProsody() |
|
| 57 |
+ {
|
|
| 58 |
+ $this->expectPlivoException('Plivo\Exceptions\PlivoXMLException');
|
|
| 59 |
+ $response = new Response(); |
|
| 60 |
+ $params1 = array( |
|
| 61 |
+ 'language' => 'en-US', |
|
| 62 |
+ 'voice' => 'Polly.Joanna' |
|
| 63 |
+ ); |
|
| 64 |
+ |
|
| 65 |
+ $params2 = array( |
|
| 66 |
+ 'interpretas' => 'date' |
|
| 67 |
+ ); |
|
| 68 |
+ |
|
| 69 |
+ $response->addSpeak('I was born on ',$params1)
|
|
| 70 |
+ ->addSayAs('12-31-1977',$params2);
|
|
| 71 |
+ $ssml = $response->toXML(true); |
|
| 72 |
+ } |
|
| 73 |
+ |
|
| 74 |
+ function testExceptionAttributeFormatAddProsody() |
|
| 75 |
+ {
|
|
| 76 |
+ $this->expectPlivoException('Plivo\Exceptions\PlivoXMLException');
|
|
| 77 |
+ $response = new Response(); |
|
| 78 |
+ $params1 = array( |
|
| 79 |
+ 'language' => 'en-US', |
|
| 80 |
+ 'voice' => 'Polly.Joanna' |
|
| 81 |
+ ); |
|
| 82 |
+ |
|
| 83 |
+ $params2 = array( |
|
| 84 |
+ 'formats' => 'mdy' |
|
| 85 |
+ ); |
|
| 86 |
+ |
|
| 87 |
+ $response->addSpeak('I was born on ',$params1)
|
|
| 88 |
+ ->addSayAs('12-31-1977',$params2);
|
|
| 89 |
+ $ssml = $response->toXML(true); |
|
| 90 |
+ } |
|
| 91 |
+ |
|
| 92 |
+ function testExceptionAttributeInterpretAsValueAddProsody() |
|
| 93 |
+ {
|
|
| 94 |
+ $this->expectPlivoException('Plivo\Exceptions\PlivoXMLException');
|
|
| 95 |
+ $response = new Response(); |
|
| 96 |
+ $params1 = array( |
|
| 97 |
+ 'language' => 'en-US', |
|
| 98 |
+ 'voice' => 'Polly.Joanna' |
|
| 99 |
+ ); |
|
| 100 |
+ |
|
| 101 |
+ $params2 = array( |
|
| 102 |
+ 'interpret-as' => 'loud' |
|
| 103 |
+ ); |
|
| 104 |
+ |
|
| 105 |
+ $response->addSpeak('I was born on ',$params1)
|
|
| 106 |
+ ->addSayAs('12-31-1977',$params2);
|
|
| 107 |
+ $ssml = $response->toXML(true); |
|
| 108 |
+ } |
|
| 109 |
+ |
|
| 110 |
+ function testExceptionAttributeFormatValueAddProsody() |
|
| 111 |
+ {
|
|
| 112 |
+ $this->expectPlivoException('Plivo\Exceptions\PlivoXMLException');
|
|
| 113 |
+ $response = new Response(); |
|
| 114 |
+ $params1 = array( |
|
| 115 |
+ 'language' => 'en-US', |
|
| 116 |
+ 'voice' => 'Polly.Joanna' |
|
| 117 |
+ ); |
|
| 118 |
+ |
|
| 119 |
+ $params2 = array( |
|
| 120 |
+ 'format' => 'mdyy' |
|
| 121 |
+ ); |
|
| 122 |
+ |
|
| 123 |
+ $response->addSpeak('I was born on ',$params1)
|
|
| 124 |
+ ->addSayAs('12-31-1977',$params2);
|
|
| 125 |
+ $ssml = $response->toXML(true); |
|
| 126 |
+ } |
|
| 127 |
+ |
|
| 128 |
+ function testExceptionSSMLSupported() |
|
| 129 |
+ {
|
|
| 130 |
+ $this->expectPlivoException('Plivo\Exceptions\PlivoXMLException');
|
|
| 131 |
+ $response = new Response(); |
|
| 132 |
+ $params1 = array( |
|
| 133 |
+ 'language' => 'en-US' |
|
| 134 |
+ ); |
|
| 135 |
+ |
|
| 136 |
+ $params2 = array( |
|
| 137 |
+ 'format' => 'mdyy' |
|
| 138 |
+ ); |
|
| 139 |
+ |
|
| 140 |
+ $response->addSpeak('I was born on ',$params1)
|
|
| 141 |
+ ->addSayAs('12-31-1977',$params2);
|
|
| 142 |
+ } |
|
| 143 |
+} |
|
| 0 | 144 |
\ No newline at end of file |
| 1 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,143 +0,0 @@ |
| 1 |
-<?php |
|
| 2 |
-namespace XML; |
|
| 3 |
- |
|
| 4 |
-use Plivo\XML\Response; |
|
| 5 |
-use Plivo\Tests\BaseTestCase; |
|
| 6 |
- |
|
| 7 |
-/** |
|
| 8 |
- * Class SayAsTest |
|
| 9 |
- * @package Plivo\Tests\XML |
|
| 10 |
- */ |
|
| 11 |
-class SayAsTest extends BaseTestCase |
|
| 12 |
-{
|
|
| 13 |
- |
|
| 14 |
- function testAddProsody() |
|
| 15 |
- {
|
|
| 16 |
- $response = new Response(); |
|
| 17 |
- $params1 = array( |
|
| 18 |
- 'language' => 'en-US', |
|
| 19 |
- 'voice' => 'Polly.Joanna' |
|
| 20 |
- ); |
|
| 21 |
- |
|
| 22 |
- $params2 = array( |
|
| 23 |
- 'interpret-as' => 'date', |
|
| 24 |
- 'format' => 'dmy' |
|
| 25 |
- ); |
|
| 26 |
- |
|
| 27 |
- $response->addSpeak('I was born on ',$params1)
|
|
| 28 |
- ->addSayAs('12-31-1977',$params2);
|
|
| 29 |
- $ssml = $response->toXML(true); |
|
| 30 |
- // $actual = new \DOMDocument; |
|
| 31 |
- // $actual->loadXML($ssml); |
|
| 32 |
- |
|
| 33 |
- self::assertNotNull($ssml); |
|
| 34 |
- |
|
| 35 |
- self::assertXmlStringEqualsXmlFile(__DIR__ . '/../Mocks/sayAsSpeak.xml',$ssml); |
|
| 36 |
- } |
|
| 37 |
- |
|
| 38 |
- function testExceptionAddProsody() |
|
| 39 |
- {
|
|
| 40 |
- $this->expectPlivoException('Plivo\Exceptions\PlivoXMLException');
|
|
| 41 |
- $response = new Response(); |
|
| 42 |
- $params1 = array( |
|
| 43 |
- 'language' => 'en-US', |
|
| 44 |
- 'voice' => 'Polly.Joanna' |
|
| 45 |
- ); |
|
| 46 |
- |
|
| 47 |
- $params2 = array( |
|
| 48 |
- 'interpret-as' => 'date', |
|
| 49 |
- 'format' => 'dmy' |
|
| 50 |
- ); |
|
| 51 |
- |
|
| 52 |
- $response->addSpeak('I was born on ',$params1)
|
|
| 53 |
- ->addSayAs('',$params2);
|
|
| 54 |
- } |
|
| 55 |
- |
|
| 56 |
- function testExceptionAttributeInterpretAsAddProsody() |
|
| 57 |
- {
|
|
| 58 |
- $this->expectPlivoException('Plivo\Exceptions\PlivoXMLException');
|
|
| 59 |
- $response = new Response(); |
|
| 60 |
- $params1 = array( |
|
| 61 |
- 'language' => 'en-US', |
|
| 62 |
- 'voice' => 'Polly.Joanna' |
|
| 63 |
- ); |
|
| 64 |
- |
|
| 65 |
- $params2 = array( |
|
| 66 |
- 'interpretas' => 'date' |
|
| 67 |
- ); |
|
| 68 |
- |
|
| 69 |
- $response->addSpeak('I was born on ',$params1)
|
|
| 70 |
- ->addSayAs('12-31-1977',$params2);
|
|
| 71 |
- $ssml = $response->toXML(true); |
|
| 72 |
- } |
|
| 73 |
- |
|
| 74 |
- function testExceptionAttributeFormatAddProsody() |
|
| 75 |
- {
|
|
| 76 |
- $this->expectPlivoException('Plivo\Exceptions\PlivoXMLException');
|
|
| 77 |
- $response = new Response(); |
|
| 78 |
- $params1 = array( |
|
| 79 |
- 'language' => 'en-US', |
|
| 80 |
- 'voice' => 'Polly.Joanna' |
|
| 81 |
- ); |
|
| 82 |
- |
|
| 83 |
- $params2 = array( |
|
| 84 |
- 'formats' => 'mdy' |
|
| 85 |
- ); |
|
| 86 |
- |
|
| 87 |
- $response->addSpeak('I was born on ',$params1)
|
|
| 88 |
- ->addSayAs('12-31-1977',$params2);
|
|
| 89 |
- $ssml = $response->toXML(true); |
|
| 90 |
- } |
|
| 91 |
- |
|
| 92 |
- function testExceptionAttributeInterpretAsValueAddProsody() |
|
| 93 |
- {
|
|
| 94 |
- $this->expectPlivoException('Plivo\Exceptions\PlivoXMLException');
|
|
| 95 |
- $response = new Response(); |
|
| 96 |
- $params1 = array( |
|
| 97 |
- 'language' => 'en-US', |
|
| 98 |
- 'voice' => 'Polly.Joanna' |
|
| 99 |
- ); |
|
| 100 |
- |
|
| 101 |
- $params2 = array( |
|
| 102 |
- 'interpret-as' => 'loud' |
|
| 103 |
- ); |
|
| 104 |
- |
|
| 105 |
- $response->addSpeak('I was born on ',$params1)
|
|
| 106 |
- ->addSayAs('12-31-1977',$params2);
|
|
| 107 |
- $ssml = $response->toXML(true); |
|
| 108 |
- } |
|
| 109 |
- |
|
| 110 |
- function testExceptionAttributeFormatValueAddProsody() |
|
| 111 |
- {
|
|
| 112 |
- $this->expectPlivoException('Plivo\Exceptions\PlivoXMLException');
|
|
| 113 |
- $response = new Response(); |
|
| 114 |
- $params1 = array( |
|
| 115 |
- 'language' => 'en-US', |
|
| 116 |
- 'voice' => 'Polly.Joanna' |
|
| 117 |
- ); |
|
| 118 |
- |
|
| 119 |
- $params2 = array( |
|
| 120 |
- 'format' => 'mdyy' |
|
| 121 |
- ); |
|
| 122 |
- |
|
| 123 |
- $response->addSpeak('I was born on ',$params1)
|
|
| 124 |
- ->addSayAs('12-31-1977',$params2);
|
|
| 125 |
- $ssml = $response->toXML(true); |
|
| 126 |
- } |
|
| 127 |
- |
|
| 128 |
- function testExceptionSSMLSupported() |
|
| 129 |
- {
|
|
| 130 |
- $this->expectPlivoException('Plivo\Exceptions\PlivoXMLException');
|
|
| 131 |
- $response = new Response(); |
|
| 132 |
- $params1 = array( |
|
| 133 |
- 'language' => 'en-US' |
|
| 134 |
- ); |
|
| 135 |
- |
|
| 136 |
- $params2 = array( |
|
| 137 |
- 'format' => 'mdyy' |
|
| 138 |
- ); |
|
| 139 |
- |
|
| 140 |
- $response->addSpeak('I was born on ',$params1)
|
|
| 141 |
- ->addSayAs('12-31-1977',$params2);
|
|
| 142 |
- } |
|
| 143 |
-} |
|
| 144 | 0 |
\ No newline at end of file |
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,143 @@ |
| 1 |
+<?php |
|
| 2 |
+namespace XML; |
|
| 3 |
+ |
|
| 4 |
+use Plivo\XML\Response; |
|
| 5 |
+use Plivo\Tests\BaseTestCase; |
|
| 6 |
+ |
|
| 7 |
+/** |
|
| 8 |
+ * Class SayAsTest |
|
| 9 |
+ * @package Plivo\Tests\XML |
|
| 10 |
+ */ |
|
| 11 |
+class SayAsTest extends BaseTestCase |
|
| 12 |
+{
|
|
| 13 |
+ |
|
| 14 |
+ function testAddProsody() |
|
| 15 |
+ {
|
|
| 16 |
+ $response = new Response(); |
|
| 17 |
+ $params1 = array( |
|
| 18 |
+ 'language' => 'en-US', |
|
| 19 |
+ 'voice' => 'Polly.Joanna' |
|
| 20 |
+ ); |
|
| 21 |
+ |
|
| 22 |
+ $params2 = array( |
|
| 23 |
+ 'interpret-as' => 'date', |
|
| 24 |
+ 'format' => 'dmy' |
|
| 25 |
+ ); |
|
| 26 |
+ |
|
| 27 |
+ $response->addSpeak('I was born on ',$params1)
|
|
| 28 |
+ ->addSayAs('12-31-1977',$params2);
|
|
| 29 |
+ $ssml = $response->toXML(true); |
|
| 30 |
+ // $actual = new \DOMDocument; |
|
| 31 |
+ // $actual->loadXML($ssml); |
|
| 32 |
+ |
|
| 33 |
+ self::assertNotNull($ssml); |
|
| 34 |
+ |
|
| 35 |
+ self::assertXmlStringEqualsXmlFile(__DIR__ . '/../Mocks/sayAsSpeak.xml',$ssml); |
|
| 36 |
+ } |
|
| 37 |
+ |
|
| 38 |
+ function testExceptionAddProsody() |
|
| 39 |
+ {
|
|
| 40 |
+ $this->expectPlivoException('Plivo\Exceptions\PlivoXMLException');
|
|
| 41 |
+ $response = new Response(); |
|
| 42 |
+ $params1 = array( |
|
| 43 |
+ 'language' => 'en-US', |
|
| 44 |
+ 'voice' => 'Polly.Joanna' |
|
| 45 |
+ ); |
|
| 46 |
+ |
|
| 47 |
+ $params2 = array( |
|
| 48 |
+ 'interpret-as' => 'date', |
|
| 49 |
+ 'format' => 'dmy' |
|
| 50 |
+ ); |
|
| 51 |
+ |
|
| 52 |
+ $response->addSpeak('I was born on ',$params1)
|
|
| 53 |
+ ->addSayAs('',$params2);
|
|
| 54 |
+ } |
|
| 55 |
+ |
|
| 56 |
+ function testExceptionAttributeInterpretAsAddProsody() |
|
| 57 |
+ {
|
|
| 58 |
+ $this->expectPlivoException('Plivo\Exceptions\PlivoXMLException');
|
|
| 59 |
+ $response = new Response(); |
|
| 60 |
+ $params1 = array( |
|
| 61 |
+ 'language' => 'en-US', |
|
| 62 |
+ 'voice' => 'Polly.Joanna' |
|
| 63 |
+ ); |
|
| 64 |
+ |
|
| 65 |
+ $params2 = array( |
|
| 66 |
+ 'interpretas' => 'date' |
|
| 67 |
+ ); |
|
| 68 |
+ |
|
| 69 |
+ $response->addSpeak('I was born on ',$params1)
|
|
| 70 |
+ ->addSayAs('12-31-1977',$params2);
|
|
| 71 |
+ $ssml = $response->toXML(true); |
|
| 72 |
+ } |
|
| 73 |
+ |
|
| 74 |
+ function testExceptionAttributeFormatAddProsody() |
|
| 75 |
+ {
|
|
| 76 |
+ $this->expectPlivoException('Plivo\Exceptions\PlivoXMLException');
|
|
| 77 |
+ $response = new Response(); |
|
| 78 |
+ $params1 = array( |
|
| 79 |
+ 'language' => 'en-US', |
|
| 80 |
+ 'voice' => 'Polly.Joanna' |
|
| 81 |
+ ); |
|
| 82 |
+ |
|
| 83 |
+ $params2 = array( |
|
| 84 |
+ 'formats' => 'mdy' |
|
| 85 |
+ ); |
|
| 86 |
+ |
|
| 87 |
+ $response->addSpeak('I was born on ',$params1)
|
|
| 88 |
+ ->addSayAs('12-31-1977',$params2);
|
|
| 89 |
+ $ssml = $response->toXML(true); |
|
| 90 |
+ } |
|
| 91 |
+ |
|
| 92 |
+ function testExceptionAttributeInterpretAsValueAddProsody() |
|
| 93 |
+ {
|
|
| 94 |
+ $this->expectPlivoException('Plivo\Exceptions\PlivoXMLException');
|
|
| 95 |
+ $response = new Response(); |
|
| 96 |
+ $params1 = array( |
|
| 97 |
+ 'language' => 'en-US', |
|
| 98 |
+ 'voice' => 'Polly.Joanna' |
|
| 99 |
+ ); |
|
| 100 |
+ |
|
| 101 |
+ $params2 = array( |
|
| 102 |
+ 'interpret-as' => 'loud' |
|
| 103 |
+ ); |
|
| 104 |
+ |
|
| 105 |
+ $response->addSpeak('I was born on ',$params1)
|
|
| 106 |
+ ->addSayAs('12-31-1977',$params2);
|
|
| 107 |
+ $ssml = $response->toXML(true); |
|
| 108 |
+ } |
|
| 109 |
+ |
|
| 110 |
+ function testExceptionAttributeFormatValueAddProsody() |
|
| 111 |
+ {
|
|
| 112 |
+ $this->expectPlivoException('Plivo\Exceptions\PlivoXMLException');
|
|
| 113 |
+ $response = new Response(); |
|
| 114 |
+ $params1 = array( |
|
| 115 |
+ 'language' => 'en-US', |
|
| 116 |
+ 'voice' => 'Polly.Joanna' |
|
| 117 |
+ ); |
|
| 118 |
+ |
|
| 119 |
+ $params2 = array( |
|
| 120 |
+ 'format' => 'mdyy' |
|
| 121 |
+ ); |
|
| 122 |
+ |
|
| 123 |
+ $response->addSpeak('I was born on ',$params1)
|
|
| 124 |
+ ->addSayAs('12-31-1977',$params2);
|
|
| 125 |
+ $ssml = $response->toXML(true); |
|
| 126 |
+ } |
|
| 127 |
+ |
|
| 128 |
+ function testExceptionSSMLSupported() |
|
| 129 |
+ {
|
|
| 130 |
+ $this->expectPlivoException('Plivo\Exceptions\PlivoXMLException');
|
|
| 131 |
+ $response = new Response(); |
|
| 132 |
+ $params1 = array( |
|
| 133 |
+ 'language' => 'en-US' |
|
| 134 |
+ ); |
|
| 135 |
+ |
|
| 136 |
+ $params2 = array( |
|
| 137 |
+ 'format' => 'mdyy' |
|
| 138 |
+ ); |
|
| 139 |
+ |
|
| 140 |
+ $response->addSpeak('I was born on ',$params1)
|
|
| 141 |
+ ->addSayAs('12-31-1977',$params2);
|
|
| 142 |
+ } |
|
| 143 |
+} |
|
| 0 | 144 |
\ No newline at end of file |