From c9da40a0eada52ee628bfd6bb4c5b0cf3a5069bb Mon Sep 17 00:00:00 2001 From: Guilherme Pressutto Date: Tue, 26 Dec 2023 23:19:52 -0300 Subject: [PATCH] Removed version constraints --- README.md | 2 ++ composer.json | 10 +++++----- tests/SlackFakeTest.php | 17 +++++++++++++---- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 5be88f1..6974728 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,8 @@ Slack notification for Laravel as it should be. Easy, fast, simple and **highly testable**. Since it uses On-Demand Notifications, it requires Laravel 5.5 or higher. +> **This library is archived** and no longer maintained. It works as expected, but I don't have time to maintain it anymore. As a last update, I've removed version constraints from the `composer.json` file, so you can use it with any future Laravel versions. Feel free to fork it and use it as you wish. + ## Installation Require this package in your composer.json and update your dependencies: diff --git a/composer.json b/composer.json index cfb06af..a7e34f9 100644 --- a/composer.json +++ b/composer.json @@ -15,14 +15,14 @@ ], "require": { "php": ">=7.1.3", - "guzzlehttp/guzzle": "^6.3 || ^7.0", - "illuminate/notifications": "^5.8 || ^6.0 || ^7.0 || ^8.0 || ^9.0", - "illuminate/support": "^5.8 || ^6.0 || ^7.0 || ^8.0 || ^9.0", - "laravel/slack-notification-channel": "^2.0" + "guzzlehttp/guzzle": ">=6.3", + "illuminate/notifications": ">=5.8", + "illuminate/support": ">=5.8", + "laravel/slack-notification-channel": ">=2.0" }, "require-dev": { "orchestra/testbench": "*", - "phpunit/phpunit": "^7.0 || ^8.5.28 || ^9.0" + "phpunit/phpunit": ">=7.0" }, "autoload": { "psr-4": { diff --git a/tests/SlackFakeTest.php b/tests/SlackFakeTest.php index b0d1a24..50525cb 100644 --- a/tests/SlackFakeTest.php +++ b/tests/SlackFakeTest.php @@ -6,6 +6,7 @@ use Illuminate\Notifications\Messages\SlackMessage; use Illuminate\Support\Facades\Notification; use PHPUnit\Framework\Constraint\ExceptionMessage; +use PHPUnit\Framework\Constraint\ExceptionMessageIsOrContains; use PHPUnit\Framework\ExpectationFailedException; use Pressutto\LaravelSlack\Facades\Slack; use Pressutto\LaravelSlack\Notifications\SimpleSlack; @@ -30,7 +31,7 @@ public function testAssertSentCount() $fake->assertSentCount(1); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertThat($e, new ExceptionMessage('The number of messages sent was 0 instead of 1')); + $this->assertExceptionMessage($e, 'The number of messages sent was 0 instead of 1'); } \Slack::send('FAKE'); @@ -51,7 +52,7 @@ public function testAssertSentString() }); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertThat($e, new ExceptionMessage('The number of messages sent was 0 instead of 1')); + $this->assertExceptionMessage($e, 'The number of messages sent was 0 instead of 1'); } $fake->assertSent(function (SlackMessage $message) { @@ -73,12 +74,20 @@ public function testAssertSentSlackMessage() }); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertThat($e, - new ExceptionMessage('The number of messages sent was 0 instead of 1')); + $this->assertExceptionMessage($e, 'The number of messages sent was 0 instead of 1'); } $fake->assertSent(function (SlackMessage $message) use ($messageSent) { return $message === $messageSent; }); } + + public function assertExceptionMessage(\Exception $e, string $message): void + { + if (class_exists(ExceptionMessage::class)) { + $this->assertThat($e, new ExceptionMessage($message)); + } else { + $this->assertThat($e, new ExceptionMessageIsOrContains($message)); + } + } }