@@ -46,7 +46,7 @@ public static function unsupportedMessagesProvider(): iterable
4646 yield [new DummyMessage ()];
4747 }
4848
49- public function testSuccessfulSend ()
49+ public function testSuccessfulSend (): void
5050 {
5151 $ response = $ this ->createMock (ResponseInterface::class);
5252 $ response
@@ -93,7 +93,44 @@ public function testSuccessfulSend()
9393 self ::assertSame ('f83f8868-5e46-c6cf-e4fb-615e5a293754 ' , $ sentMessage ->getMessageId ());
9494 }
9595
96- public function testFailedSend ()
96+ public function testFailedSendWithPartialAccepted (): void
97+ {
98+ $ 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
97134 {
98135 $ response = $ this ->createMock (ResponseInterface::class);
99136 $ response
@@ -123,7 +160,7 @@ public function testFailedSend()
123160 $ transport ->send ($ message );
124161 }
125162
126- public function testInvalidFrom ()
163+ public function testInvalidFrom (): void
127164 {
128165 $ this ->expectException (LengthException::class);
129166 $ this ->expectExceptionMessage ('The sender length of a TurboSMS message must not exceed 20 characters. ' );
@@ -134,7 +171,7 @@ public function testInvalidFrom()
134171 $ transport ->send ($ message );
135172 }
136173
137- public function testInvalidSubjectWithLatinSymbols ()
174+ public function testInvalidSubjectWithLatinSymbols (): void
138175 {
139176 $ message = new SmsMessage ('380931234567 ' , str_repeat ('z ' , 1522 ));
140177 $ transport = new TurboSmsTransport ('authToken ' , 'sender ' , $ this ->createMock (HttpClientInterface::class));
@@ -145,7 +182,7 @@ public function testInvalidSubjectWithLatinSymbols()
145182 $ transport ->send ($ message );
146183 }
147184
148- public function testInvalidSubjectWithCyrillicSymbols ()
185+ public function testInvalidSubjectWithCyrillicSymbols (): void
149186 {
150187 $ message = new SmsMessage ('380931234567 ' , str_repeat ('z ' , 661 ).'Й ' );
151188 $ transport = new TurboSmsTransport ('authToken ' , 'sender ' , $ this ->createMock (HttpClientInterface::class));
@@ -156,7 +193,7 @@ public function testInvalidSubjectWithCyrillicSymbols()
156193 $ transport ->send ($ message );
157194 }
158195
159- public function testSmsMessageWithInvalidFrom ()
196+ public function testSmsMessageWithInvalidFrom (): void
160197 {
161198 $ transport = $ this ->createTransport ();
162199
0 commit comments