From fbd8c6db068f2cd33846e4c7dd150a18fba7e1e5 Mon Sep 17 00:00:00 2001 From: freek Date: Fri, 1 Sep 2017 12:07:20 +0200 Subject: [PATCH] make compatible with Laravel 5.5 --- .travis.yml | 1 + CHANGELOG.md | 5 +++++ README.md | 10 +--------- composer.json | 12 ++++++------ ...failed-job-monitor.php => failed-job-monitor.php} | 0 phpunit.xml.dist | 7 ------- src/FailedJobMonitorServiceProvider.php | 6 +++--- src/FailedJobNotifier.php | 6 +++--- src/Notifiable.php | 4 ++-- src/Notification.php | 2 +- tests/FailedJobMonitorTest.php | 6 +++--- 11 files changed, 25 insertions(+), 34 deletions(-) rename config/{laravel-failed-job-monitor.php => failed-job-monitor.php} (100%) diff --git a/.travis.yml b/.travis.yml index da7f7cd..b95d9ac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ language: php php: - 7.0 - 7.1 + - 7.2 env: matrix: diff --git a/CHANGELOG.md b/CHANGELOG.md index 41100d4..e8e8735 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ All notable changes to laravel-failed-job-monitor will be documented in this file +## 3.0.0 - 2017-09-01 + +- add support for Laravel 5.5 +- renamed config file from `laravel-failed-job-monitor` to `failed-job-monitor` + ## 2.2.0 - 2017-01-23 - add support for Laravel 5.4 diff --git a/README.md b/README.md index 88d3423..8dec1ef 100644 --- a/README.md +++ b/README.md @@ -24,15 +24,7 @@ If you intend to use Slack notifications you should also install the guzzle clie composer require guzzlehttp/guzzle ``` -Next up, the service provider must be registered: - -```php -'providers' => [ - ... - Spatie\FailedJobMonitor\FailedJobMonitorServiceProvider::class, - ... -]; -``` +The service provider will automatically be registered. Next, you must publish the config file: diff --git a/composer.json b/composer.json index d215d43..f569d2a 100644 --- a/composer.json +++ b/composer.json @@ -22,15 +22,15 @@ ], "require": { "php" : "^7.0", - "illuminate/contracts": "~5.3.29|~5.4.0", - "illuminate/queue": "~5.3.29|~5.4.0", - "illuminate/notifications": "~5.3.29|~5.4.0", - "illuminate/support": "~5.3.29|~5.4.0" + "illuminate/contracts": "~5.5.0", + "illuminate/queue": "~5.5.0", + "illuminate/notifications": "~5.5.0", + "illuminate/support": "~5.5.0" }, "require-dev": { - "phpunit/phpunit": "^5.5.4", - "orchestra/testbench":"~3.3.4|~3.4.0" + "phpunit/phpunit": "^6.3", + "orchestra/testbench":"~3.5.0" }, "autoload": { "psr-4": { diff --git a/config/laravel-failed-job-monitor.php b/config/failed-job-monitor.php similarity index 100% rename from config/laravel-failed-job-monitor.php rename to config/failed-job-monitor.php diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 563fc80..7a65b9f 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -19,11 +19,4 @@ src/ - - - - - - - diff --git a/src/FailedJobMonitorServiceProvider.php b/src/FailedJobMonitorServiceProvider.php index a30b2f9..4b525ce 100644 --- a/src/FailedJobMonitorServiceProvider.php +++ b/src/FailedJobMonitorServiceProvider.php @@ -12,7 +12,7 @@ class FailedJobMonitorServiceProvider extends IlluminateServiceProvider public function boot() { $this->publishes([ - __DIR__.'/../config/laravel-failed-job-monitor.php' => config_path('laravel-failed-job-monitor.php'), + __DIR__.'/../config/failed-job-monitor.php' => config_path('failed-job-monitor.php'), ], 'config'); $this->app->make(FailedJobNotifier::class)->register(); @@ -24,8 +24,8 @@ public function boot() public function register() { $this->mergeConfigFrom( - __DIR__.'/../config/laravel-failed-job-monitor.php', - 'laravel-failed-job-monitor' + __DIR__.'/../config/failed-job-monitor.php', + 'failed-job-monitor' ); $this->app->singleton(FailedJobNotifier::class); diff --git a/src/FailedJobNotifier.php b/src/FailedJobNotifier.php index db2c236..9e656a2 100644 --- a/src/FailedJobNotifier.php +++ b/src/FailedJobNotifier.php @@ -11,9 +11,9 @@ class FailedJobNotifier public function register() { app(QueueManager::class)->failing(function (JobFailed $event) { - $notifiable = app(config('laravel-failed-job-monitor.notifiable')); + $notifiable = app(config('failed-job-monitor.notifiable')); - $notification = app(config('laravel-failed-job-monitor.notification'))->setEvent($event); + $notification = app(config('failed-job-monitor.notification'))->setEvent($event); if (! $this->isValidNotificationClass($notification)) { throw InvalidConfiguration::notificationClassInvalid(get_class($notification)); @@ -40,7 +40,7 @@ public function isValidNotificationClass($notification): bool public function shouldSendNotification($notification) { - $callable = config('laravel-failed-job-monitor.notificationFilter'); + $callable = config('failed-job-monitor.notificationFilter'); if (! is_callable($callable)) { return true; diff --git a/src/Notifiable.php b/src/Notifiable.php index eacc099..4db5a2e 100644 --- a/src/Notifiable.php +++ b/src/Notifiable.php @@ -10,12 +10,12 @@ class Notifiable public function routeNotificationForMail(): string { - return config('laravel-failed-job-monitor.mail.to'); + return config('failed-job-monitor.mail.to'); } public function routeNotificationForSlack(): string { - return config('laravel-failed-job-monitor.slack.webhook_url'); + return config('failed-job-monitor.slack.webhook_url'); } /** diff --git a/src/Notification.php b/src/Notification.php index c343325..ab54bd7 100644 --- a/src/Notification.php +++ b/src/Notification.php @@ -15,7 +15,7 @@ class Notification extends IlluminateNotification public function via($notifiable): array { - return config('laravel-failed-job-monitor.channels'); + return config('failed-job-monitor.channels'); } public function setEvent(JobFailed $event): self diff --git a/tests/FailedJobMonitorTest.php b/tests/FailedJobMonitorTest.php index cacd90c..a81115a 100644 --- a/tests/FailedJobMonitorTest.php +++ b/tests/FailedJobMonitorTest.php @@ -36,7 +36,7 @@ public function it_can_send_notification_when_a_job_failed() /** @test */ public function it_can_send_notification_when_job_failed_to_different_notifiable() { - $this->app['config']->set('laravel-failed-job-monitor.notifiable', AnotherNotifiable::class); + $this->app['config']->set('failed-job-monitor.notifiable', AnotherNotifiable::class); $this->fireFailedEvent(); @@ -46,7 +46,7 @@ public function it_can_send_notification_when_job_failed_to_different_notifiable /** @test */ public function it_can_send_notification_when_job_failed_to_different_notification() { - $this->app['config']->set('laravel-failed-job-monitor.notification', AnotherNotification::class); + $this->app['config']->set('failed-job-monitor.notification', AnotherNotification::class); $this->fireFailedEvent(); @@ -56,7 +56,7 @@ public function it_can_send_notification_when_job_failed_to_different_notificati /** @test */ public function it_filters_out_notifications_when_the_notificationFilter_returns_false() { - $this->app['config']->set('laravel-failed-job-monitor.callback', [$this, 'returnsFalseWhenExceptionIsEmpty']); + $this->app['config']->set('failed-job-monitor.callback', [$this, 'returnsFalseWhenExceptionIsEmpty']); $this->fireFailedEvent();