diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c2402db..46f79e2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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') }} diff --git a/src/RequestModels/Message.php b/src/RequestModels/Message.php index 6bc26b6..509d206 100644 --- a/src/RequestModels/Message.php +++ b/src/RequestModels/Message.php @@ -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 @@ -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 [ @@ -123,6 +131,7 @@ public function toArray(): array 'respectBlacklist' => $this->respectBlacklist, 'statusCallbackUrl' => $this->statusCallbackUrl, 'encoding' => $this->encoding, + 'msisdnCooldownInMinutes' => $this->msisdnCooldownInMinutes, ]; } @@ -180,4 +189,9 @@ public function getCountryHint(): ?string { return $this->countryHint; } + + public function getMsisdnCooldownInMinutes(): ?int + { + return $this->msisdnCooldownInMinutes; + } } diff --git a/tests/Unit/Endpoints/MessagesApiTest.php b/tests/Unit/Endpoints/MessagesApiTest.php index 1f3a28a..ba0be51 100644 --- a/tests/Unit/Endpoints/MessagesApiTest.php +++ b/tests/Unit/Endpoints/MessagesApiTest.php @@ -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; diff --git a/tests/Unit/RequestModels/MessageTest.php b/tests/Unit/RequestModels/MessageTest.php index d023774..b99a6aa 100644 --- a/tests/Unit/RequestModels/MessageTest.php +++ b/tests/Unit/RequestModels/MessageTest.php @@ -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()); @@ -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() @@ -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', @@ -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()); } }