Skip to content
This repository was archived by the owner on Jun 28, 2024. It is now read-only.

Commit 2c39f3b

Browse files
committed
Merge branch 'vigneshgurusamy-fix/invalid-exception'
2 parents 513d8a9 + 90d78a5 commit 2c39f3b

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/Message/OptionsBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,12 @@ public function setDelayWhileIdle($delayWhileIdle)
160160
*
161161
* @return \LaravelFCM\Message\OptionsBuilder
162162
*
163-
* @throws InvalidOptionException
163+
* @throws InvalidOptionsException
164164
*/
165165
public function setTimeToLive($timeToLive)
166166
{
167167
if ($timeToLive < 0 || $timeToLive > 2419200) {
168-
throw new InvalidOptionException("time to live must be between 0 and 2419200, current value is: {$timeToLive}");
168+
throw new InvalidOptionsException("time to live must be between 0 and 2419200, current value is: {$timeToLive}");
169169
}
170170
$this->timeToLive = $timeToLive;
171171

tests/MessageTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22

3+
use LaravelFCM\Message\Exceptions\InvalidOptionsException;
34
use LaravelFCM\Message\OptionsBuilder;
45
use LaravelFCM\Message\OptionsPriorities;
56
use LaravelFCM\Message\PayloadDataBuilder;
@@ -127,4 +128,16 @@ public function it_construct_a_valid_json_with_notification()
127128
$json = json_encode($notificationBuilder->build()->toArray());
128129
$this->assertJsonStringEqualsJsonString($targetFull, $json);
129130
}
131+
132+
/**
133+
* @test
134+
*/
135+
public function it_throws_an_invalidoptionsexception_if_the_interval_is_too_big()
136+
{
137+
$this->setExpectedException(InvalidOptionsException::class);
138+
139+
$optionBuilder = new OptionsBuilder();
140+
$optionBuilder->setTimeToLive(2419200 * 10);
141+
142+
}
130143
}

0 commit comments

Comments
 (0)