@@ -20,15 +20,15 @@ class SMSTest extends VonageTestCase
2020 public function testCanSetUnicodeType (): void
2121 {
2222 $ sms = (new SMS ('447700900000 ' , '16105551212 ' , 'Test Message ' ));
23- $ this ->assertSame ('unicode ' , $ sms ->getType ());
24- $ sms ->setType ('text ' );
2523 $ this ->assertSame ('text ' , $ sms ->getType ());
24+ $ sms ->setType ('unicode ' );
25+ $ this ->assertSame ('unicode ' , $ sms ->getType ());
2626 }
2727
2828 public function testCanSetUnicodeTypeInConstructor (): void
2929 {
30- $ sms = (new SMS ('447700900000 ' , '16105551212 ' , 'Test Message ' , 'text ' ));
31- $ this ->assertSame ('text ' , $ sms ->getType ());
30+ $ sms = (new SMS ('447700900000 ' , '16105551212 ' , 'Test Message ' , 'unicode ' ));
31+ $ this ->assertSame ('unicode ' , $ sms ->getType ());
3232 }
3333
3434 public function testDeliveryCallbackCanBeSet (): void
@@ -96,7 +96,7 @@ public function testCannotSetTooLongOfaClientRef(): void
9696 ->setClientRef ('This is a really long client ref and should throw an exception ' );
9797 }
9898
99- public function testCanSetEntityId ()
99+ public function testCanSetEntityId (): void
100100 {
101101 $ sms = new SMS ('447700900000 ' , '16105551212 ' , 'Test Message ' );
102102 $ sms ->setEntityId ('abcd ' );
@@ -106,7 +106,7 @@ public function testCanSetEntityId()
106106 'entity-id ' => 'abcd ' ,
107107 'to ' => '447700900000 ' ,
108108 'from ' => '16105551212 ' ,
109- 'type ' => 'unicode ' ,
109+ 'type ' => 'text ' ,
110110 'ttl ' => 259200000 ,
111111 'status-report-req ' => 1 ,
112112 ];
@@ -115,7 +115,7 @@ public function testCanSetEntityId()
115115 $ this ->assertSame ($ expected ['entity-id ' ], $ sms ->getEntityId ());
116116 }
117117
118- public function testCanSetContentId ()
118+ public function testCanSetContentId (): void
119119 {
120120 $ sms = new SMS ('447700900000 ' , '16105551212 ' , 'Test Message ' );
121121 $ sms ->setContentId ('1234 ' );
@@ -125,7 +125,7 @@ public function testCanSetContentId()
125125 'content-id ' => '1234 ' ,
126126 'to ' => '447700900000 ' ,
127127 'from ' => '16105551212 ' ,
128- 'type ' => 'unicode ' ,
128+ 'type ' => 'text ' ,
129129 'ttl ' => 259200000 ,
130130 'status-report-req ' => 1 ,
131131 ];
@@ -134,7 +134,7 @@ public function testCanSetContentId()
134134 $ this ->assertSame ($ expected ['content-id ' ], $ sms ->getContentId ());
135135 }
136136
137- public function testDLTInfoAppearsInRequest ()
137+ public function testDLTInfoAppearsInRequest (): void
138138 {
139139 $ sms = new SMS ('447700900000 ' , '16105551212 ' , 'Test Message ' );
140140 $ sms ->enableDLT ('abcd ' , '1234 ' );
@@ -145,27 +145,48 @@ public function testDLTInfoAppearsInRequest()
145145 'content-id ' => '1234 ' ,
146146 'to ' => '447700900000 ' ,
147147 'from ' => '16105551212 ' ,
148- 'type ' => 'unicode ' ,
148+ 'type ' => 'text ' ,
149149 'ttl ' => 259200000 ,
150150 'status-report-req ' => 1 ,
151151 ];
152152
153153 $ this ->assertSame ($ expected , $ sms ->toArray ());
154154 }
155155
156- public function testDLTInfoDoesNotAppearsWhenNotSet ()
156+ public function testDLTInfoDoesNotAppearsWhenNotSet (): void
157157 {
158158 $ sms = new SMS ('447700900000 ' , '16105551212 ' , 'Test Message ' );
159159
160160 $ expected = [
161161 'text ' => 'Test Message ' ,
162162 'to ' => '447700900000 ' ,
163163 'from ' => '16105551212 ' ,
164- 'type ' => 'unicode ' ,
164+ 'type ' => 'text ' ,
165165 'ttl ' => 259200000 ,
166166 'status-report-req ' => 1 ,
167167 ];
168168
169169 $ this ->assertSame ($ expected , $ sms ->toArray ());
170170 }
171+
172+ /**
173+ * @dataProvider unicodeStringDataProvider
174+ * @return void
175+ */
176+ public function testGsm7Identification (string $ message , bool $ expectedGsm7 )
177+ {
178+ $ sms = new SMS ('16105551212 ' , '16105551212 ' , $ message );
179+ $ this ->assertEquals ($ expectedGsm7 , $ sms ->isGsm7 ());
180+ }
181+
182+ public function unicodeStringDataProvider (): array
183+ {
184+ return [
185+ ['this is a text ' , true ],
186+ ['This is also a GSM7 text ' , true ],
187+ ['This is a Çotcha ' , true ],
188+ ['This is also a çotcha ' , true ],
189+ ['日本語でボナージュ ' , false ],
190+ ];
191+ }
171192}
0 commit comments