Skip to content

Commit

Permalink
Re-Styling in accordance with fabbot
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedghanem00 committed Aug 12, 2023
1 parent 9b0d5a3 commit 8075d08
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
11 changes: 5 additions & 6 deletions src/Symfony/Component/Notifier/Bridge/GoIP/GoIPTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,13 @@
final class GoIPTransport extends AbstractTransport
{
public function __construct(
private readonly string $username,
private readonly string $username,
#[\SensitiveParameter]
private readonly string $password,
private readonly int $simSlot,
HttpClientInterface $client = null,
private readonly string $password,
private readonly int $simSlot,
HttpClientInterface $client = null,
EventDispatcherInterface $dispatcher = null
)
{
) {
parent::__construct($client, $dispatcher);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,47 +57,48 @@ public static function unsupportedMessagesProvider(): iterable
/**
* @throws TransportExceptionInterface
*/
public function testSendMessage(): void
public function testSendMessage()
{
$successReply = "Sending,L5 Send SMS to:0123; ID:" . ($messageId = "dj282jjs8");
$successReply = 'Sending,L5 Send SMS to:0123; ID:'.($messageId = 'dj282jjs8');

$mockClient = new MockHttpClient(new MockResponse($successReply));
$sentMessage = self::createTransport($mockClient)->send(new SmsMessage("0123", "Test"));
$sentMessage = self::createTransport($mockClient)->send(new SmsMessage('0123', 'Test'));

$this->assertSame($messageId, $sentMessage->getMessageId());
}

/**
* @dataProvider goipErrorsProvider
*
* @throws TransportExceptionInterface
*/
public function testSendMessageWithUnsuccessfulReplyFromGoipThrows(string $goipError): void
public function testSendMessageWithUnsuccessfulReplyFromGoipThrows(string $goipError)
{
$this->expectException(TransportException::class);
$this->expectExceptionMessage(sprintf('Could not send the message through GoIP. Response: "%s".', $goipError));

$mockClient = new MockHttpClient(new MockResponse($goipError));

self::createTransport($mockClient)->send(new SmsMessage("1", "Test"));
self::createTransport($mockClient)->send(new SmsMessage('1', 'Test'));
}

public function goipErrorsProvider(): iterable
{
yield ["ERROR,L10 GSM logout"];
yield ['ERROR,L10 GSM logout'];
}

/**
* @throws TransportExceptionInterface
*/
public function testSendMessageWithSuccessfulReplyButNoMessageIdThrows(): void
public function testSendMessageWithSuccessfulReplyButNoMessageIdThrows()
{
$misFormedReply = "Sending,L5 Send SMS to:0123";
$misFormedReply = 'Sending,L5 Send SMS to:0123';

$this->expectException(TransportException::class);
$this->expectExceptionMessage(sprintf('Could not extract the message id from the GoIP response: "%s".', $misFormedReply));

$mockClient = new MockHttpClient(new MockResponse($misFormedReply));

self::createTransport($mockClient)->send(new SmsMessage("0123", "Test"));
self::createTransport($mockClient)->send(new SmsMessage('0123', 'Test'));
}
}

0 comments on commit 8075d08

Please sign in to comment.