Skip to content

Commit 0c0036a

Browse files
authored
Add Laravel v10 support (#234)
1 parent c27fb28 commit 0c0036a

File tree

6 files changed

+26
-28
lines changed

6 files changed

+26
-28
lines changed

.github/workflows/tests.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,19 @@ jobs:
99
fail-fast: true
1010
matrix:
1111
os: [ ubuntu-latest ]
12-
php: [ 8.0, 8.1 ]
13-
laravel: [ 9.* ]
12+
php: [ 8.0, 8.1, 8.2 ]
13+
laravel: [ 9.*, 10.* ]
1414
dependency-version: [ prefer-lowest, prefer-stable ]
15+
exclude:
16+
- laravel: 9.*
17+
php: 8.2
18+
- laravel: 10.*
19+
php: 8.0
1520
include:
1621
- laravel: 9.*
1722
testbench: 7.*
18-
legacy-factories: 1.*
23+
- laravel: 10.*
24+
testbench: 8.*
1925

2026
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
2127

@@ -42,10 +48,5 @@ jobs:
4248
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
4349
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
4450
45-
- name: Install legacy factories dependency
46-
run: |
47-
composer require "laravel/legacy-factories:${{ matrix.legacy-factories }}" --no-interaction
48-
if: matrix.legacy-factories
49-
5051
- name: Execute tests
51-
run: vendor/bin/phpunit --verbose
52+
run: vendor/bin/phpunit --testdox

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ All notable changes to `laravel-love` will be documented in this file.
66

77
### Added
88

9+
- ([#234]) Added Laravel 10 support
910
- ([#216]) Added Docker Compose to quick development build
1011
- ([#188]) Added `whereReactedTo` model scope to Reacterable models
1112
- ([#188]) Added `whereNotReactedTo` model scope to Reacterable models
@@ -568,6 +569,7 @@ Follow [upgrade instructions](UPGRADING.md#from-v5-to-v6) to migrate database to
568569
[1.1.1]: https://github.com/cybercog/laravel-love/compare/1.1.0...1.1.1
569570
[1.1.0]: https://github.com/cybercog/laravel-love/compare/1.0.0...1.1.0
570571

572+
[#234]: https://github.com/cybercog/laravel-love/pull/234
571573
[#233]: https://github.com/cybercog/laravel-love/pull/233
572574
[#231]: https://github.com/cybercog/laravel-love/pull/231
573575
[#222]: https://github.com/cybercog/laravel-love/pull/222

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@
4747
},
4848
"require": {
4949
"php": "^8.0",
50-
"illuminate/database": "^9.0",
51-
"illuminate/support": "^9.0"
50+
"illuminate/database": "^9.0|^10.1.3",
51+
"illuminate/support": "^9.0|^10.1.3"
5252
},
5353
"require-dev": {
54+
"laravel/legacy-factories": "^1.3",
5455
"mockery/mockery": "^1.0",
55-
"orchestra/database": "^7.0",
56-
"orchestra/testbench": "^7.0",
56+
"orchestra/testbench": "^7.0|^8.0",
5757
"phpstan/phpstan": "^1.9",
58-
"phpunit/phpunit": "^9.0"
58+
"phpunit/phpunit": "^9.6"
5959
},
6060
"autoload": {
6161
"psr-4": {

tests/TestCase.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
use Illuminate\Database\Eloquent\Relations\Relation;
2222
use Illuminate\Filesystem\Filesystem;
2323
use Mockery;
24-
use Orchestra\Database\ConsoleServiceProvider;
2524
use Orchestra\Testbench\TestCase as OrchestraTestCase;
2625

2726
abstract class TestCase extends OrchestraTestCase
@@ -64,7 +63,6 @@ protected function getPackageProviders($app): array
6463
return [
6564
LoveServiceProvider::class,
6665
LoveEventServiceProvider::class,
67-
ConsoleServiceProvider::class,
6866
];
6967
}
7068

tests/Unit/Reaction/Events/ReactionHasBeenAddedTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,20 @@
1818
use Cog\Laravel\Love\Reaction\Events\ReactionHasBeenAdded;
1919
use Cog\Laravel\Love\ReactionType\Models\ReactionType;
2020
use Cog\Tests\Laravel\Love\TestCase;
21-
use Illuminate\Foundation\Testing\Concerns\MocksApplicationServices;
21+
use Illuminate\Support\Facades\Event;
2222

2323
final class ReactionHasBeenAddedTest extends TestCase
2424
{
25-
use MocksApplicationServices;
26-
2725
/** @test */
2826
public function it_fires_reaction_has_been_added_event(): void
2927
{
30-
$this->expectsEvents(ReactionHasBeenAdded::class);
31-
28+
Event::fake([ReactionHasBeenAdded::class]);
3229
$reactionType = factory(ReactionType::class)->create();
3330
$reacter = factory(Reacter::class)->create();
3431
$reactant = factory(Reactant::class)->create();
3532

3633
$reacter->reactTo($reactant, $reactionType);
34+
35+
Event::assertDispatched(ReactionHasBeenAdded::class);
3736
}
3837
}

tests/Unit/Reaction/Events/ReactionHasBeenRemovedTest.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,28 @@
1111

1212
declare(strict_types=1);
1313

14-
namespace Cog\Laravel\Love\Tests\Unit\Reaction\Events;
14+
namespace Cog\Tests\Laravel\Love\Unit\Reaction\Events;
1515

1616
use Cog\Laravel\Love\Reactant\Models\Reactant;
1717
use Cog\Laravel\Love\Reacter\Models\Reacter;
1818
use Cog\Laravel\Love\Reaction\Events\ReactionHasBeenRemoved;
1919
use Cog\Laravel\Love\ReactionType\Models\ReactionType;
2020
use Cog\Tests\Laravel\Love\TestCase;
21-
use Illuminate\Foundation\Testing\Concerns\MocksApplicationServices;
21+
use Illuminate\Support\Facades\Event;
2222

2323
final class ReactionHasBeenRemovedTest extends TestCase
2424
{
25-
use MocksApplicationServices;
26-
2725
/** @test */
2826
public function it_fire_reaction_has_been_removed_event(): void
2927
{
30-
$this->expectsEvents(ReactionHasBeenRemoved::class);
31-
28+
Event::fake([ReactionHasBeenRemoved::class]);
3229
$reactionType = factory(ReactionType::class)->create();
3330
$reacter = factory(Reacter::class)->create();
3431
$reactant = factory(Reactant::class)->create();
35-
3632
$reacter->reactTo($reactant, $reactionType);
3733

3834
$reacter->unreactTo($reactant, $reactionType);
35+
36+
Event::assertDispatched(ReactionHasBeenRemoved::class);
3937
}
4038
}

0 commit comments

Comments
 (0)