Skip to content
This repository was archived by the owner on Dec 28, 2023. It is now read-only.

Commit c9da40a

Browse files
committed
Removed version constraints
1 parent ae0aaa8 commit c9da40a

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Slack notification for Laravel as it should be.
1919
Easy, fast, simple and **highly testable**.
2020
Since it uses On-Demand Notifications, it requires Laravel 5.5 or higher.
2121

22+
> **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.
23+
2224
## Installation
2325

2426
Require this package in your composer.json and update your dependencies:

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
],
1616
"require": {
1717
"php": ">=7.1.3",
18-
"guzzlehttp/guzzle": "^6.3 || ^7.0",
19-
"illuminate/notifications": "^5.8 || ^6.0 || ^7.0 || ^8.0 || ^9.0",
20-
"illuminate/support": "^5.8 || ^6.0 || ^7.0 || ^8.0 || ^9.0",
21-
"laravel/slack-notification-channel": "^2.0"
18+
"guzzlehttp/guzzle": ">=6.3",
19+
"illuminate/notifications": ">=5.8",
20+
"illuminate/support": ">=5.8",
21+
"laravel/slack-notification-channel": ">=2.0"
2222
},
2323
"require-dev": {
2424
"orchestra/testbench": "*",
25-
"phpunit/phpunit": "^7.0 || ^8.5.28 || ^9.0"
25+
"phpunit/phpunit": ">=7.0"
2626
},
2727
"autoload": {
2828
"psr-4": {

tests/SlackFakeTest.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Illuminate\Notifications\Messages\SlackMessage;
77
use Illuminate\Support\Facades\Notification;
88
use PHPUnit\Framework\Constraint\ExceptionMessage;
9+
use PHPUnit\Framework\Constraint\ExceptionMessageIsOrContains;
910
use PHPUnit\Framework\ExpectationFailedException;
1011
use Pressutto\LaravelSlack\Facades\Slack;
1112
use Pressutto\LaravelSlack\Notifications\SimpleSlack;
@@ -30,7 +31,7 @@ public function testAssertSentCount()
3031
$fake->assertSentCount(1);
3132
$this->fail();
3233
} catch (ExpectationFailedException $e) {
33-
$this->assertThat($e, new ExceptionMessage('The number of messages sent was 0 instead of 1'));
34+
$this->assertExceptionMessage($e, 'The number of messages sent was 0 instead of 1');
3435
}
3536

3637
\Slack::send('FAKE');
@@ -51,7 +52,7 @@ public function testAssertSentString()
5152
});
5253
$this->fail();
5354
} catch (ExpectationFailedException $e) {
54-
$this->assertThat($e, new ExceptionMessage('The number of messages sent was 0 instead of 1'));
55+
$this->assertExceptionMessage($e, 'The number of messages sent was 0 instead of 1');
5556
}
5657

5758
$fake->assertSent(function (SlackMessage $message) {
@@ -73,12 +74,20 @@ public function testAssertSentSlackMessage()
7374
});
7475
$this->fail();
7576
} catch (ExpectationFailedException $e) {
76-
$this->assertThat($e,
77-
new ExceptionMessage('The number of messages sent was 0 instead of 1'));
77+
$this->assertExceptionMessage($e, 'The number of messages sent was 0 instead of 1');
7878
}
7979

8080
$fake->assertSent(function (SlackMessage $message) use ($messageSent) {
8181
return $message === $messageSent;
8282
});
8383
}
84+
85+
public function assertExceptionMessage(\Exception $e, string $message): void
86+
{
87+
if (class_exists(ExceptionMessage::class)) {
88+
$this->assertThat($e, new ExceptionMessage($message));
89+
} else {
90+
$this->assertThat($e, new ExceptionMessageIsOrContains($message));
91+
}
92+
}
8493
}

0 commit comments

Comments
 (0)