Skip to content

Commit b9601ea

Browse files
authored
Merge pull request #158 from laravel-notification-channels/laravel-12
Laravel 12 Support
2 parents c5a78ce + 1476025 commit b9601ea

13 files changed

+93
-73
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ trim_trailing_whitespace = true
1313

1414
[*.md]
1515
trim_trailing_whitespace = false
16+
17+
[ci.yml]
18+
indent_size = 2

.github/workflows/ci.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: CI
22

3-
on: [push, pull_request]
3+
on:
4+
- push
5+
- pull_request
46

57
jobs:
68
phplint:
@@ -12,14 +14,14 @@ jobs:
1214
- name: Checkout
1315
uses: actions/checkout@v4
1416

15-
- name: "laravel-pint"
17+
- name: laravel-pint
1618
uses: aglipanci/laravel-pint-action@latest
1719
with:
1820
preset: laravel
1921
verboseMode: true
2022
testMode: true
21-
configPath: "pint.json"
22-
pintVersion: 1.18.2
23+
configPath: pint.json
24+
pintVersion: 1.21.0
2325
onlyDirty: true
2426

2527
test:
@@ -28,12 +30,14 @@ jobs:
2830
max-parallel: 15
2931
fail-fast: false
3032
matrix:
31-
php: [8.3, 8.2]
32-
laravel: [11.*]
33+
php: [8.4, 8.3, 8.2]
34+
laravel: ['11.*', '12.*']
3335
stability: [prefer-lowest, prefer-stable]
3436
include:
3537
- laravel: 11.*
3638
testbench: 9.*
39+
- laravel: 12.*
40+
testbench: 10.*
3741

3842
name: PHP${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }}
3943

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
All notable changes to `laravel-notification-channels/twilio` will be documented in this file.
44

5-
## 4.0.0
5+
## [4.1.0](https://github.com/laravel-notification-channels/twilio/releases/tag/4.1.0) (2025-03-03)
6+
7+
- Added Laravel 12 support #155 #157
8+
9+
## [4.0.0](https://github.com/laravel-notification-channels/twilio/releases/tag/4.0.0) (2024-11-26)
610

711
- Added PHP Linting (Pint) to CI workflow
812
- Additional tests to achieve 100% code coverage by @pascalbaljet

composer.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@
3737
"require": {
3838
"php": "^8.2",
3939
"twilio/sdk": "^7.16 || ^8.3",
40-
"illuminate/notifications": "^11.0",
41-
"illuminate/support": "^11.0",
42-
"illuminate/events": "^11.0",
43-
"illuminate/queue": "^11.0"
40+
"illuminate/notifications": "^11.0 || ^12.0",
41+
"illuminate/support": "^11.0 || ^12.0",
42+
"illuminate/events": "^11.0 || ^12.0",
43+
"illuminate/queue": "^11.0 || ^12.0"
4444
},
4545
"require-dev": {
46-
"laravel/pint": "^1.18",
46+
"laravel/pint": "^1.21",
4747
"mockery/mockery": "^1.0",
48-
"orchestra/testbench": "^9.0",
49-
"phpunit/phpunit": "^10.5"
48+
"orchestra/testbench": "^9.0 || ^10.0",
49+
"phpunit/phpunit": "^10.5 || ^11.5.10"
5050
},
5151
"autoload": {
5252
"psr-4": {

tests/Integration/TwilioProviderTest.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,20 @@
99
use NotificationChannels\Twilio\TwilioChannel;
1010
use NotificationChannels\Twilio\TwilioConfig;
1111
use NotificationChannels\Twilio\TwilioProvider;
12+
use PHPUnit\Framework\Attributes\Test;
1213
use Twilio\Rest\Client;
1314

1415
class TwilioProviderTest extends IntegrationTestCase
1516
{
16-
/** @test */
17+
#[Test]
1718
public function it_cannot_create_the_application_without_config()
1819
{
1920
$this->expectException(InvalidConfigException::class);
2021

2122
$this->app->get(TwilioChannel::class);
2223
}
2324

24-
/** @test */
25+
#[Test]
2526
public function it_cannot_create_the_application_without_sid()
2627
{
2728
$this->app['config']->set('twilio-notification-channel.username', 'test');
@@ -31,7 +32,7 @@ public function it_cannot_create_the_application_without_sid()
3132
$this->app->get(TwilioChannel::class);
3233
}
3334

34-
/** @test */
35+
#[Test]
3536
public function it_can_create_the_application_with_sid()
3637
{
3738
$this->app['config']->set('twilio-notification-channel.username', 'test');
@@ -41,7 +42,7 @@ public function it_can_create_the_application_with_sid()
4142
$this->assertInstanceOf(TwilioChannel::class, $this->app->get(TwilioChannel::class));
4243
}
4344

44-
/** @test */
45+
#[Test]
4546
public function it_can_create_the_application_with_token_auth()
4647
{
4748
$this->app['config']->set('twilio-notification-channel.auth_token', 'token');
@@ -50,7 +51,7 @@ public function it_can_create_the_application_with_token_auth()
5051
$this->assertInstanceOf(TwilioChannel::class, $this->app->get(TwilioChannel::class));
5152
}
5253

53-
/** @test */
54+
#[Test]
5455
public function it_provides_three_classes()
5556
{
5657
$provides = (new TwilioProvider($this->app))->provides();

tests/Unit/IntegrationTest.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use NotificationChannels\Twilio\TwilioChannel;
1414
use NotificationChannels\Twilio\TwilioConfig;
1515
use NotificationChannels\Twilio\TwilioSmsMessage;
16+
use PHPUnit\Framework\Attributes\Test;
1617
use Twilio\Rest\Api\V2010\Account\CallInstance;
1718
use Twilio\Rest\Api\V2010\Account\CallList;
1819
use Twilio\Rest\Api\V2010\Account\MessageInstance;
@@ -42,7 +43,7 @@ protected function setUp(): void
4243
$this->notification = Mockery::mock(Notification::class);
4344
}
4445

45-
/** @test */
46+
#[Test]
4647
public function it_can_send_a_sms_message()
4748
{
4849
$message = TwilioSmsMessage::create('Message text');
@@ -62,7 +63,7 @@ public function it_can_send_a_sms_message()
6263
$channel->send(new NotifiableWithAttribute, $this->notification);
6364
}
6465

65-
/** @test */
66+
#[Test]
6667
public function it_can_send_a_sms_message_using_service()
6768
{
6869
$message = TwilioSmsMessage::create('Message text');
@@ -84,7 +85,7 @@ public function it_can_send_a_sms_message_using_service()
8485
$channel->send(new NotifiableWithAttribute, $this->notification);
8586
}
8687

87-
/** @test */
88+
#[Test]
8889
public function it_can_send_a_sms_message_using_url_shortener()
8990
{
9091
$message = TwilioSmsMessage::create('Message text');
@@ -106,7 +107,7 @@ public function it_can_send_a_sms_message_using_url_shortener()
106107
$channel->send(new NotifiableWithAttribute, $this->notification);
107108
}
108109

109-
/** @test */
110+
#[Test]
110111
public function it_can_send_a_sms_message_using_alphanumeric_sender()
111112
{
112113
$message = TwilioSmsMessage::create('Message text');
@@ -127,7 +128,7 @@ public function it_can_send_a_sms_message_using_alphanumeric_sender()
127128
$channel->send(new NotifiableWithAlphanumericSender, $this->notification);
128129
}
129130

130-
/** @test */
131+
#[Test]
131132
public function it_can_make_a_call()
132133
{
133134
$message = TwilioCallMessage::create('http://example.com');
@@ -146,7 +147,7 @@ public function it_can_make_a_call()
146147
$channel->send(new NotifiableWithAttribute, $this->notification);
147148
}
148149

149-
/** @test */
150+
#[Test]
150151
public function it_cant_make_a_call_when_the_from_config_is_missing()
151152
{
152153
$message = TwilioCallMessage::create('http://example.com');

tests/Unit/TwilioCallMessageTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace NotificationChannels\Twilio\Tests\Unit;
44

55
use NotificationChannels\Twilio\TwilioCallMessage;
6+
use PHPUnit\Framework\Attributes\Test;
67

78
class TwilioCallMessageTest extends TwilioMessageTestCase
89
{
@@ -16,31 +17,31 @@ protected function setUp(): void
1617
$this->message = new TwilioCallMessage;
1718
}
1819

19-
/** @test */
20+
#[Test]
2021
public function it_can_accept_a_message_when_constructing_a_message()
2122
{
2223
$message = new TwilioCallMessage('http://example.com');
2324

2425
$this->assertEquals('http://example.com', $message->content);
2526
}
2627

27-
/** @test */
28+
#[Test]
2829
public function it_provides_a_create_method()
2930
{
3031
$message = TwilioCallMessage::create('http://example.com');
3132

3233
$this->assertEquals('http://example.com', $message->content);
3334
}
3435

35-
/** @test */
36+
#[Test]
3637
public function it_can_set_the_url()
3738
{
3839
$this->message->url('http://example.com');
3940

4041
$this->assertEquals('http://example.com', $this->message->content);
4142
}
4243

43-
/** @test */
44+
#[Test]
4445
public function it_can_set_optional_parameters()
4546
{
4647
$message = TwilioCallMessage::create('myMessage');

tests/Unit/TwilioChannelTest.php

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use NotificationChannels\Twilio\TwilioChannel;
1414
use NotificationChannels\Twilio\TwilioConfig;
1515
use NotificationChannels\Twilio\TwilioSmsMessage;
16+
use PHPUnit\Framework\Attributes\Test;
1617
use Twilio\Exceptions\RestException;
1718

1819
class TwilioChannelTest extends MockeryTestCase
@@ -37,7 +38,7 @@ protected function setUp(): void
3738
$this->channel = new TwilioChannel($this->twilio, $this->dispatcher);
3839
}
3940

40-
/** @test */
41+
#[Test]
4142
public function it_will_not_send_a_message_if_not_enabled()
4243
{
4344
$notifiable = new Notifiable;
@@ -54,7 +55,7 @@ public function it_will_not_send_a_message_if_not_enabled()
5455
$this->assertNull($result);
5556
}
5657

57-
/** @test */
58+
#[Test]
5859
public function it_will_not_send_a_message_without_known_receiver()
5960
{
6061
$notifiable = new Notifiable;
@@ -75,7 +76,7 @@ public function it_will_not_send_a_message_without_known_receiver()
7576
$this->assertNull($result);
7677
}
7778

78-
/** @test */
79+
#[Test]
7980
public function it_will_send_a_sms_message_to_the_result_of_the_route_method_of_the_notifiable()
8081
{
8182
$notifiable = new NotifiableWithMethod;
@@ -91,7 +92,7 @@ public function it_will_send_a_sms_message_to_the_result_of_the_route_method_of_
9192
$this->channel->send($notifiable, $notification);
9293
}
9394

94-
/** @test */
95+
#[Test]
9596
public function it_will_send_a_sms_message_to_the_result_of_the_route_method_of_the_notifiable_if_it_uses_the_twilio_channel_explicitly()
9697
{
9798
$notifiable = new NotifiableWithTwilioChannel;
@@ -107,7 +108,7 @@ public function it_will_send_a_sms_message_to_the_result_of_the_route_method_of_
107108
$this->channel->send($notifiable, $notification);
108109
}
109110

110-
/** @test */
111+
#[Test]
111112
public function it_will_make_a_call_to_the_phone_number_attribute_of_the_notifiable()
112113
{
113114
$notifiable = new NotifiableWithAttribute;
@@ -123,7 +124,7 @@ public function it_will_make_a_call_to_the_phone_number_attribute_of_the_notifia
123124
$this->channel->send($notifiable, $notification);
124125
}
125126

126-
/** @test */
127+
#[Test]
127128
public function it_will_convert_a_string_to_a_sms_message()
128129
{
129130
$notifiable = new NotifiableWithAttribute;
@@ -138,7 +139,7 @@ public function it_will_convert_a_string_to_a_sms_message()
138139
$this->channel->send($notifiable, $notification);
139140
}
140141

141-
/** @test */
142+
#[Test]
142143
public function it_will_fire_an_event_in_case_of_an_invalid_message()
143144
{
144145
$notifiable = new NotifiableWithAttribute;
@@ -160,7 +161,7 @@ public function it_will_fire_an_event_in_case_of_an_invalid_message()
160161
$this->channel->send($notifiable, $notification);
161162
}
162163

163-
/** @test */
164+
#[Test]
164165
public function it_will_ignore_specific_error_codes()
165166
{
166167
$notifiable = new NotifiableWithAttribute;
@@ -184,7 +185,7 @@ public function it_will_ignore_specific_error_codes()
184185
$this->channel->send($notifiable, $notification);
185186
}
186187

187-
/** @test */
188+
#[Test]
188189
public function it_will_rethrow_non_ignored_error_codes()
189190
{
190191
$notifiable = new NotifiableWithAttribute;
@@ -210,7 +211,7 @@ public function it_will_rethrow_non_ignored_error_codes()
210211
$this->channel->send($notifiable, $notification);
211212
}
212213

213-
/** @test */
214+
#[Test]
214215
public function it_will_ignore_all_error_codes()
215216
{
216217
$notifiable = new NotifiableWithAttribute;
@@ -232,7 +233,7 @@ public function it_will_ignore_all_error_codes()
232233
$this->channel->send($notifiable, $notification);
233234
}
234235

235-
/** @test */
236+
#[Test]
236237
public function it_will_send_using_alphanumeric_if_notifiable_can_receive()
237238
{
238239
$notifiable = new NotifiableWithAlphanumericSender;

0 commit comments

Comments
 (0)