Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9b70446

Browse filesBrowse files
committed
added error message to provider
1 parent eb62056 commit 9b70446
Copy full SHA for 9b70446

File tree

1 file changed

+7
-7
lines changed
Filter options

1 file changed

+7
-7
lines changed

‎src/Symfony/Component/Notifier/Bridge/Smsapi/Tests/SmsapiTransportTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/Smsapi/Tests/SmsapiTransportTest.php
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,28 +69,28 @@ public function createClient(int $statusCode, array $content): HttpClientInterfa
6969
public function responseProvider(): iterable
7070
{
7171
$responses = [
72-
['status' => 200, 'content' => '{"error":101,"message":"Authorization failed"}'],
73-
['status' => 500, 'content' => '{}'],
74-
['status' => 500, 'content' => '{"error":null,"message":"Unknown"}'],
75-
['status' => 500, 'content' => '{"error":null,"message":null}'],
72+
['status' => 200, 'content' => '{"error":101,"message":"Authorization failed"}', 'errorMessage' => 'Unable to send the SMS: "Authorization failed".'],
73+
['status' => 500, 'content' => '{}', 'errorMessage' => 'Unable to send the SMS: "unknown error".'],
74+
['status' => 500, 'content' => '{"error":null,"message":"Unknown"}', 'errorMessage' => 'Unable to send the SMS: "Unknown".'],
75+
['status' => 500, 'content' => '{"error":null,"message":null}', 'errorMessage' => 'Unable to send the SMS: "unknown error".'],
7676
];
7777

7878
foreach ($responses as $response) {
79-
yield [$response['status'], json_decode($response['content'], true)];
79+
yield [$response['status'], json_decode($response['content'], true), $response['errorMessage']];
8080
}
8181
}
8282

8383
/**
8484
* @dataProvider responseProvider
8585
*/
86-
public function testThrowExceptionWhenMessageWasNotSent(int $statusCode, array $content)
86+
public function testThrowExceptionWhenMessageWasNotSent(int $statusCode, array $content, string $errorMessage)
8787
{
8888
$client = $this->createClient($statusCode, $content);
8989
$transport = $this->createTransport($client);
9090
$message = new SmsMessage('0611223344', 'Hello!');
9191

9292
$this->expectException(TransportException::class);
93-
$this->expectExceptionMessage(sprintf('Unable to send the SMS: "%s".', $content['message'] ?? 'unknown error'));
93+
$this->expectExceptionMessage($errorMessage);
9494

9595
$transport->send($message);
9696
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.