From 3c3a07accb2827c181f1fd7988435b3a7904149c Mon Sep 17 00:00:00 2001 From: Shift Date: Fri, 15 Mar 2024 10:23:35 +0000 Subject: [PATCH 1/4] Adopt PHP attributes in test classes --- tests/Feature/HasBelongsToEventsTest.php | 7 ++++--- tests/Feature/HasBelongsToManyEventsTest.php | 11 ++++++----- tests/Feature/HasManyEventsTest.php | 7 ++++--- tests/Feature/HasMorphManyEventsTest.php | 7 ++++--- tests/Feature/HasMorphOneEventsTest.php | 7 ++++--- tests/Feature/HasMorphToEventsTest.php | 7 ++++--- tests/Feature/HasMorphToManyEventsTest.php | 9 +++++---- tests/Feature/HasMorphedByManyEventsTest.php | 15 ++++++++------- tests/Feature/HasOneEventsTest.php | 7 ++++--- 9 files changed, 43 insertions(+), 34 deletions(-) diff --git a/tests/Feature/HasBelongsToEventsTest.php b/tests/Feature/HasBelongsToEventsTest.php index f7c775b..12ba8df 100644 --- a/tests/Feature/HasBelongsToEventsTest.php +++ b/tests/Feature/HasBelongsToEventsTest.php @@ -2,6 +2,7 @@ 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; @@ -17,7 +18,7 @@ public function setup(): void Profile::setupTable(); } - /** @test */ + #[Test] public function it_fires_belongsToAssociating_and_belongsToAssociated_when_a_model_associated() { Event::fake(); @@ -39,7 +40,7 @@ function ($event, $callback) use ($user, $profile) { ); } - /** @test */ + #[Test] public function it_fires_belongsToDissociating_and_belongsToDissociated_when_a_model_dissociated() { Event::fake(); @@ -62,7 +63,7 @@ function ($event, $callback) use ($user, $profile) { ); } - /** @test */ + #[Test] public function it_fires_belongsToUpdating_and_belongsToUpdated_when_a_parent_model_updated() { Event::fake(); diff --git a/tests/Feature/HasBelongsToManyEventsTest.php b/tests/Feature/HasBelongsToManyEventsTest.php index be3ba76..9c68e5f 100644 --- a/tests/Feature/HasBelongsToManyEventsTest.php +++ b/tests/Feature/HasBelongsToManyEventsTest.php @@ -2,6 +2,7 @@ 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; @@ -17,7 +18,7 @@ public function setup(): void Role::setupTable(); } - /** @test */ + #[Test] public function it_fires_belongsToManyAttaching_and_belongsToManyAttached_when_a_model_attached() { Event::fake(); @@ -40,7 +41,7 @@ function ($event, $callback) use ($user, $role) { ); } - /** @test */ + #[Test] public function it_fires_belongsToManyDetaching_and_belongsToManyDetached_when_a_model_detached() { Event::fake(); @@ -64,7 +65,7 @@ function ($event, $callback) use ($user, $role) { ); } - /** @test */ + #[Test] public function it_fires_belongsToManySyncing_and_belongsToManySynced_when_a_model_synced() { Event::fake(); @@ -87,7 +88,7 @@ function ($event, $callback) use ($user, $role) { ); } - /** @test */ + #[Test] public function it_fires_belongsToManyToggling_and_belongsToManyToggled_when_a_model_toggled() { Event::fake(); @@ -110,7 +111,7 @@ function ($event, $callback) use ($user, $role) { ); } - /** @test */ + #[Test] public function it_fires_belongsToManyUpdatingExistingPivot_and_belongsToManyUpdatedExistingPivot_when_updaing_pivot_table() { Event::fake(); diff --git a/tests/Feature/HasManyEventsTest.php b/tests/Feature/HasManyEventsTest.php index c36eeeb..9929f86 100644 --- a/tests/Feature/HasManyEventsTest.php +++ b/tests/Feature/HasManyEventsTest.php @@ -2,6 +2,7 @@ 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; @@ -17,7 +18,7 @@ public function setup(): void Post::setupTable(); } - /** @test */ + #[Test] public function it_fires_hasManyCreating_and_hasManyCreated_when_belonged_model_with_many_created() { Event::fake(); @@ -39,7 +40,7 @@ function ($event, $callback) use ($user, $post) { ); } - /** @test */ + #[Test] public function it_fires_hasManySaving_and_hasManySaved_when_belonged_model_with_many_saved() { Event::fake(); @@ -61,7 +62,7 @@ function ($event, $callback) use ($user, $post) { ); } - /** @test */ + #[Test] public function it_fires_hasManyUpdating_and_hasManyUpdated_when_belonged_model_with_many_updated() { Event::fake(); diff --git a/tests/Feature/HasMorphManyEventsTest.php b/tests/Feature/HasMorphManyEventsTest.php index f030c9c..884fcb1 100644 --- a/tests/Feature/HasMorphManyEventsTest.php +++ b/tests/Feature/HasMorphManyEventsTest.php @@ -2,6 +2,7 @@ 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; @@ -17,7 +18,7 @@ public function setup(): void Comment::setupTable(); } - /** @test */ + #[Test] public function it_fires_morphManyCreating_and_morphManyCreated_when_belonged_model_with_morph_many_created() { Event::fake(); @@ -39,7 +40,7 @@ function ($event, $callback) use ($post, $comment) { ); } - /** @test */ + #[Test] public function it_fires_morphManySaving_and_morphManySaved_when_belonged_model_with_morph_many_saved() { Event::fake(); @@ -61,7 +62,7 @@ function ($event, $callback) use ($post, $comment) { ); } - /** @test */ + #[Test] public function it_fires_morphManyUpdating_and_morphManyUpdated_when_belonged_model_with_morph_many_updated() { Event::fake(); diff --git a/tests/Feature/HasMorphOneEventsTest.php b/tests/Feature/HasMorphOneEventsTest.php index f858e0d..89e4cf3 100644 --- a/tests/Feature/HasMorphOneEventsTest.php +++ b/tests/Feature/HasMorphOneEventsTest.php @@ -2,6 +2,7 @@ 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; @@ -17,7 +18,7 @@ public function setup(): void Address::setupTable(); } - /** @test */ + #[Test] public function it_fires_morphOneCreating_and_morphOneCreated_when_belonged_model_with_morph_one_created() { Event::fake(); @@ -39,7 +40,7 @@ function ($event, $callback) use ($user, $address) { ); } - /** @test */ + #[Test] public function it_fires_morphOneSaving_and_morphOneSaved_when_belonged_model_with_morph_one_saved() { Event::fake(); @@ -61,7 +62,7 @@ function ($event, $callback) use ($user, $address) { ); } - /** @test */ + #[Test] public function it_fires_morphOneUpdating_and_morphOneUpdated_when_belonged_model_with_morph_one_updated() { Event::fake(); diff --git a/tests/Feature/HasMorphToEventsTest.php b/tests/Feature/HasMorphToEventsTest.php index a4d72eb..69918ee 100644 --- a/tests/Feature/HasMorphToEventsTest.php +++ b/tests/Feature/HasMorphToEventsTest.php @@ -2,6 +2,7 @@ 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; @@ -17,7 +18,7 @@ public function setup(): void Comment::setupTable(); } - /** @test */ + #[Test] public function it_fires_morphToAssociating_and_morphToAssociated() { Event::fake(); @@ -40,7 +41,7 @@ function ($event, $callback) use ($post, $comment) { ); } - /** @test */ + #[Test] public function it_fires_morphToDissociating_and_morphToDissociated() { Event::fake(); @@ -64,7 +65,7 @@ function ($event, $callback) use ($post, $comment) { ); } - /** @test */ + #[Test] public function it_fires_morphToUpdating_and_morphToUpdated() { Event::fake(); diff --git a/tests/Feature/HasMorphToManyEventsTest.php b/tests/Feature/HasMorphToManyEventsTest.php index e6031c1..33a1f39 100644 --- a/tests/Feature/HasMorphToManyEventsTest.php +++ b/tests/Feature/HasMorphToManyEventsTest.php @@ -2,6 +2,7 @@ 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; @@ -17,7 +18,7 @@ public function setup(): void Tag::setupTable(); } - /** @test */ + #[Test] public function it_fires_morphToManyAttaching_and_morphToManyAttached() { Event::fake(); @@ -40,7 +41,7 @@ function ($event, $callback) use ($post, $tag) { ); } - /** @test */ + #[Test] public function it_fires_morphToManyDetaching_and_morphToManyDetached() { Event::fake(); @@ -64,7 +65,7 @@ function ($event, $callback) use ($post, $tag) { ); } - /** @test */ + #[Test] public function it_fires_morphToManySyncing_and_morphToManySynced() { Event::fake(); @@ -87,7 +88,7 @@ function ($event, $callback) use ($post, $tag) { ); } - /** @test */ + #[Test] public function it_fires_morphToManyUpdatingExistingPivot_and_morphToManyUpdatedExistingPivot() { Event::fake(); diff --git a/tests/Feature/HasMorphedByManyEventsTest.php b/tests/Feature/HasMorphedByManyEventsTest.php index e72234a..f40d0db 100644 --- a/tests/Feature/HasMorphedByManyEventsTest.php +++ b/tests/Feature/HasMorphedByManyEventsTest.php @@ -2,6 +2,7 @@ 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; @@ -17,7 +18,7 @@ public function setup(): void Tag::setupTable(); } - /** @test */ + #[Test] public function it_fires_morphedByManyAttaching_and_morphedByManyAttached_when_created() { Event::fake(); @@ -39,7 +40,7 @@ function ($event, $callback) use ($post, $tag) { ); } - /** @test */ + #[Test] public function it_fires_morphedByManyAttaching_and_morphedByManyAttached_when_saved() { Event::fake(); @@ -61,7 +62,7 @@ function ($event, $callback) use ($post, $tag) { ); } - /** @test */ + #[Test] public function it_fires_morphedByManyAttaching_and_morphedByManyAttached_when_attached() { Event::fake(); @@ -84,7 +85,7 @@ function ($event, $callback) use ($post, $tag) { ); } - /** @test */ + #[Test] public function it_fires_morphedByManyDetaching_and_morphedByManyDetached_when_detached() { Event::fake(); @@ -108,7 +109,7 @@ function ($event, $callback) use ($post, $tag) { ); } - /** @test */ + #[Test] public function it_fires_morphedByManySyncing_and_morphedByManySynced() { Event::fake(); @@ -131,7 +132,7 @@ function ($event, $callback) use ($post, $tag) { ); } - /** @test */ + #[Test] public function it_fires_morphedByManyToggling_and_morphedByManyToggled() { Event::fake(); @@ -154,7 +155,7 @@ function ($event, $callback) use ($post, $tag) { ); } - /** @test */ + #[Test] public function it_fires_morphedByManyUpdatingExistingPivot_and_morphedByManyUpdatedExistingPivot() { Event::fake(); diff --git a/tests/Feature/HasOneEventsTest.php b/tests/Feature/HasOneEventsTest.php index 713c3ca..765647c 100644 --- a/tests/Feature/HasOneEventsTest.php +++ b/tests/Feature/HasOneEventsTest.php @@ -2,6 +2,7 @@ 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; @@ -17,7 +18,7 @@ public function setup(): void Profile::setupTable(); } - /** @test */ + #[Test] public function it_fires_hasOneCreating_and_hasOneCreated_when_a_belonged_model_created() { Event::fake(); @@ -39,7 +40,7 @@ function ($event, $callback) use ($user, $profile) { ); } - /** @test */ + #[Test] public function it_fires_hasOneSaving_and_hasOneSaved_when_a_belonged_model_saved() { Event::fake(); @@ -61,7 +62,7 @@ function ($event, $callback) use ($user, $profile) { ); } - /** @test */ + #[Test] public function it_fires_hasOneUpdating_and_hasOneUpdated_when_a_belonged_model_updated() { Event::fake(); From de3a5fc041b91fe5ce95c771ed8f15dbe9f0cb59 Mon Sep 17 00:00:00 2001 From: Shift Date: Fri, 15 Mar 2024 10:23:35 +0000 Subject: [PATCH 2/4] Add return types to test methods --- tests/Feature/HasBelongsToEventsTest.php | 6 +++--- tests/Feature/HasBelongsToManyEventsTest.php | 10 +++++----- tests/Feature/HasManyEventsTest.php | 6 +++--- tests/Feature/HasMorphManyEventsTest.php | 6 +++--- tests/Feature/HasMorphOneEventsTest.php | 6 +++--- tests/Feature/HasMorphToEventsTest.php | 6 +++--- tests/Feature/HasMorphToManyEventsTest.php | 8 ++++---- tests/Feature/HasMorphedByManyEventsTest.php | 14 +++++++------- tests/Feature/HasOneEventsTest.php | 6 +++--- 9 files changed, 34 insertions(+), 34 deletions(-) diff --git a/tests/Feature/HasBelongsToEventsTest.php b/tests/Feature/HasBelongsToEventsTest.php index 12ba8df..0785549 100644 --- a/tests/Feature/HasBelongsToEventsTest.php +++ b/tests/Feature/HasBelongsToEventsTest.php @@ -19,7 +19,7 @@ public function setup(): void } #[Test] - public function it_fires_belongsToAssociating_and_belongsToAssociated_when_a_model_associated() + public function it_fires_belongsToAssociating_and_belongsToAssociated_when_a_model_associated(): void { Event::fake(); @@ -41,7 +41,7 @@ function ($event, $callback) use ($user, $profile) { } #[Test] - public function it_fires_belongsToDissociating_and_belongsToDissociated_when_a_model_dissociated() + public function it_fires_belongsToDissociating_and_belongsToDissociated_when_a_model_dissociated(): void { Event::fake(); @@ -64,7 +64,7 @@ function ($event, $callback) use ($user, $profile) { } #[Test] - public function it_fires_belongsToUpdating_and_belongsToUpdated_when_a_parent_model_updated() + 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 9c68e5f..70fab3f 100644 --- a/tests/Feature/HasBelongsToManyEventsTest.php +++ b/tests/Feature/HasBelongsToManyEventsTest.php @@ -19,7 +19,7 @@ public function setup(): void } #[Test] - public function it_fires_belongsToManyAttaching_and_belongsToManyAttached_when_a_model_attached() + public function it_fires_belongsToManyAttaching_and_belongsToManyAttached_when_a_model_attached(): void { Event::fake(); @@ -42,7 +42,7 @@ function ($event, $callback) use ($user, $role) { } #[Test] - public function it_fires_belongsToManyDetaching_and_belongsToManyDetached_when_a_model_detached() + public function it_fires_belongsToManyDetaching_and_belongsToManyDetached_when_a_model_detached(): void { Event::fake(); @@ -66,7 +66,7 @@ function ($event, $callback) use ($user, $role) { } #[Test] - public function it_fires_belongsToManySyncing_and_belongsToManySynced_when_a_model_synced() + public function it_fires_belongsToManySyncing_and_belongsToManySynced_when_a_model_synced(): void { Event::fake(); @@ -89,7 +89,7 @@ function ($event, $callback) use ($user, $role) { } #[Test] - public function it_fires_belongsToManyToggling_and_belongsToManyToggled_when_a_model_toggled() + public function it_fires_belongsToManyToggling_and_belongsToManyToggled_when_a_model_toggled(): void { Event::fake(); @@ -112,7 +112,7 @@ function ($event, $callback) use ($user, $role) { } #[Test] - public function it_fires_belongsToManyUpdatingExistingPivot_and_belongsToManyUpdatedExistingPivot_when_updaing_pivot_table() + 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 9929f86..b179772 100644 --- a/tests/Feature/HasManyEventsTest.php +++ b/tests/Feature/HasManyEventsTest.php @@ -19,7 +19,7 @@ public function setup(): void } #[Test] - public function it_fires_hasManyCreating_and_hasManyCreated_when_belonged_model_with_many_created() + public function it_fires_hasManyCreating_and_hasManyCreated_when_belonged_model_with_many_created(): void { Event::fake(); @@ -41,7 +41,7 @@ function ($event, $callback) use ($user, $post) { } #[Test] - public function it_fires_hasManySaving_and_hasManySaved_when_belonged_model_with_many_saved() + public function it_fires_hasManySaving_and_hasManySaved_when_belonged_model_with_many_saved(): void { Event::fake(); @@ -63,7 +63,7 @@ function ($event, $callback) use ($user, $post) { } #[Test] - public function it_fires_hasManyUpdating_and_hasManyUpdated_when_belonged_model_with_many_updated() + 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 884fcb1..26665c0 100644 --- a/tests/Feature/HasMorphManyEventsTest.php +++ b/tests/Feature/HasMorphManyEventsTest.php @@ -19,7 +19,7 @@ public function setup(): void } #[Test] - public function it_fires_morphManyCreating_and_morphManyCreated_when_belonged_model_with_morph_many_created() + public function it_fires_morphManyCreating_and_morphManyCreated_when_belonged_model_with_morph_many_created(): void { Event::fake(); @@ -41,7 +41,7 @@ function ($event, $callback) use ($post, $comment) { } #[Test] - public function it_fires_morphManySaving_and_morphManySaved_when_belonged_model_with_morph_many_saved() + public function it_fires_morphManySaving_and_morphManySaved_when_belonged_model_with_morph_many_saved(): void { Event::fake(); @@ -63,7 +63,7 @@ function ($event, $callback) use ($post, $comment) { } #[Test] - public function it_fires_morphManyUpdating_and_morphManyUpdated_when_belonged_model_with_morph_many_updated() + 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 89e4cf3..534a9f4 100644 --- a/tests/Feature/HasMorphOneEventsTest.php +++ b/tests/Feature/HasMorphOneEventsTest.php @@ -19,7 +19,7 @@ public function setup(): void } #[Test] - public function it_fires_morphOneCreating_and_morphOneCreated_when_belonged_model_with_morph_one_created() + public function it_fires_morphOneCreating_and_morphOneCreated_when_belonged_model_with_morph_one_created(): void { Event::fake(); @@ -41,7 +41,7 @@ function ($event, $callback) use ($user, $address) { } #[Test] - public function it_fires_morphOneSaving_and_morphOneSaved_when_belonged_model_with_morph_one_saved() + public function it_fires_morphOneSaving_and_morphOneSaved_when_belonged_model_with_morph_one_saved(): void { Event::fake(); @@ -63,7 +63,7 @@ function ($event, $callback) use ($user, $address) { } #[Test] - public function it_fires_morphOneUpdating_and_morphOneUpdated_when_belonged_model_with_morph_one_updated() + 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 69918ee..36c0864 100644 --- a/tests/Feature/HasMorphToEventsTest.php +++ b/tests/Feature/HasMorphToEventsTest.php @@ -19,7 +19,7 @@ public function setup(): void } #[Test] - public function it_fires_morphToAssociating_and_morphToAssociated() + public function it_fires_morphToAssociating_and_morphToAssociated(): void { Event::fake(); @@ -42,7 +42,7 @@ function ($event, $callback) use ($post, $comment) { } #[Test] - public function it_fires_morphToDissociating_and_morphToDissociated() + public function it_fires_morphToDissociating_and_morphToDissociated(): void { Event::fake(); @@ -66,7 +66,7 @@ function ($event, $callback) use ($post, $comment) { } #[Test] - public function it_fires_morphToUpdating_and_morphToUpdated() + public function it_fires_morphToUpdating_and_morphToUpdated(): void { Event::fake(); diff --git a/tests/Feature/HasMorphToManyEventsTest.php b/tests/Feature/HasMorphToManyEventsTest.php index 33a1f39..66a607e 100644 --- a/tests/Feature/HasMorphToManyEventsTest.php +++ b/tests/Feature/HasMorphToManyEventsTest.php @@ -19,7 +19,7 @@ public function setup(): void } #[Test] - public function it_fires_morphToManyAttaching_and_morphToManyAttached() + public function it_fires_morphToManyAttaching_and_morphToManyAttached(): void { Event::fake(); @@ -42,7 +42,7 @@ function ($event, $callback) use ($post, $tag) { } #[Test] - public function it_fires_morphToManyDetaching_and_morphToManyDetached() + public function it_fires_morphToManyDetaching_and_morphToManyDetached(): void { Event::fake(); @@ -66,7 +66,7 @@ function ($event, $callback) use ($post, $tag) { } #[Test] - public function it_fires_morphToManySyncing_and_morphToManySynced() + public function it_fires_morphToManySyncing_and_morphToManySynced(): void { Event::fake(); @@ -89,7 +89,7 @@ function ($event, $callback) use ($post, $tag) { } #[Test] - public function it_fires_morphToManyUpdatingExistingPivot_and_morphToManyUpdatedExistingPivot() + public function it_fires_morphToManyUpdatingExistingPivot_and_morphToManyUpdatedExistingPivot(): void { Event::fake(); diff --git a/tests/Feature/HasMorphedByManyEventsTest.php b/tests/Feature/HasMorphedByManyEventsTest.php index f40d0db..624c908 100644 --- a/tests/Feature/HasMorphedByManyEventsTest.php +++ b/tests/Feature/HasMorphedByManyEventsTest.php @@ -19,7 +19,7 @@ public function setup(): void } #[Test] - public function it_fires_morphedByManyAttaching_and_morphedByManyAttached_when_created() + public function it_fires_morphedByManyAttaching_and_morphedByManyAttached_when_created(): void { Event::fake(); @@ -41,7 +41,7 @@ function ($event, $callback) use ($post, $tag) { } #[Test] - public function it_fires_morphedByManyAttaching_and_morphedByManyAttached_when_saved() + public function it_fires_morphedByManyAttaching_and_morphedByManyAttached_when_saved(): void { Event::fake(); @@ -63,7 +63,7 @@ function ($event, $callback) use ($post, $tag) { } #[Test] - public function it_fires_morphedByManyAttaching_and_morphedByManyAttached_when_attached() + public function it_fires_morphedByManyAttaching_and_morphedByManyAttached_when_attached(): void { Event::fake(); @@ -86,7 +86,7 @@ function ($event, $callback) use ($post, $tag) { } #[Test] - public function it_fires_morphedByManyDetaching_and_morphedByManyDetached_when_detached() + public function it_fires_morphedByManyDetaching_and_morphedByManyDetached_when_detached(): void { Event::fake(); @@ -110,7 +110,7 @@ function ($event, $callback) use ($post, $tag) { } #[Test] - public function it_fires_morphedByManySyncing_and_morphedByManySynced() + public function it_fires_morphedByManySyncing_and_morphedByManySynced(): void { Event::fake(); @@ -133,7 +133,7 @@ function ($event, $callback) use ($post, $tag) { } #[Test] - public function it_fires_morphedByManyToggling_and_morphedByManyToggled() + public function it_fires_morphedByManyToggling_and_morphedByManyToggled(): void { Event::fake(); @@ -156,7 +156,7 @@ function ($event, $callback) use ($post, $tag) { } #[Test] - public function it_fires_morphedByManyUpdatingExistingPivot_and_morphedByManyUpdatedExistingPivot() + public function it_fires_morphedByManyUpdatingExistingPivot_and_morphedByManyUpdatedExistingPivot(): void { Event::fake(); diff --git a/tests/Feature/HasOneEventsTest.php b/tests/Feature/HasOneEventsTest.php index 765647c..ecd6c30 100644 --- a/tests/Feature/HasOneEventsTest.php +++ b/tests/Feature/HasOneEventsTest.php @@ -19,7 +19,7 @@ public function setup(): void } #[Test] - public function it_fires_hasOneCreating_and_hasOneCreated_when_a_belonged_model_created() + public function it_fires_hasOneCreating_and_hasOneCreated_when_a_belonged_model_created(): void { Event::fake(); @@ -41,7 +41,7 @@ function ($event, $callback) use ($user, $profile) { } #[Test] - public function it_fires_hasOneSaving_and_hasOneSaved_when_a_belonged_model_saved() + public function it_fires_hasOneSaving_and_hasOneSaved_when_a_belonged_model_saved(): void { Event::fake(); @@ -63,7 +63,7 @@ function ($event, $callback) use ($user, $profile) { } #[Test] - public function it_fires_hasOneUpdating_and_hasOneUpdated_when_a_belonged_model_updated() + public function it_fires_hasOneUpdating_and_hasOneUpdated_when_a_belonged_model_updated(): void { Event::fake(); From 2a3c1fb8b6a005029ce829f628d524b6ea0c78f7 Mon Sep 17 00:00:00 2001 From: Shift Date: Fri, 15 Mar 2024 10:23:35 +0000 Subject: [PATCH 3/4] Define test classes as `final` --- tests/Feature/HasBelongsToEventsTest.php | 2 +- tests/Feature/HasBelongsToManyEventsTest.php | 2 +- tests/Feature/HasManyEventsTest.php | 2 +- tests/Feature/HasMorphManyEventsTest.php | 2 +- tests/Feature/HasMorphOneEventsTest.php | 2 +- tests/Feature/HasMorphToEventsTest.php | 2 +- tests/Feature/HasMorphToManyEventsTest.php | 2 +- tests/Feature/HasMorphedByManyEventsTest.php | 2 +- tests/Feature/HasOneEventsTest.php | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/Feature/HasBelongsToEventsTest.php b/tests/Feature/HasBelongsToEventsTest.php index 0785549..ba3c77c 100644 --- a/tests/Feature/HasBelongsToEventsTest.php +++ b/tests/Feature/HasBelongsToEventsTest.php @@ -8,7 +8,7 @@ use Chelout\RelationshipEvents\Tests\TestCase; use Illuminate\Support\Facades\Event; -class HasBelongsToEventsTest extends TestCase +final class HasBelongsToEventsTest extends TestCase { public function setup(): void { diff --git a/tests/Feature/HasBelongsToManyEventsTest.php b/tests/Feature/HasBelongsToManyEventsTest.php index 70fab3f..54c7576 100644 --- a/tests/Feature/HasBelongsToManyEventsTest.php +++ b/tests/Feature/HasBelongsToManyEventsTest.php @@ -8,7 +8,7 @@ use Chelout\RelationshipEvents\Tests\TestCase; use Illuminate\Support\Facades\Event; -class HasBelongsToManyEventsTest extends TestCase +final class HasBelongsToManyEventsTest extends TestCase { public function setup(): void { diff --git a/tests/Feature/HasManyEventsTest.php b/tests/Feature/HasManyEventsTest.php index b179772..f4ce23c 100644 --- a/tests/Feature/HasManyEventsTest.php +++ b/tests/Feature/HasManyEventsTest.php @@ -8,7 +8,7 @@ use Chelout\RelationshipEvents\Tests\TestCase; use Illuminate\Support\Facades\Event; -class HasManyEventsTest extends TestCase +final class HasManyEventsTest extends TestCase { public function setup(): void { diff --git a/tests/Feature/HasMorphManyEventsTest.php b/tests/Feature/HasMorphManyEventsTest.php index 26665c0..fdcad50 100644 --- a/tests/Feature/HasMorphManyEventsTest.php +++ b/tests/Feature/HasMorphManyEventsTest.php @@ -8,7 +8,7 @@ use Chelout\RelationshipEvents\Tests\TestCase; use Illuminate\Support\Facades\Event; -class HasMorphManyEventsTest extends TestCase +final class HasMorphManyEventsTest extends TestCase { public function setup(): void { diff --git a/tests/Feature/HasMorphOneEventsTest.php b/tests/Feature/HasMorphOneEventsTest.php index 534a9f4..9665725 100644 --- a/tests/Feature/HasMorphOneEventsTest.php +++ b/tests/Feature/HasMorphOneEventsTest.php @@ -8,7 +8,7 @@ use Chelout\RelationshipEvents\Tests\TestCase; use Illuminate\Support\Facades\Event; -class HasMorphOneEventsTest extends TestCase +final class HasMorphOneEventsTest extends TestCase { public function setup(): void { diff --git a/tests/Feature/HasMorphToEventsTest.php b/tests/Feature/HasMorphToEventsTest.php index 36c0864..3eeb455 100644 --- a/tests/Feature/HasMorphToEventsTest.php +++ b/tests/Feature/HasMorphToEventsTest.php @@ -8,7 +8,7 @@ use Chelout\RelationshipEvents\Tests\TestCase; use Illuminate\Support\Facades\Event; -class HasMorphToEventsTest extends TestCase +final class HasMorphToEventsTest extends TestCase { public function setup(): void { diff --git a/tests/Feature/HasMorphToManyEventsTest.php b/tests/Feature/HasMorphToManyEventsTest.php index 66a607e..d492403 100644 --- a/tests/Feature/HasMorphToManyEventsTest.php +++ b/tests/Feature/HasMorphToManyEventsTest.php @@ -8,7 +8,7 @@ use Chelout\RelationshipEvents\Tests\TestCase; use Illuminate\Support\Facades\Event; -class HasMorphToManyEventsTest extends TestCase +final class HasMorphToManyEventsTest extends TestCase { public function setup(): void { diff --git a/tests/Feature/HasMorphedByManyEventsTest.php b/tests/Feature/HasMorphedByManyEventsTest.php index 624c908..e90f131 100644 --- a/tests/Feature/HasMorphedByManyEventsTest.php +++ b/tests/Feature/HasMorphedByManyEventsTest.php @@ -8,7 +8,7 @@ use Chelout\RelationshipEvents\Tests\TestCase; use Illuminate\Support\Facades\Event; -class HasMorphedByManyEventsTest extends TestCase +final class HasMorphedByManyEventsTest extends TestCase { public function setup(): void { diff --git a/tests/Feature/HasOneEventsTest.php b/tests/Feature/HasOneEventsTest.php index ecd6c30..4ec1efb 100644 --- a/tests/Feature/HasOneEventsTest.php +++ b/tests/Feature/HasOneEventsTest.php @@ -8,7 +8,7 @@ use Chelout\RelationshipEvents\Tests\TestCase; use Illuminate\Support\Facades\Event; -class HasOneEventsTest extends TestCase +final class HasOneEventsTest extends TestCase { public function setup(): void { From 76ede34ff5bbceb5e158494ae7eb0e0acaf55581 Mon Sep 17 00:00:00 2001 From: Viacheslav Ostrovskii Date: Fri, 15 Mar 2024 12:29:28 +0200 Subject: [PATCH 4/4] Update phpunit configuration --- phpunit.xml.dist | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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 + +