Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ jobs:

strategy:
matrix:
php-versions: ['7.4', '8.0', '8.1', '8.2']
php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3']

steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- uses: actions/checkout@v4

- name: Cache composer dependencies
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: vendor
key: composer-${{ hashFiles('composer.lock') }}
Expand Down
14 changes: 14 additions & 0 deletions src/RequestModels/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class Message
protected string $encoding = self::ENCODING_GSM7;
protected ?string $messageId = null;
protected ?string $countryHint = null;
protected ?int $msisdnCooldownInMinutes = null;

/**
* @var mixed
Expand Down Expand Up @@ -107,6 +108,13 @@ public function setCountryHint(string $countryHint): self
return $this;
}

public function setMsisdnCooldownInMinutes(?int $msisdnCooldownInMinutes): self
{
$this->msisdnCooldownInMinutes = $msisdnCooldownInMinutes;

return $this;
}

public function toArray(): array
{
return [
Expand All @@ -123,6 +131,7 @@ public function toArray(): array
'respectBlacklist' => $this->respectBlacklist,
'statusCallbackUrl' => $this->statusCallbackUrl,
'encoding' => $this->encoding,
'msisdnCooldownInMinutes' => $this->msisdnCooldownInMinutes,
];
}

Expand Down Expand Up @@ -180,4 +189,9 @@ public function getCountryHint(): ?string
{
return $this->countryHint;
}

public function getMsisdnCooldownInMinutes(): ?int
{
return $this->msisdnCooldownInMinutes;
}
}
1 change: 1 addition & 0 deletions tests/Unit/Endpoints/MessagesApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ public function test_sends_a_single_message_with_all_possible_fields()
'respectBlacklist' => false,
'statusCallbackUrl' => 'https://example.com/inmobile/callback',
'encoding' => Message::ENCODING_UCS2,
'msisdnCooldownInMinutes' => null,
], $payload['messages'][0]);

return true;
Expand Down
8 changes: 6 additions & 2 deletions tests/Unit/RequestModels/MessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ public function test_create_a_message()
->flash()
->ignoreBlacklist()
->setEncoding(Message::ENCODING_GSM7)
->setStatusCallbackUrl('https://example.com/callback');
->setStatusCallbackUrl('https://example.com/callback')
->setMsisdnCooldownInMinutes(60);

$this->assertEquals('Hello World', $message->getText());
$this->assertEquals(4512345678, $message->getRecipient());
Expand All @@ -34,6 +35,7 @@ public function test_create_a_message()
$this->assertFalse($message->getRespectBlacklist());
$this->assertEquals(Message::ENCODING_GSM7, $message->getEncoding());
$this->assertEquals('https://example.com/callback', $message->getStatusCallbackUrl());
$this->assertEquals(60, $message->getMsisdnCooldownInMinutes());
}

public function test_convert_to_array()
Expand All @@ -49,7 +51,8 @@ public function test_convert_to_array()
->flash()
->ignoreBlacklist()
->setEncoding(Message::ENCODING_GSM7)
->setStatusCallbackUrl('https://example.com/callback');
->setStatusCallbackUrl('https://example.com/callback')
->setMsisdnCooldownInMinutes(60);

$this->assertEquals([
'to' => '4512345678',
Expand All @@ -63,6 +66,7 @@ public function test_convert_to_array()
'respectBlacklist' => false,
'statusCallbackUrl' => 'https://example.com/callback',
'encoding' => Message::ENCODING_GSM7,
'msisdnCooldownInMinutes' => 60,
], $message->toArray());
}
}