diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 39f10a4..5612cec 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: true matrix: - php: [8.1, 8.2] + php: [8.2, 8.3] stability: [prefer-lowest, prefer-stable] name: P${{ matrix.php }} - S${{ matrix.stability }} diff --git a/composer.json b/composer.json index 3fb0c2c..1797685 100755 --- a/composer.json +++ b/composer.json @@ -16,15 +16,15 @@ } ], "require": { - "php": "^8.1", - "illuminate/container": "^10.0", - "illuminate/database": "^10.0", - "illuminate/events": "^10.0", - "illuminate/support": "^10.0" + "php": "^8.2", + "illuminate/container": "^11.0", + "illuminate/database": "^11.0", + "illuminate/events": "^11.0", + "illuminate/support": "^11.0" }, "require-dev": { - "phpunit/phpunit": "^9.6.0 || ^10.0.7", - "orchestra/testbench": "^8.0", + "phpunit/phpunit": "^10.5|^11.0", + "orchestra/testbench": "^9.0", "friendsofphp/php-cs-fixer": "^3.14" }, "scripts": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index af6cdb0..0e1b0a5 100755 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,13 +1,13 @@ - - - - ./src - - + ./tests/ + + + ./src + + diff --git a/tests/Feature/HasBelongsToEventsTest.php b/tests/Feature/HasBelongsToEventsTest.php index f7c775b..ba3c77c 100644 --- a/tests/Feature/HasBelongsToEventsTest.php +++ b/tests/Feature/HasBelongsToEventsTest.php @@ -2,12 +2,13 @@ namespace Chelout\RelationshipEvents\Tests\Feature; +use PHPUnit\Framework\Attributes\Test; use Chelout\RelationshipEvents\Tests\Stubs\Profile; use Chelout\RelationshipEvents\Tests\Stubs\User; use Chelout\RelationshipEvents\Tests\TestCase; use Illuminate\Support\Facades\Event; -class HasBelongsToEventsTest extends TestCase +final class HasBelongsToEventsTest extends TestCase { public function setup(): void { @@ -17,8 +18,8 @@ public function setup(): void Profile::setupTable(); } - /** @test */ - public function it_fires_belongsToAssociating_and_belongsToAssociated_when_a_model_associated() + #[Test] + public function it_fires_belongsToAssociating_and_belongsToAssociated_when_a_model_associated(): void { Event::fake(); @@ -39,8 +40,8 @@ function ($event, $callback) use ($user, $profile) { ); } - /** @test */ - public function it_fires_belongsToDissociating_and_belongsToDissociated_when_a_model_dissociated() + #[Test] + public function it_fires_belongsToDissociating_and_belongsToDissociated_when_a_model_dissociated(): void { Event::fake(); @@ -62,8 +63,8 @@ function ($event, $callback) use ($user, $profile) { ); } - /** @test */ - public function it_fires_belongsToUpdating_and_belongsToUpdated_when_a_parent_model_updated() + #[Test] + public function it_fires_belongsToUpdating_and_belongsToUpdated_when_a_parent_model_updated(): void { Event::fake(); diff --git a/tests/Feature/HasBelongsToManyEventsTest.php b/tests/Feature/HasBelongsToManyEventsTest.php index be3ba76..54c7576 100644 --- a/tests/Feature/HasBelongsToManyEventsTest.php +++ b/tests/Feature/HasBelongsToManyEventsTest.php @@ -2,12 +2,13 @@ namespace Chelout\RelationshipEvents\Tests\Feature; +use PHPUnit\Framework\Attributes\Test; use Chelout\RelationshipEvents\Tests\Stubs\Role; use Chelout\RelationshipEvents\Tests\Stubs\User; use Chelout\RelationshipEvents\Tests\TestCase; use Illuminate\Support\Facades\Event; -class HasBelongsToManyEventsTest extends TestCase +final class HasBelongsToManyEventsTest extends TestCase { public function setup(): void { @@ -17,8 +18,8 @@ public function setup(): void Role::setupTable(); } - /** @test */ - public function it_fires_belongsToManyAttaching_and_belongsToManyAttached_when_a_model_attached() + #[Test] + public function it_fires_belongsToManyAttaching_and_belongsToManyAttached_when_a_model_attached(): void { Event::fake(); @@ -40,8 +41,8 @@ function ($event, $callback) use ($user, $role) { ); } - /** @test */ - public function it_fires_belongsToManyDetaching_and_belongsToManyDetached_when_a_model_detached() + #[Test] + public function it_fires_belongsToManyDetaching_and_belongsToManyDetached_when_a_model_detached(): void { Event::fake(); @@ -64,8 +65,8 @@ function ($event, $callback) use ($user, $role) { ); } - /** @test */ - public function it_fires_belongsToManySyncing_and_belongsToManySynced_when_a_model_synced() + #[Test] + public function it_fires_belongsToManySyncing_and_belongsToManySynced_when_a_model_synced(): void { Event::fake(); @@ -87,8 +88,8 @@ function ($event, $callback) use ($user, $role) { ); } - /** @test */ - public function it_fires_belongsToManyToggling_and_belongsToManyToggled_when_a_model_toggled() + #[Test] + public function it_fires_belongsToManyToggling_and_belongsToManyToggled_when_a_model_toggled(): void { Event::fake(); @@ -110,8 +111,8 @@ function ($event, $callback) use ($user, $role) { ); } - /** @test */ - public function it_fires_belongsToManyUpdatingExistingPivot_and_belongsToManyUpdatedExistingPivot_when_updaing_pivot_table() + #[Test] + public function it_fires_belongsToManyUpdatingExistingPivot_and_belongsToManyUpdatedExistingPivot_when_updaing_pivot_table(): void { Event::fake(); diff --git a/tests/Feature/HasManyEventsTest.php b/tests/Feature/HasManyEventsTest.php index c36eeeb..f4ce23c 100644 --- a/tests/Feature/HasManyEventsTest.php +++ b/tests/Feature/HasManyEventsTest.php @@ -2,12 +2,13 @@ namespace Chelout\RelationshipEvents\Tests\Feature; +use PHPUnit\Framework\Attributes\Test; use Chelout\RelationshipEvents\Tests\Stubs\Post; use Chelout\RelationshipEvents\Tests\Stubs\User; use Chelout\RelationshipEvents\Tests\TestCase; use Illuminate\Support\Facades\Event; -class HasManyEventsTest extends TestCase +final class HasManyEventsTest extends TestCase { public function setup(): void { @@ -17,8 +18,8 @@ public function setup(): void Post::setupTable(); } - /** @test */ - public function it_fires_hasManyCreating_and_hasManyCreated_when_belonged_model_with_many_created() + #[Test] + public function it_fires_hasManyCreating_and_hasManyCreated_when_belonged_model_with_many_created(): void { Event::fake(); @@ -39,8 +40,8 @@ function ($event, $callback) use ($user, $post) { ); } - /** @test */ - public function it_fires_hasManySaving_and_hasManySaved_when_belonged_model_with_many_saved() + #[Test] + public function it_fires_hasManySaving_and_hasManySaved_when_belonged_model_with_many_saved(): void { Event::fake(); @@ -61,8 +62,8 @@ function ($event, $callback) use ($user, $post) { ); } - /** @test */ - public function it_fires_hasManyUpdating_and_hasManyUpdated_when_belonged_model_with_many_updated() + #[Test] + public function it_fires_hasManyUpdating_and_hasManyUpdated_when_belonged_model_with_many_updated(): void { Event::fake(); diff --git a/tests/Feature/HasMorphManyEventsTest.php b/tests/Feature/HasMorphManyEventsTest.php index f030c9c..fdcad50 100644 --- a/tests/Feature/HasMorphManyEventsTest.php +++ b/tests/Feature/HasMorphManyEventsTest.php @@ -2,12 +2,13 @@ namespace Chelout\RelationshipEvents\Tests\Feature; +use PHPUnit\Framework\Attributes\Test; use Chelout\RelationshipEvents\Tests\Stubs\Comment; use Chelout\RelationshipEvents\Tests\Stubs\Post; use Chelout\RelationshipEvents\Tests\TestCase; use Illuminate\Support\Facades\Event; -class HasMorphManyEventsTest extends TestCase +final class HasMorphManyEventsTest extends TestCase { public function setup(): void { @@ -17,8 +18,8 @@ public function setup(): void Comment::setupTable(); } - /** @test */ - public function it_fires_morphManyCreating_and_morphManyCreated_when_belonged_model_with_morph_many_created() + #[Test] + public function it_fires_morphManyCreating_and_morphManyCreated_when_belonged_model_with_morph_many_created(): void { Event::fake(); @@ -39,8 +40,8 @@ function ($event, $callback) use ($post, $comment) { ); } - /** @test */ - public function it_fires_morphManySaving_and_morphManySaved_when_belonged_model_with_morph_many_saved() + #[Test] + public function it_fires_morphManySaving_and_morphManySaved_when_belonged_model_with_morph_many_saved(): void { Event::fake(); @@ -61,8 +62,8 @@ function ($event, $callback) use ($post, $comment) { ); } - /** @test */ - public function it_fires_morphManyUpdating_and_morphManyUpdated_when_belonged_model_with_morph_many_updated() + #[Test] + public function it_fires_morphManyUpdating_and_morphManyUpdated_when_belonged_model_with_morph_many_updated(): void { Event::fake(); diff --git a/tests/Feature/HasMorphOneEventsTest.php b/tests/Feature/HasMorphOneEventsTest.php index f858e0d..9665725 100644 --- a/tests/Feature/HasMorphOneEventsTest.php +++ b/tests/Feature/HasMorphOneEventsTest.php @@ -2,12 +2,13 @@ namespace Chelout\RelationshipEvents\Tests\Feature; +use PHPUnit\Framework\Attributes\Test; use Chelout\RelationshipEvents\Tests\Stubs\Address; use Chelout\RelationshipEvents\Tests\Stubs\User; use Chelout\RelationshipEvents\Tests\TestCase; use Illuminate\Support\Facades\Event; -class HasMorphOneEventsTest extends TestCase +final class HasMorphOneEventsTest extends TestCase { public function setup(): void { @@ -17,8 +18,8 @@ public function setup(): void Address::setupTable(); } - /** @test */ - public function it_fires_morphOneCreating_and_morphOneCreated_when_belonged_model_with_morph_one_created() + #[Test] + public function it_fires_morphOneCreating_and_morphOneCreated_when_belonged_model_with_morph_one_created(): void { Event::fake(); @@ -39,8 +40,8 @@ function ($event, $callback) use ($user, $address) { ); } - /** @test */ - public function it_fires_morphOneSaving_and_morphOneSaved_when_belonged_model_with_morph_one_saved() + #[Test] + public function it_fires_morphOneSaving_and_morphOneSaved_when_belonged_model_with_morph_one_saved(): void { Event::fake(); @@ -61,8 +62,8 @@ function ($event, $callback) use ($user, $address) { ); } - /** @test */ - public function it_fires_morphOneUpdating_and_morphOneUpdated_when_belonged_model_with_morph_one_updated() + #[Test] + public function it_fires_morphOneUpdating_and_morphOneUpdated_when_belonged_model_with_morph_one_updated(): void { Event::fake(); diff --git a/tests/Feature/HasMorphToEventsTest.php b/tests/Feature/HasMorphToEventsTest.php index a4d72eb..3eeb455 100644 --- a/tests/Feature/HasMorphToEventsTest.php +++ b/tests/Feature/HasMorphToEventsTest.php @@ -2,12 +2,13 @@ namespace Chelout\RelationshipEvents\Tests\Feature; +use PHPUnit\Framework\Attributes\Test; use Chelout\RelationshipEvents\Tests\Stubs\Comment; use Chelout\RelationshipEvents\Tests\Stubs\Post; use Chelout\RelationshipEvents\Tests\TestCase; use Illuminate\Support\Facades\Event; -class HasMorphToEventsTest extends TestCase +final class HasMorphToEventsTest extends TestCase { public function setup(): void { @@ -17,8 +18,8 @@ public function setup(): void Comment::setupTable(); } - /** @test */ - public function it_fires_morphToAssociating_and_morphToAssociated() + #[Test] + public function it_fires_morphToAssociating_and_morphToAssociated(): void { Event::fake(); @@ -40,8 +41,8 @@ function ($event, $callback) use ($post, $comment) { ); } - /** @test */ - public function it_fires_morphToDissociating_and_morphToDissociated() + #[Test] + public function it_fires_morphToDissociating_and_morphToDissociated(): void { Event::fake(); @@ -64,8 +65,8 @@ function ($event, $callback) use ($post, $comment) { ); } - /** @test */ - public function it_fires_morphToUpdating_and_morphToUpdated() + #[Test] + public function it_fires_morphToUpdating_and_morphToUpdated(): void { Event::fake(); diff --git a/tests/Feature/HasMorphToManyEventsTest.php b/tests/Feature/HasMorphToManyEventsTest.php index e6031c1..d492403 100644 --- a/tests/Feature/HasMorphToManyEventsTest.php +++ b/tests/Feature/HasMorphToManyEventsTest.php @@ -2,12 +2,13 @@ namespace Chelout\RelationshipEvents\Tests\Feature; +use PHPUnit\Framework\Attributes\Test; use Chelout\RelationshipEvents\Tests\Stubs\Post; use Chelout\RelationshipEvents\Tests\Stubs\Tag; use Chelout\RelationshipEvents\Tests\TestCase; use Illuminate\Support\Facades\Event; -class HasMorphToManyEventsTest extends TestCase +final class HasMorphToManyEventsTest extends TestCase { public function setup(): void { @@ -17,8 +18,8 @@ public function setup(): void Tag::setupTable(); } - /** @test */ - public function it_fires_morphToManyAttaching_and_morphToManyAttached() + #[Test] + public function it_fires_morphToManyAttaching_and_morphToManyAttached(): void { Event::fake(); @@ -40,8 +41,8 @@ function ($event, $callback) use ($post, $tag) { ); } - /** @test */ - public function it_fires_morphToManyDetaching_and_morphToManyDetached() + #[Test] + public function it_fires_morphToManyDetaching_and_morphToManyDetached(): void { Event::fake(); @@ -64,8 +65,8 @@ function ($event, $callback) use ($post, $tag) { ); } - /** @test */ - public function it_fires_morphToManySyncing_and_morphToManySynced() + #[Test] + public function it_fires_morphToManySyncing_and_morphToManySynced(): void { Event::fake(); @@ -87,8 +88,8 @@ function ($event, $callback) use ($post, $tag) { ); } - /** @test */ - public function it_fires_morphToManyUpdatingExistingPivot_and_morphToManyUpdatedExistingPivot() + #[Test] + public function it_fires_morphToManyUpdatingExistingPivot_and_morphToManyUpdatedExistingPivot(): void { Event::fake(); diff --git a/tests/Feature/HasMorphedByManyEventsTest.php b/tests/Feature/HasMorphedByManyEventsTest.php index e72234a..e90f131 100644 --- a/tests/Feature/HasMorphedByManyEventsTest.php +++ b/tests/Feature/HasMorphedByManyEventsTest.php @@ -2,12 +2,13 @@ namespace Chelout\RelationshipEvents\Tests\Feature; +use PHPUnit\Framework\Attributes\Test; use Chelout\RelationshipEvents\Tests\Stubs\Post; use Chelout\RelationshipEvents\Tests\Stubs\Tag; use Chelout\RelationshipEvents\Tests\TestCase; use Illuminate\Support\Facades\Event; -class HasMorphedByManyEventsTest extends TestCase +final class HasMorphedByManyEventsTest extends TestCase { public function setup(): void { @@ -17,8 +18,8 @@ public function setup(): void Tag::setupTable(); } - /** @test */ - public function it_fires_morphedByManyAttaching_and_morphedByManyAttached_when_created() + #[Test] + public function it_fires_morphedByManyAttaching_and_morphedByManyAttached_when_created(): void { Event::fake(); @@ -39,8 +40,8 @@ function ($event, $callback) use ($post, $tag) { ); } - /** @test */ - public function it_fires_morphedByManyAttaching_and_morphedByManyAttached_when_saved() + #[Test] + public function it_fires_morphedByManyAttaching_and_morphedByManyAttached_when_saved(): void { Event::fake(); @@ -61,8 +62,8 @@ function ($event, $callback) use ($post, $tag) { ); } - /** @test */ - public function it_fires_morphedByManyAttaching_and_morphedByManyAttached_when_attached() + #[Test] + public function it_fires_morphedByManyAttaching_and_morphedByManyAttached_when_attached(): void { Event::fake(); @@ -84,8 +85,8 @@ function ($event, $callback) use ($post, $tag) { ); } - /** @test */ - public function it_fires_morphedByManyDetaching_and_morphedByManyDetached_when_detached() + #[Test] + public function it_fires_morphedByManyDetaching_and_morphedByManyDetached_when_detached(): void { Event::fake(); @@ -108,8 +109,8 @@ function ($event, $callback) use ($post, $tag) { ); } - /** @test */ - public function it_fires_morphedByManySyncing_and_morphedByManySynced() + #[Test] + public function it_fires_morphedByManySyncing_and_morphedByManySynced(): void { Event::fake(); @@ -131,8 +132,8 @@ function ($event, $callback) use ($post, $tag) { ); } - /** @test */ - public function it_fires_morphedByManyToggling_and_morphedByManyToggled() + #[Test] + public function it_fires_morphedByManyToggling_and_morphedByManyToggled(): void { Event::fake(); @@ -154,8 +155,8 @@ function ($event, $callback) use ($post, $tag) { ); } - /** @test */ - public function it_fires_morphedByManyUpdatingExistingPivot_and_morphedByManyUpdatedExistingPivot() + #[Test] + public function it_fires_morphedByManyUpdatingExistingPivot_and_morphedByManyUpdatedExistingPivot(): void { Event::fake(); diff --git a/tests/Feature/HasOneEventsTest.php b/tests/Feature/HasOneEventsTest.php index 713c3ca..4ec1efb 100644 --- a/tests/Feature/HasOneEventsTest.php +++ b/tests/Feature/HasOneEventsTest.php @@ -2,12 +2,13 @@ namespace Chelout\RelationshipEvents\Tests\Feature; +use PHPUnit\Framework\Attributes\Test; use Chelout\RelationshipEvents\Tests\Stubs\Profile; use Chelout\RelationshipEvents\Tests\Stubs\User; use Chelout\RelationshipEvents\Tests\TestCase; use Illuminate\Support\Facades\Event; -class HasOneEventsTest extends TestCase +final class HasOneEventsTest extends TestCase { public function setup(): void { @@ -17,8 +18,8 @@ public function setup(): void Profile::setupTable(); } - /** @test */ - public function it_fires_hasOneCreating_and_hasOneCreated_when_a_belonged_model_created() + #[Test] + public function it_fires_hasOneCreating_and_hasOneCreated_when_a_belonged_model_created(): void { Event::fake(); @@ -39,8 +40,8 @@ function ($event, $callback) use ($user, $profile) { ); } - /** @test */ - public function it_fires_hasOneSaving_and_hasOneSaved_when_a_belonged_model_saved() + #[Test] + public function it_fires_hasOneSaving_and_hasOneSaved_when_a_belonged_model_saved(): void { Event::fake(); @@ -61,8 +62,8 @@ function ($event, $callback) use ($user, $profile) { ); } - /** @test */ - public function it_fires_hasOneUpdating_and_hasOneUpdated_when_a_belonged_model_updated() + #[Test] + public function it_fires_hasOneUpdating_and_hasOneUpdated_when_a_belonged_model_updated(): void { Event::fake();