Skip to content

Commit

Permalink
Merge pull request #21 from vormkracht10/laravel-11
Browse files Browse the repository at this point in the history
Laravel 11 support
  • Loading branch information
markvaneijk authored Jun 18, 2024
2 parents b3d400d + fe90bce commit 6ab46f7
Show file tree
Hide file tree
Showing 22 changed files with 36 additions and 45 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,25 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.2, 8.1]
laravel: [10.*]
php: [8.1, 8.2]
laravel: [10.*, 11.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
carbon: ^2.63
- laravel: 11.*
testbench: 9.*
carbon: ^2.72.2
exclude:
- laravel: 11.*
php: 8.1

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

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -44,8 +50,5 @@ jobs:
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.carbon }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: List Installed Dependencies
run: composer show -D

- name: Execute tests
run: vendor/bin/pest
run: vendor/bin/pest --ci
1 change: 1 addition & 0 deletions .phpunit.cache/test-results
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":"pest_2.34.8","defects":[],"times":{"P\\Tests\\EventTest::__pest_evaluable_it_dispaches_events_when_an_mail_is_logged":0.01,"P\\Tests\\GlobalTest::__pest_evaluable_globals":0.109,"P\\Tests\\MailLogTest::__pest_evaluable_it_can_log_sent_mails":0.056,"P\\Tests\\PostmarkTest::__pest_evaluable_it_can_receive_incoming_delivery_webhook_from_postmark":0.003,"P\\Tests\\PostmarkTest::__pest_evaluable_it_can_receive_incoming_click_webhook_from_postmark":0.003,"P\\Tests\\PostmarkTest::__pest_evaluable_it_can_receive_incoming_open_webhook_from_postmark":0.003,"P\\Tests\\PostmarkTest::__pest_evaluable_it_can_receive_incoming_complaint_webhook_from_postmark":0.003,"P\\Tests\\PostmarkTest::__pest_evaluable_it_can_receive_incoming_bounce_webhook_from_postmark":0.068,"P\\Tests\\NotificationTest::__pest_evaluable_it_will_send_notification_on_bounce":0.002}}
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@
],
"require": {
"php": "^8.1",
"illuminate/contracts": "^10.8.0",
"illuminate/contracts": "^10.8.0|^11.0",
"laravel-notification-channels/discord": "^1.6",
"laravel-notification-channels/telegram": "^4.0",
"laravel-notification-channels/telegram": "^4.0|5.0",
"laravel/helpers": "^1.6",
"laravel/slack-notification-channel": "^2.5",
"laravel/slack-notification-channel": "^2.5|^3.2",
"spatie/laravel-package-tools": "^1.14.0",
"wildbit/postmark-php": "^4.0"
},
"require-dev": {
"laravel/pint": "^1.9.0",
"nunomaduro/collision": "^7.5.0",
"nunomaduro/collision": "^7.5.0|^8.0",
"nunomaduro/larastan": "^2.0.1",
"orchestra/testbench": "^8.5.0",
"orchestra/testbench": "^8.5.0|^9.0",
"pestphp/pest": "^2.6.1",
"pestphp/pest-plugin-laravel": "^2.0.0",
"phpstan/extension-installer": "^1.3.0",
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/CheckBounceRateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class CheckBounceRateCommand extends Command
protected $signature = 'mails:bounce-rate';

protected $description = 'Check if the bounce rate is higher than the configured limit '.
'and send a notification if it is.';
'and send a notification if it is.';

public function handle(): int
{
Expand Down
2 changes: 1 addition & 1 deletion src/Contracts/MailProviderContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

interface MailProviderContract
{
public function driver(string $driver = null);
public function driver(?string $driver = null);
}
2 changes: 1 addition & 1 deletion src/Controllers/PostmarkWebhookController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function __invoke(Request $request): Response
$payload = $request->all(),
);

if(is_null($uuid)) {
if (is_null($uuid)) {
return response(status: 202);
}

Expand Down
3 changes: 1 addition & 2 deletions src/Events/MailBounced.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ class MailBounced
*/
public function __construct(
public MailEvent $mailEvent
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Events/MailClicked.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ class MailClicked
*/
public function __construct(
public MailEvent $mailEvent
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Events/MailComplained.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ class MailComplained
*/
public function __construct(
public MailEvent $mailEvent
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Events/MailDelivered.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ class MailDelivered
*/
public function __construct(
public MailEvent $mailEvent
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Events/MailEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ class MailEvent
public function __construct(
public string $provider,
public $payload
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Events/MailEventLogged.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ class MailEventLogged
*/
public function __construct(
public MailEvent $mailEvent
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Events/MailOpened.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ class MailOpened
*/
public function __construct(
public MailEvent $mailEvent
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Events/MailResent.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ class MailResent
public function __construct(
public string $provider,
public $payload
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Events/WebhookBounced.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@ class WebhookBounced
public function __construct(
public Provider $provider,
public $payload
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Events/WebhookClicked.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@ class WebhookClicked
public function __construct(
public Provider $provider,
public $payload
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Events/WebhookComplained.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@ class WebhookComplained
public function __construct(
public Provider $provider,
public $payload
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Events/WebhookDelivered.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@ class WebhookDelivered
public function __construct(
public Provider $provider,
public $payload,
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Events/WebhookEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ public function __construct(
public array $payload = [],
protected ?string $mailUuid = null,
public $timestamp = null,
) {
}
) {}

public function mail(): ?Mail
{
Expand Down
3 changes: 1 addition & 2 deletions src/Events/WebhookOpened.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@ class WebhookOpened
public function __construct(
public Provider $provider,
public $payload
) {
}
) {}
}
2 changes: 1 addition & 1 deletion src/Listeners/Concerns/SendsNotifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function send(Notification $notification, array $channels): void
return;
}

foreach($accounts as $route) {
foreach ($accounts as $route) {
Notifications::route($channel, $route)->notify(
$notification->on($channel),
);
Expand Down
3 changes: 2 additions & 1 deletion src/Notifications/Concerns/HasDynamicDrivers.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ public function on($drivers, bool $merge = false): static

$via = [
'discord' => \NotificationChannels\Discord\DiscordChannel::class,
'mail' => \Illuminate\Notifications\Channels\MailChannel::class,
];

$drivers = array_map(function($driver) use ($via) {
$drivers = array_map(function ($driver) use ($via) {
return $via[$driver];
}, $drivers);

Expand Down

0 comments on commit 6ab46f7

Please sign in to comment.