@@ -46,7 +46,7 @@ public static function unsupportedMessagesProvider(): iterable
46
46
yield [new DummyMessage ()];
47
47
}
48
48
49
- public function testSuccessfulSend ()
49
+ public function testSuccessfulSend (): void
50
50
{
51
51
$ response = $ this ->createMock (ResponseInterface::class);
52
52
$ response
@@ -93,7 +93,44 @@ public function testSuccessfulSend()
93
93
self ::assertSame ('f83f8868-5e46-c6cf-e4fb-615e5a293754 ' , $ sentMessage ->getMessageId ());
94
94
}
95
95
96
- public function testFailedSend ()
96
+ public function testFailedSendWithPartialAccepted (): void
97
+ {
98
+
8000
$ response = $ this ->createMock (ResponseInterface::class);
99
+ $ response
100
+ ->expects (self ::exactly (2 ))
101
+ ->method ('getStatusCode ' )
102
+ ->willReturn (200 )
103
+ ;
104
+ $ response
105
+ ->expects (self ::once ())
106
+ ->method ('getContent ' )
107
+ ->willReturn (json_encode ([
108
+ 'response_code ' => 0 ,
109
+ 'response_status ' => 'OK ' ,
110
+ 'response_result ' => [
111
+ [
112
+ 'phone ' => '380931234567 ' ,
113
+ 'response_code ' => 406 ,
114
+ 'message_id ' => null ,
115
+ 'response_status ' => 'NOT_ALLOWED_RECIPIENT_COUNTRY ' ,
116
+ ],
117
+ ],
118
+ ]))
119
+ ;
120
+
121
+ $ client = new MockHttpClient (static fn () => $ response );
122
+
123
+ $ message = new SmsMessage ('380931234567 ' , 'Test ' );
124
+
125
+ $ transport = self ::createTransport ($ client );
126
+
127
+ $ this ->expectException (TransportException::class);
128
+ $ this ->expectExceptionMessage ('Unable to send SMS with TurboSMS: Error code 406 with message "NOT_ALLOWED_RECIPIENT_COUNTRY". ' );
129
+
130
+ $ transport ->send ($ message );
131
+ }
132
+
133
+ public function testFailedSend (): void
97
134
{
98
135
$ response = $ this ->createMock (ResponseInterface::class);
99
136
$ response
@@ -123,7 +160,7 @@ public function testFailedSend()
123
160
$ transport ->send ($ message );
124
161
}
125
162
126
- public function testInvalidFrom ()
163
+ public function testInvalidFrom (): void
127
164
{
128
165
$ this ->expectException (LengthException::class);
129
166
$ this ->expectExceptionMessage ('The sender length of a TurboSMS message must not exceed 20 characters. ' );
@@ -134,7 +171,7 @@ public function testInvalidFrom()
134
171
$ transport ->send ($ message );
135
172
}
136
173
137
- public function testInvalidSubjectWithLatinSymbols ()
174
+ public function testInvalidSubjectWithLatinSymbols (): void
138
175
{
139
176
$ message = new SmsMessage ('380931234567 ' , str_repeat ('z ' , 1522 ));
140
177
$ transport = new TurboSmsTransport ('authToken ' , 'sender ' , $ this ->createMock (HttpClientInterface::class));
@@ -145,7 +182,7 @@ public function testInvalidSubjectWithLatinSymbols()
145
182
$ transport ->send ($ message );
146
183
}
147
184
148
- public function testInvalidSubjectWithCyrillicSymbols ()
185
+ public function testInvalidSubjectWithCyrillicSymbols (): void
149
186
{
150
187
$ message = new SmsMessage ('380931234567 ' , str_repeat ('z ' , 661 ).'Й ' );
151
188
$ transport = new TurboSmsTransport ('authToken ' , 'sender ' , $ this ->createMock (HttpClientInterface::class));
@@ -156,7 +193,7 @@ public function testInvalidSubjectWithCyrillicSymbols()
156
193
$ transport ->send ($ message );
157
194
}
158
195
159
- public function testSmsMessageWithInvalidFrom ()
196
+ public function testSmsMessageWithInvalidFrom (): void
160
197
{
161
198
$ transport = $ this ->createTransport ();
162
199
0 commit comments