Skip to content

Commit

Permalink
Merge pull request #13 from mikebarlow/support-php7
Browse files Browse the repository at this point in the history
Fix PHP7 support
  • Loading branch information
mikebarlow authored Nov 13, 2022
2 parents 8d345a2 + 66ae312 commit b0ce6cf
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
operating-system: [ubuntu-20.04]
php: ['8.0', '8.1']
php: ['7.4', '8.0', '8.1']

name: P${{ matrix.php }}
steps:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## [1.0.1] - TBC

* Fix: Spelling mistake in template caused bug with justified items [PR #5](https://github.com/mikebarlow/megaphone/pull/5)
* Fix: Added support for PHP7.4 [PR #13](https://github.com/mikebarlow/megaphone/pull/13)

## [1.0.0] - 2022-09-19

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
}
],
"require": {
"php": "^7.4 || ^8.0",
"livewire/livewire": "^2.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.7",
"pestphp/pest-plugin-livewire": "^1.0",
"orchestra/testbench": "^7.7",
"pestphp/pest-plugin-faker": "^1.0",
"spatie/pest-plugin-test-time": "^1.1"
"orchestra/testbench": "^6.0",
"pestphp/pest-plugin-faker": "^1.0"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion src/Livewire/Megaphone.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function loadAnnouncements($user)
{
$this->unread = $this->announcements = collect([]);

if ($user === null || $user::class !== config('megaphone.model')) {
if ($user === null || get_class($user) !== config('megaphone.model')) {
return;
}

Expand Down
14 changes: 10 additions & 4 deletions tests/ConsoleClearNotificationsTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use function Spatie\PestPluginTestTime\testTime;
use Carbon\Carbon;

it('can render clear out old notifications', function () {
$user = $this->createTestUser();
Expand All @@ -12,7 +12,9 @@
$this->assertDatabaseCount('notifications', 1);
$user->unreadNotifications->markAsRead();

testTime()->addWeeks(3);
Carbon::setTestNow(
Carbon::now()->addWeeks(3)
);

$this->artisan('megaphone:clear-announcements')->assertSuccessful();

Expand All @@ -29,7 +31,9 @@
$this->assertDatabaseCount('notifications', 1);
$user->unreadNotifications->markAsRead();

testTime()->addWeeks(1);
Carbon::setTestNow(
Carbon::now()->addWeeks(1)
);

$this->artisan('megaphone:clear-announcements')->assertSuccessful();

Expand All @@ -45,7 +49,9 @@
);
$this->assertDatabaseCount('notifications', 1);

testTime()->addWeeks(3);
Carbon::setTestNow(
Carbon::now()->addWeeks(3)
);

$this->artisan('megaphone:clear-announcements')->assertSuccessful();

Expand Down

0 comments on commit b0ce6cf

Please sign in to comment.