Skip to content

Commit 6f6e647

Browse files
committed
fix(sweego): Fix channel parameter value to fixed value for Mailer and Notifier Transports
1 parent 67f512b commit 6f6e647

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Tests/SweegoTransportTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Notifier\Bridge\Sweego\Tests;
1313

1414
use Symfony\Component\HttpClient\MockHttpClient;
15+
use Symfony\Component\HttpClient\Response\JsonMockResponse;
1516
use Symfony\Component\Notifier\Bridge\Sweego\SweegoTransport;
1617
use Symfony\Component\Notifier\Exception\UnsupportedMessageTypeException;
1718
use Symfony\Component\Notifier\Message\ChatMessage;
@@ -68,4 +69,22 @@ public function testSendWithInvalidMessageType()
6869
$message = $this->createMock(MessageInterface::class);
6970
$transport->send($message);
7071
}
72+
73+
public function testSendSmsMessage()
74+
{
75+
$client = new MockHttpClient(function ($method, $url, $options) {
76+
$this->assertSame('POST', $method);
77+
$this->assertSame('https://api.sweego.io/send', $url);
78+
79+
$body = json_decode($options['body'], true);
80+
$this->assertSame('sms', $body['channel']);
81+
82+
return new JsonMockResponse(['swg_uids' => ['123']]);
83+
});
84+
85+
$transport = self::createTransport($client);
86+
$sentMessage = $transport->send(new SmsMessage('0611223344', 'Hello!'));
87+
88+
$this->assertSame('123', $sentMessage->getMessageId());
89+
}
7190
}

0 commit comments

Comments
 (0)