Skip to content

Commit b700ac4

Browse files
authored
Laravel 13 compatible (#73)
* Laravel 13 compatible * fix test dep * phpstan fixes * readme changes
1 parent 0f9fa8d commit b700ac4

15 files changed

Lines changed: 88 additions & 123 deletions

.github/workflows/run-tests.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ jobs:
1414
fail-fast: false
1515
matrix:
1616
os: [ubuntu-latest]
17-
php: [8.4, 8.3, 8.2]
18-
laravel: ['12.*', '11.*', '10.*']
17+
php: [8.5, 8.4, 8.3]
18+
laravel: ['13.*', '12.*', '11.*']
1919
stability: [prefer-lowest, prefer-stable]
2020
include:
21-
- laravel: 10.*
22-
testbench: 8.*
2321
- laravel: 11.*
24-
testbench: 9.*
22+
testbench: 9.17.0
2523
- laravel: 12.*
2624
testbench: 10.*
25+
- laravel: 13.*
26+
testbench: 11.*
2727

2828
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
2929

@@ -49,4 +49,4 @@ jobs:
4949
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
5050
5151
- name: Execute tests
52-
run: vendor/bin/phpunit
52+
run: vendor/bin/phpunit --no-coverage

.phpunit.cache/test-results

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"version":2,"defects":{"YlsIdeas\\SubscribableNotifications\\Tests\\SubscribeApplicationServiceProviderTest::test_it_can_be_configured_to_loads_routes":5},"times":{"YlsIdeas\\SubscribableNotifications\\Tests\\Channels\\SubscriberMailChannelTest::test_it_sends_mail_notifications_with_unsubscribe_links_for_mailing_lists":0.107,"YlsIdeas\\SubscribableNotifications\\Tests\\Channels\\SubscriberMailChannelTest::test_it_sends_mail_notifications_with_mailing_links_via_queues":0.008,"YlsIdeas\\SubscribableNotifications\\Tests\\Channels\\SubscriberMailChannelTest::test_it_sends_mail_notifications_with_an_unsubscribe_link_for_all_emails":0.003,"YlsIdeas\\SubscribableNotifications\\Tests\\Channels\\SubscriberMailChannelTest::test_it_sends_mail_notifications_normally_otherwise":0.003,"YlsIdeas\\SubscribableNotifications\\Tests\\Channels\\SubscriberMailChannelTest::test_it_handles_mailables_as_per_inherited_behavior":0.002,"YlsIdeas\\SubscribableNotifications\\Tests\\Channels\\SubscriberMailChannelTest::test_it_checks_if_a_notifiable_is_subscribed_to_receive_the_notification":0,"YlsIdeas\\SubscribableNotifications\\Tests\\Channels\\SubscriberMailChannelTest::test_it_does_not_send_mail_if_there_is_no_email_to_route_to":0,"YlsIdeas\\SubscribableNotifications\\Tests\\Channels\\SubscriberMailChannelTest::test_it_uses_views_set_on_the_mail_message_from_the_notification":0,"YlsIdeas\\SubscribableNotifications\\Tests\\Controllers\\UnsubscribeControllerTest::test_it_unsubscribes_users_from_all_mailing_lists":0.025,"YlsIdeas\\SubscribableNotifications\\Tests\\Controllers\\UnsubscribeControllerTest::test_it_unsubscribes_users_from_a_mailing_list":0.003,"YlsIdeas\\SubscribableNotifications\\Tests\\Controllers\\UnsubscribeControllerTest::test_it_uses_the_subscriber_to_redirect_the_user_after_completion":0.002,"YlsIdeas\\SubscribableNotifications\\Tests\\Controllers\\UnsubscribeControllerTest::test_it_aborts_if_the_target_model_does_not_exist":0.004,"YlsIdeas\\SubscribableNotifications\\Tests\\Controllers\\UnsubscribeControllerTest::test_it_fires_events_for_unsubscribing":0.003,"YlsIdeas\\SubscribableNotifications\\Tests\\Events\\UserUnsubscribedTest::test_it_can_be_initialised_with_parameters":0,"YlsIdeas\\SubscribableNotifications\\Tests\\Events\\UserUnsubscribingTest::test_it_can_be_initialised_with_parameters":0,"YlsIdeas\\SubscribableNotifications\\Tests\\MailSubscriberTest::test_it_generates_a_signed_url_for_users_to_unsubscribe":0.002,"YlsIdeas\\SubscribableNotifications\\Tests\\MailSubscriberTest::test_it_generates_a_signed_url_for_users_to_unsubscribe_from_a_mailing_list":0.002,"YlsIdeas\\SubscribableNotifications\\Tests\\MailSubscriberTest::test_it_can_check_its_subscription_status_for_all_mailing_lists":0.006,"YlsIdeas\\SubscribableNotifications\\Tests\\MailSubscriberTest::test_it_can_check_its_subscription_status_for_one_mailing_list":0.002,"YlsIdeas\\SubscribableNotifications\\Tests\\SubscribableServiceProviderTest::test_it_can_publish_views":0.008,"YlsIdeas\\SubscribableNotifications\\Tests\\SubscribableServiceProviderTest::test_it_loads_views":0,"YlsIdeas\\SubscribableNotifications\\Tests\\SubscribableServiceProviderTest::test_it_can_publish_an_application_service_provider":0.001,"YlsIdeas\\SubscribableNotifications\\Tests\\SubscribeApplicationServiceProviderTest::test_it_can_be_configured_to_loads_routes":0,"YlsIdeas\\SubscribableNotifications\\Tests\\SubscribeApplicationServiceProviderTest::test_it_can_be_configured_to_not_loads_routes":0.001,"YlsIdeas\\SubscribableNotifications\\Tests\\SubscriberTest::test_it_handles_unsubscribing_from_all_mailing_lists_via_closure":0,"YlsIdeas\\SubscribableNotifications\\Tests\\SubscriberTest::test_it_handles_unsubscribing_from_all_mailing_lists_via_string":0.001,"YlsIdeas\\SubscribableNotifications\\Tests\\SubscriberTest::test_it_handles_unsubscribing_from_a_mailing_list_via_closure":0,"YlsIdeas\\SubscribableNotifications\\Tests\\SubscriberTest::test_it_handles_unsubscribing_from_a_mailing_list_via_string":0,"YlsIdeas\\SubscribableNotifications\\Tests\\SubscriberTest::test_it_handles_generating_a_response_for_unsubscribing_via_closure":0,"YlsIdeas\\SubscribableNotifications\\Tests\\SubscriberTest::test_it_handles_generating_a_response_for_unsubscribing_via_string":0,"YlsIdeas\\SubscribableNotifications\\Tests\\SubscriberTest::test_it_handles_checking_subscription_status_of_a_mailing_list_via_closure":0,"YlsIdeas\\SubscribableNotifications\\Tests\\SubscriberTest::test_it_handles_checking_subscription_status_of_a_mailing_list_via_string":0,"YlsIdeas\\SubscribableNotifications\\Tests\\SubscriberTest::test_it_handles_checking_subscription_status_of_all_mailing_lists_via_closure":0,"YlsIdeas\\SubscribableNotifications\\Tests\\SubscriberTest::test_it_handles_checking_subscription_status_of_all_mailing_lists_via_string":0,"YlsIdeas\\SubscribableNotifications\\Tests\\SubscriberTest::test_it_can_provide_a_user_model":0,"YlsIdeas\\SubscribableNotifications\\Tests\\SubscriberTest::test_it_can_configure_a_user_model":0,"YlsIdeas\\SubscribableNotifications\\Tests\\SubscriberTest::test_it_can_configure_a_route_for_the_unsubscribe_controller":0}}

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# Subscribable Notifications for Laravel
22

33
[![Latest Version on Packagist](https://img.shields.io/packagist/v/ylsideas/subscribable-notifications.svg?style=flat-square)](https://packagist.org/packages/ylsideas/subscribable-notifications)
4-
[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/ylsideas/subscribable-notifications/run-tests?label=tests)](https://github.com/ylsideas/subscribable-notifications/actions?query=workflow%3Arun-tests+branch%3Amain)
5-
[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/ylsideas/subscribable-notifications/Check%20&%20fix%20styling?label=code%20style)](https://github.com/ylsideas/subscribable-notifications/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain)
4+
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/ylsideas/subscribable-notifications/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/ylsideas/subscribable-notifications/actions/workflows/run-tests.yml)
5+
[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/ylsideas/subscribable-notifications/php-cs-fixer.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/ylsideas/subscribable-notifications/actions/workflows/php-cs-fixer.yml)
66
[![Total Downloads](https://img.shields.io/packagist/dt/ylsideas/subscribable-notifications.svg?style=flat-square)](https://packagist.org/packages/ylsideas/subscribable-notifications)
7+
[![Laravel Compatibility](https://badge.laravel.cloud/badge/ylsideas/subscribable-notifications?style=flat)](https://packagist.org/packages/ylsideas/subscribable-notifications)
78

89
This package has been designed to help you handle email unsubscribes with as little as 5 minutes setup. After installing
910
your notifications sent over email should now be delivered with unsubscribe links in the footer and as a mail header

composer.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717
}
1818
],
1919
"require": {
20-
"php": "^8.2",
21-
"illuminate/contracts": "12.*|11.*|10.*"
20+
"php": "^8.3",
21+
"illuminate/contracts": "13.*|12.*|11.*"
2222
},
2323
"require-dev": {
24-
"orchestra/testbench": "^8.0|^9.0|^10.0",
25-
"nunomaduro/collision": "^8.0|^7.8|^6.0",
24+
"orchestra/testbench": "^9.17.0|^10.0|^11.0",
25+
"nunomaduro/collision": "^8.0",
2626
"larastan/larastan": "^2.0|^3.0",
27-
"pestphp/pest": "^2.34|^3.0",
28-
"pestphp/pest-plugin-laravel": "^2.3|^3.0",
27+
"pestphp/pest": "^2.34|^3.0|^4.0",
28+
"pestphp/pest-plugin-laravel": "^2.3|^3.0|^4.0",
2929
"phpstan/extension-installer": "^1.1",
3030
"phpstan/phpstan-deprecation-rules": "^1.0|^2.0",
3131
"phpstan/phpstan-phpunit": "^1.0|^2.0",
@@ -43,8 +43,8 @@
4343
},
4444
"scripts": {
4545
"analyse": "vendor/bin/phpstan analyse",
46-
"test": "vendor/bin/pest",
47-
"test-coverage": "vendor/bin/pest coverage"
46+
"test": "vendor/bin/pest --no-coverage",
47+
"test-coverage": "vendor/bin/pest"
4848
},
4949
"config": {
5050
"sort-packages": true,

phpstan-baseline.neon

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: '#^Trait YlsIdeas\\SubscribableNotifications\\MailSubscriber is used zero times and is not analysed\.$#'
5+
identifier: trait.unused
6+
count: 1
7+
path: src/MailSubscriber.php

phpstan.neon.dist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@ parameters:
88
tmpDir: build/phpstan
99
checkOctaneCompatibility: true
1010
checkModelProperties: true
11-
checkMissingIterableValueType: false
1211

phpunit.xml.dist

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,28 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit bootstrap="vendor/autoload.php"
3-
backupGlobals="false"
4-
backupStaticAttributes="false"
5-
colors="true"
6-
verbose="true"
7-
convertErrorsToExceptions="true"
8-
convertNoticesToExceptions="true"
9-
convertWarningsToExceptions="true"
10-
processIsolation="false"
11-
stopOnFailure="false">
12-
<testsuites>
13-
<testsuite name="Test Suite">
14-
<directory>tests</directory>
15-
</testsuite>
16-
</testsuites>
17-
<filter>
18-
<whitelist>
19-
<directory suffix=".php">src/</directory>
20-
</whitelist>
21-
</filter>
22-
<logging>
23-
<log type="tap" target="build/report.tap"/>
24-
<log type="junit" target="build/report.junit.xml"/>
25-
<log type="coverage-html" target="build/coverage"/>
26-
<log type="coverage-text" target="build/coverage.txt"/>
27-
<log type="coverage-clover" target="build/logs/clover.xml"/>
28-
</logging>
29-
<php>
30-
<env name="MAIL_DRIVER" value="array" />
31-
<env name="MAIL_MAILER" value="array" />
32-
<env name="DB_CONNECTION" value="testing" />
33-
</php>
2+
<phpunit bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
3+
<coverage>
4+
<report>
5+
<clover outputFile="build/logs/clover.xml"/>
6+
<html outputDirectory="build/coverage"/>
7+
<text outputFile="build/coverage.txt"/>
8+
</report>
9+
</coverage>
10+
<testsuites>
11+
<testsuite name="Test Suite">
12+
<directory>tests</directory>
13+
</testsuite>
14+
</testsuites>
15+
<logging>
16+
<junit outputFile="build/report.junit.xml"/>
17+
</logging>
18+
<php>
19+
<env name="MAIL_DRIVER" value="array"/>
20+
<env name="MAIL_MAILER" value="array"/>
21+
<env name="DB_CONNECTION" value="testing"/>
22+
</php>
23+
<source>
24+
<include>
25+
<directory suffix=".php">src/</directory>
26+
</include>
27+
</source>
3428
</phpunit>

tests/Channels/SubscriberMailChannelTest.php

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ protected function getPackageProviders($app)
2424
];
2525
}
2626

27-
/** @test */
28-
public function it_sends_mail_notifications_with_unsubscribe_links_for_mailing_lists()
27+
public function test_it_sends_mail_notifications_with_unsubscribe_links_for_mailing_lists()
2928
{
3029
Event::fake([
3130
MessageSending::class,
@@ -84,8 +83,7 @@ public function it_sends_mail_notifications_with_unsubscribe_links_for_mailing_l
8483
});
8584
}
8685

87-
/** @test */
88-
public function it_sends_mail_notifications_with_mailing_links_via_queues()
86+
public function test_it_sends_mail_notifications_with_mailing_links_via_queues()
8987
{
9088
Event::fake([
9189
MessageSending::class,
@@ -130,8 +128,7 @@ public function it_sends_mail_notifications_with_mailing_links_via_queues()
130128
});
131129
}
132130

133-
/** @test */
134-
public function it_sends_mail_notifications_with_an_unsubscribe_link_for_all_emails()
131+
public function test_it_sends_mail_notifications_with_an_unsubscribe_link_for_all_emails()
135132
{
136133
Event::fake([
137134
MessageSending::class,
@@ -175,8 +172,7 @@ public function it_sends_mail_notifications_with_an_unsubscribe_link_for_all_ema
175172
});
176173
}
177174

178-
/** @test */
179-
public function it_sends_mail_notifications_normally_otherwise()
175+
public function test_it_sends_mail_notifications_normally_otherwise()
180176
{
181177
Event::fake([
182178
MessageSending::class,
@@ -211,8 +207,7 @@ public function it_sends_mail_notifications_normally_otherwise()
211207
});
212208
}
213209

214-
/** @test */
215-
public function it_handles_mailables_as_per_inherited_behavior()
210+
public function test_it_handles_mailables_as_per_inherited_behavior()
216211
{
217212
View::addNamespace('testing', __DIR__.'/../views');
218213

@@ -239,8 +234,7 @@ public function it_handles_mailables_as_per_inherited_behavior()
239234
});
240235
}
241236

242-
/** @test */
243-
public function it_checks_if_a_notifiable_is_subscribed_to_receive_the_notification()
237+
public function test_it_checks_if_a_notifiable_is_subscribed_to_receive_the_notification()
244238
{
245239
Event::fake([
246240
MessageSending::class,
@@ -258,8 +252,7 @@ public function it_checks_if_a_notifiable_is_subscribed_to_receive_the_notificat
258252
Event::assertNotDispatched(MessageSending::class);
259253
}
260254

261-
/** @test */
262-
public function it_does_not_send_mail_if_there_is_no_email_to_route_to()
255+
public function test_it_does_not_send_mail_if_there_is_no_email_to_route_to()
263256
{
264257
Event::fake([
265258
MessageSending::class,
@@ -275,8 +268,7 @@ public function it_does_not_send_mail_if_there_is_no_email_to_route_to()
275268
Event::assertNotDispatched(MessageSending::class);
276269
}
277270

278-
/** @test */
279-
public function it_uses_views_set_on_the_mail_message_from_the_notification()
271+
public function test_it_uses_views_set_on_the_mail_message_from_the_notification()
280272
{
281273
View::addNamespace('testing', __DIR__.'/../views');
282274

tests/Controllers/UnsubscribeControllerTest.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ protected function getPackageProviders($app)
3535
];
3636
}
3737

38-
/** @test */
39-
public function it_unsubscribes_users_from_all_mailing_lists()
38+
public function test_it_unsubscribes_users_from_all_mailing_lists()
4039
{
4140
$this->withoutExceptionHandling();
4241

@@ -65,8 +64,7 @@ function ($user) use (&$expected, $expectedUser) {
6564
$this->assertTrue($expected);
6665
}
6766

68-
/** @test */
69-
public function it_unsubscribes_users_from_a_mailing_list()
67+
public function test_it_unsubscribes_users_from_a_mailing_list()
7068
{
7169
$this->withoutExceptionHandling();
7270

@@ -96,8 +94,7 @@ function ($user, $mailingList) use (&$expected, $expectedUser) {
9694
$this->assertTrue($expected);
9795
}
9896

99-
/** @test */
100-
public function it_uses_the_subscriber_to_redirect_the_user_after_completion()
97+
public function test_it_uses_the_subscriber_to_redirect_the_user_after_completion()
10198
{
10299
$this->withoutExceptionHandling();
103100

@@ -127,8 +124,7 @@ function ($user, $mailingList) use (&$expected, $expectedUser) {
127124
$this->assertTrue($expected);
128125
}
129126

130-
/** @test */
131-
public function it_aborts_if_the_target_model_does_not_exist()
127+
public function test_it_aborts_if_the_target_model_does_not_exist()
132128
{
133129
$notExpected = false;
134130

@@ -149,8 +145,7 @@ function () use (&$notExpected) {
149145
$this->assertFalse($notExpected);
150146
}
151147

152-
/** @test */
153-
public function it_fires_events_for_unsubscribing()
148+
public function test_it_fires_events_for_unsubscribing()
154149
{
155150
$this->withoutExceptionHandling();
156151

tests/Events/UserUnsubscribedTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88

99
class UserUnsubscribedTest extends TestCase
1010
{
11-
/** @test */
12-
public function it_can_be_initialised_with_parameters()
11+
public function test_it_can_be_initialised_with_parameters()
1312
{
1413
$user = new DummyNotifiable();
1514

0 commit comments

Comments
 (0)