From 243789357b9b6d669e9a0ee436c44202a3a43301 Mon Sep 17 00:00:00 2001 From: Shift Date: Fri, 8 Mar 2024 18:41:00 +0000 Subject: [PATCH 1/3] Set return type of base TestCase methods From the [PHPUnit 8 release notes][1], the `TestCase` methods below now declare a `void` return type: - `setUpBeforeClass()` - `setUp()` - `assertPreConditions()` - `assertPostConditions()` - `tearDown()` - `tearDownAfterClass()` - `onNotSuccessfulTest()` [1]: https://phpunit.de/announcements/phpunit-8.html --- .../Feature/Http/Controllers/Account/ProfileControllerTest.php | 2 +- .../Feature/Http/Controllers/Admin/AdminBadgeControllerTest.php | 2 +- .../Controllers/Admin/AdminBadgeDataTablesControllerTest.php | 2 +- .../Http/Controllers/Admin/AdminDashboardControllerTest.php | 2 +- .../Feature/Http/Controllers/Admin/AdminLevelControllerTest.php | 2 +- .../Controllers/Admin/AdminLevelDataTablesControllerTest.php | 2 +- .../Http/Controllers/Admin/AdminQuestionControllerTest.php | 2 +- .../Controllers/Admin/AdminQuestionDataTablesControllerTest.php | 2 +- .../Http/Controllers/Admin/AdminRewardControllerTest.php | 2 +- .../Feature/Http/Controllers/Admin/AdminUserControllerTest.php | 2 +- .../Controllers/Admin/AdminUserDataTablesControllerTest.php | 2 +- tests/Feature/Http/Controllers/QuestionControllerTest.php | 2 +- .../Feature/Http/Controllers/ShowUserProfileControllerTest.php | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/Feature/Http/Controllers/Account/ProfileControllerTest.php b/tests/Feature/Http/Controllers/Account/ProfileControllerTest.php index 43893d83..7e0fe3dd 100644 --- a/tests/Feature/Http/Controllers/Account/ProfileControllerTest.php +++ b/tests/Feature/Http/Controllers/Account/ProfileControllerTest.php @@ -40,7 +40,7 @@ class ProfileControllerTest extends TestCase { private User $user; - public function setUp(): void + protected function setUp(): void { parent::setUp(); diff --git a/tests/Feature/Http/Controllers/Admin/AdminBadgeControllerTest.php b/tests/Feature/Http/Controllers/Admin/AdminBadgeControllerTest.php index 736010cc..91bd7be3 100644 --- a/tests/Feature/Http/Controllers/Admin/AdminBadgeControllerTest.php +++ b/tests/Feature/Http/Controllers/Admin/AdminBadgeControllerTest.php @@ -35,7 +35,7 @@ class AdminBadgeControllerTest extends TestCase { private User $user; - public function setUp(): void + protected function setUp(): void { parent::setUp(); diff --git a/tests/Feature/Http/Controllers/Admin/AdminBadgeDataTablesControllerTest.php b/tests/Feature/Http/Controllers/Admin/AdminBadgeDataTablesControllerTest.php index da9c871b..dcdfbfe5 100644 --- a/tests/Feature/Http/Controllers/Admin/AdminBadgeDataTablesControllerTest.php +++ b/tests/Feature/Http/Controllers/Admin/AdminBadgeDataTablesControllerTest.php @@ -34,7 +34,7 @@ class AdminBadgeDataTablesControllerTest extends TestCase { private User $user; - public function setUp(): void + protected function setUp(): void { parent::setUp(); diff --git a/tests/Feature/Http/Controllers/Admin/AdminDashboardControllerTest.php b/tests/Feature/Http/Controllers/Admin/AdminDashboardControllerTest.php index 5f77c292..7d5a4ec3 100644 --- a/tests/Feature/Http/Controllers/Admin/AdminDashboardControllerTest.php +++ b/tests/Feature/Http/Controllers/Admin/AdminDashboardControllerTest.php @@ -30,7 +30,7 @@ class AdminDashboardControllerTest extends TestCase { - public function setUp(): void + protected function setUp(): void { parent::setUp(); diff --git a/tests/Feature/Http/Controllers/Admin/AdminLevelControllerTest.php b/tests/Feature/Http/Controllers/Admin/AdminLevelControllerTest.php index b33cf940..11f92d8e 100644 --- a/tests/Feature/Http/Controllers/Admin/AdminLevelControllerTest.php +++ b/tests/Feature/Http/Controllers/Admin/AdminLevelControllerTest.php @@ -35,7 +35,7 @@ class AdminLevelControllerTest extends TestCase { private User $user; - public function setUp(): void + protected function setUp(): void { parent::setUp(); diff --git a/tests/Feature/Http/Controllers/Admin/AdminLevelDataTablesControllerTest.php b/tests/Feature/Http/Controllers/Admin/AdminLevelDataTablesControllerTest.php index aff36aae..2197139d 100644 --- a/tests/Feature/Http/Controllers/Admin/AdminLevelDataTablesControllerTest.php +++ b/tests/Feature/Http/Controllers/Admin/AdminLevelDataTablesControllerTest.php @@ -34,7 +34,7 @@ class AdminLevelDataTablesControllerTest extends TestCase { private User $user; - public function setUp(): void + protected function setUp(): void { parent::setUp(); diff --git a/tests/Feature/Http/Controllers/Admin/AdminQuestionControllerTest.php b/tests/Feature/Http/Controllers/Admin/AdminQuestionControllerTest.php index da50f9f6..f6b0af97 100644 --- a/tests/Feature/Http/Controllers/Admin/AdminQuestionControllerTest.php +++ b/tests/Feature/Http/Controllers/Admin/AdminQuestionControllerTest.php @@ -33,7 +33,7 @@ class AdminQuestionControllerTest extends TestCase { - public function setUp(): void + protected function setUp(): void { parent::setUp(); diff --git a/tests/Feature/Http/Controllers/Admin/AdminQuestionDataTablesControllerTest.php b/tests/Feature/Http/Controllers/Admin/AdminQuestionDataTablesControllerTest.php index f7841c51..6fb27bcb 100644 --- a/tests/Feature/Http/Controllers/Admin/AdminQuestionDataTablesControllerTest.php +++ b/tests/Feature/Http/Controllers/Admin/AdminQuestionDataTablesControllerTest.php @@ -34,7 +34,7 @@ class AdminQuestionDataTablesControllerTest extends TestCase { private User $user; - public function setUp(): void + protected function setUp(): void { parent::setUp(); diff --git a/tests/Feature/Http/Controllers/Admin/AdminRewardControllerTest.php b/tests/Feature/Http/Controllers/Admin/AdminRewardControllerTest.php index ef73cdee..bbd4e525 100644 --- a/tests/Feature/Http/Controllers/Admin/AdminRewardControllerTest.php +++ b/tests/Feature/Http/Controllers/Admin/AdminRewardControllerTest.php @@ -38,7 +38,7 @@ class AdminRewardControllerTest extends TestCase private User $user; - public function setUp(): void + protected function setUp(): void { parent::setUp(); diff --git a/tests/Feature/Http/Controllers/Admin/AdminUserControllerTest.php b/tests/Feature/Http/Controllers/Admin/AdminUserControllerTest.php index db11ac8c..d4f6a0d4 100644 --- a/tests/Feature/Http/Controllers/Admin/AdminUserControllerTest.php +++ b/tests/Feature/Http/Controllers/Admin/AdminUserControllerTest.php @@ -34,7 +34,7 @@ class AdminUserControllerTest extends TestCase { private User $user; - public function setUp(): void + protected function setUp(): void { parent::setUp(); diff --git a/tests/Feature/Http/Controllers/Admin/AdminUserDataTablesControllerTest.php b/tests/Feature/Http/Controllers/Admin/AdminUserDataTablesControllerTest.php index e606b33b..e3faa59c 100644 --- a/tests/Feature/Http/Controllers/Admin/AdminUserDataTablesControllerTest.php +++ b/tests/Feature/Http/Controllers/Admin/AdminUserDataTablesControllerTest.php @@ -33,7 +33,7 @@ class AdminUserDataTablesControllerTest extends TestCase { private User $user; - public function setUp(): void + protected function setUp(): void { parent::setUp(); diff --git a/tests/Feature/Http/Controllers/QuestionControllerTest.php b/tests/Feature/Http/Controllers/QuestionControllerTest.php index 3d1d934c..758051f6 100644 --- a/tests/Feature/Http/Controllers/QuestionControllerTest.php +++ b/tests/Feature/Http/Controllers/QuestionControllerTest.php @@ -36,7 +36,7 @@ class QuestionControllerTest extends TestCase { private User $user; - public function setUp(): void + protected function setUp(): void { parent::setUp(); diff --git a/tests/Feature/Http/Controllers/ShowUserProfileControllerTest.php b/tests/Feature/Http/Controllers/ShowUserProfileControllerTest.php index 7ad8af87..eb3c282d 100644 --- a/tests/Feature/Http/Controllers/ShowUserProfileControllerTest.php +++ b/tests/Feature/Http/Controllers/ShowUserProfileControllerTest.php @@ -32,7 +32,7 @@ class ShowUserProfileControllerTest extends TestCase { private User $user; - public function setUp(): void + protected function setUp(): void { parent::setUp(); From 0845a671ab8223d6d734bd159b79823e7918c0d5 Mon Sep 17 00:00:00 2001 From: Shift Date: Fri, 8 Mar 2024 18:41:02 +0000 Subject: [PATCH 2/3] Adopt PHP attributes in test classes --- tests/Feature/Actions/CreateUserTest.php | 3 +- .../Actions/PublishQuestionActionTest.php | 15 +++--- tests/Feature/Auth/RegistrationTest.php | 9 ++-- .../Feature/Auth/SocialAuthenticationTest.php | 3 +- .../PublishScheduledQuestionsTest.php | 7 +-- .../Account/ChangePasswordControllerTest.php | 11 +++-- .../Account/ProfileControllerTest.php | 33 ++++++------- .../Admin/AdminBadgeControllerTest.php | 49 ++++++++----------- .../AdminBadgeDataTablesControllerTest.php | 5 +- .../Admin/AdminDashboardControllerTest.php | 5 +- .../Admin/AdminLevelControllerTest.php | 44 ++++++++--------- .../AdminLevelDataTablesControllerTest.php | 7 +-- .../Admin/AdminQuestionControllerTest.php | 27 +++++----- .../AdminQuestionDataTablesControllerTest.php | 7 +-- .../Admin/AdminRewardControllerTest.php | 28 +++++------ .../Admin/AdminUserControllerTest.php | 48 +++++++++--------- .../AdminUserDataTablesControllerTest.php | 5 +- .../Http/Controllers/HomeControllerTest.php | 3 +- .../Controllers/LeaderBoardControllerTest.php | 3 +- .../MarkNotificationAsReadControllerTest.php | 5 +- .../Controllers/QuestionControllerTest.php | 15 +++--- .../ShowUserProfileControllerTest.php | 5 +- .../Feature/Http/Middleware/OnlyAjaxTest.php | 5 +- .../RedirectIfAuthenticatedTest.php | 5 +- tests/Feature/Libs/Game/GameTest.php | 23 +++++---- .../AddBadgesOnAvatarUploadedTest.php | 7 +-- .../AddBadgesOnProfileUpdatedTest.php | 7 +-- .../AddBadgesOnQuestionAnsweredTest.php | 18 +++---- .../Listeners/AddBadgesOnUserLoggedInTest.php | 11 +++-- tests/Feature/Listeners/AddReputationTest.php | 5 +- .../UpdateCachedUserExperienceTest.php | 7 +-- tests/Feature/Models/BadgeTest.php | 9 ++-- tests/Feature/Models/LevelTest.php | 22 ++++----- tests/Feature/Models/QuestionTest.php | 33 +++++++------ tests/Feature/Models/UserResponseTest.php | 13 +++-- tests/Feature/Models/UserTest.php | 39 ++++++--------- .../Presenters/QuestionPresenterTest.php | 9 ++-- .../Services/SocialAccountServiceTest.php | 9 ++-- .../Services/UsernameGeneratorServiceTest.php | 18 +++---- .../Components/Tags/FormSelectTagsTest.php | 3 +- tests/Unit/Models/LevelTest.php | 3 +- tests/Unit/Models/PointTest.php | 7 +-- tests/Unit/Models/QuestionChoiceTest.php | 7 +-- tests/Unit/Models/QuestionTest.php | 3 +- tests/Unit/Models/UserTest.php | 34 ++++++------- tests/Unit/Rules/UsernameRuleTest.php | 16 +++--- tests/Unit/Services/HashIdServiceTest.php | 7 +-- 47 files changed, 319 insertions(+), 338 deletions(-) diff --git a/tests/Feature/Actions/CreateUserTest.php b/tests/Feature/Actions/CreateUserTest.php index 30c3c276..a65f07cc 100644 --- a/tests/Feature/Actions/CreateUserTest.php +++ b/tests/Feature/Actions/CreateUserTest.php @@ -25,6 +25,7 @@ namespace Tests\Feature\Actions; +use PHPUnit\Framework\Attributes\Test; use Gamify\Actions\CreateUserAction; use Gamify\Models\User; use Gamify\Models\UserProfile; @@ -32,7 +33,7 @@ class CreateUserTest extends TestCase { - /** @test */ + #[Test] public function it_should_create_a_user_with_its_profile(): void { /** @var User $want */ diff --git a/tests/Feature/Actions/PublishQuestionActionTest.php b/tests/Feature/Actions/PublishQuestionActionTest.php index 8390a2a2..7e55bc4d 100644 --- a/tests/Feature/Actions/PublishQuestionActionTest.php +++ b/tests/Feature/Actions/PublishQuestionActionTest.php @@ -25,6 +25,7 @@ namespace Tests\Feature\Actions; +use PHPUnit\Framework\Attributes\Test; use Gamify\Actions\PublishQuestionAction; use Gamify\Events\QuestionPublished; use Gamify\Exceptions\QuestionPublishingException; @@ -35,7 +36,7 @@ class PublishQuestionActionTest extends TestCase { - /** @test */ + #[Test] public function it_triggers_an_event_when_a_question_is_published(): void { /** @var Question $question */ @@ -57,7 +58,7 @@ public function it_triggers_an_event_when_a_question_is_published(): void $this->assertEquals(Question::PUBLISH_STATUS, $question->status); } - /** @test */ + #[Test] public function it_does_not_trigger_an_event_when_a_question_was_already_published(): void { /** @var Question $question */ @@ -78,7 +79,7 @@ public function it_does_not_trigger_an_event_when_a_question_was_already_publish $this->assertEquals(Question::PUBLISH_STATUS, $question->status); } - /** @test */ + #[Test] public function it_throws_an_exception_when_trying_to_publish_a_question_without_at_least_two_choices(): void { $this->withoutExceptionHandling(); @@ -95,7 +96,7 @@ public function it_throws_an_exception_when_trying_to_publish_a_question_without $publisher->execute($question); } - /** @test */ + #[Test] public function it_throws_an_exception_when_trying_to_publish_a_question_without_a_correct_choice(): void { $this->withoutExceptionHandling(); @@ -112,7 +113,7 @@ public function it_throws_an_exception_when_trying_to_publish_a_question_without $publisher->execute($question); } - /** @test */ + #[Test] public function it_publishes_question_when_date_is_on_the_past(): void { /** @var Question $question */ @@ -130,7 +131,7 @@ public function it_publishes_question_when_date_is_on_the_past(): void $this->assertEquals(Question::PUBLISH_STATUS, $question->status); } - /** @test */ + #[Test] public function it_schedules_question_publication_when_date_is_in_the_future(): void { /** @var Question $question */ @@ -148,7 +149,7 @@ public function it_schedules_question_publication_when_date_is_in_the_future(): $this->assertEquals(Question::FUTURE_STATUS, $question->status); } - /** @test */ + #[Test] public function it_does_not_trigger_an_event_when_publish_fails(): void { /** @var Question $question */ diff --git a/tests/Feature/Auth/RegistrationTest.php b/tests/Feature/Auth/RegistrationTest.php index 04bb5129..508363fc 100644 --- a/tests/Feature/Auth/RegistrationTest.php +++ b/tests/Feature/Auth/RegistrationTest.php @@ -2,6 +2,8 @@ namespace Tests\Feature\Auth; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; use Gamify\Models\User; use Gamify\Providers\RouteServiceProvider; use Generator; @@ -30,11 +32,8 @@ public function test_new_users_can_register(): void $this->assertAuthenticated(); } - /** - * @test - * - * @dataProvider provideWrongDataForUserRegistration - */ + #[Test] + #[DataProvider('provideWrongDataForUserRegistration')] public function it_should_get_errors_when_registering_with_wrong_data( array $data, array $errors diff --git a/tests/Feature/Auth/SocialAuthenticationTest.php b/tests/Feature/Auth/SocialAuthenticationTest.php index cf96babd..b12ecace 100644 --- a/tests/Feature/Auth/SocialAuthenticationTest.php +++ b/tests/Feature/Auth/SocialAuthenticationTest.php @@ -2,6 +2,7 @@ namespace Tests\Feature\Auth; +use PHPUnit\Framework\Attributes\Test; use Gamify\Events\SocialLogin; use Gamify\Providers\RouteServiceProvider; use Illuminate\Support\Facades\Event; @@ -11,7 +12,7 @@ class SocialAuthenticationTest extends TestCase { - /** @test */ + #[Test] public function it_should_authenticate_users_using_social_login(): void { $this->mockSocialLogin(); diff --git a/tests/Feature/Console/Commands/PublishScheduledQuestionsTest.php b/tests/Feature/Console/Commands/PublishScheduledQuestionsTest.php index 5b6dd230..89d6ff25 100644 --- a/tests/Feature/Console/Commands/PublishScheduledQuestionsTest.php +++ b/tests/Feature/Console/Commands/PublishScheduledQuestionsTest.php @@ -25,12 +25,13 @@ namespace Tests\Feature\Console\Commands; +use PHPUnit\Framework\Attributes\Test; use Gamify\Models\Question; use Tests\Feature\TestCase; class PublishScheduledQuestionsTest extends TestCase { - /** @test */ + #[Test] public function it_should_not_publish_questions_if_it_is_not_the_right_time_yet(): void { /** @var Question $question */ @@ -50,7 +51,7 @@ public function it_should_not_publish_questions_if_it_is_not_the_right_time_yet( $this->assertEquals(Question::FUTURE_STATUS, $question->status); } - /** @test */ + #[Test] public function it_should_raise_an_error_when_questions_can_not_be_published(): void { // Create a question without choices(). @@ -71,7 +72,7 @@ public function it_should_raise_an_error_when_questions_can_not_be_published(): $this->assertEquals(Question::FUTURE_STATUS, $question->status); } - /** @test */ + #[Test] public function it_should_sent_two_questions_to_publication(): void { $questions = Question::factory() diff --git a/tests/Feature/Http/Controllers/Account/ChangePasswordControllerTest.php b/tests/Feature/Http/Controllers/Account/ChangePasswordControllerTest.php index e55e777d..69035683 100644 --- a/tests/Feature/Http/Controllers/Account/ChangePasswordControllerTest.php +++ b/tests/Feature/Http/Controllers/Account/ChangePasswordControllerTest.php @@ -25,6 +25,7 @@ namespace Tests\Feature\Http\Controllers\Account; +use PHPUnit\Framework\Attributes\Test; use Gamify\Models\User; use Illuminate\Support\Facades\Hash; use Tests\Feature\TestCase; @@ -33,7 +34,7 @@ class ChangePasswordControllerTest extends TestCase { const VALID_PASSWORD = 'foo#B4rBaz'; - /** @test */ + #[Test] public function it_shows_password_change_form_for_logged_users(): void { /** @var User $user */ @@ -45,7 +46,7 @@ public function it_shows_password_change_form_for_logged_users(): void ->assertViewIs('account.password.index'); } - /** @test */ + #[Test] public function it_shows_error_for_non_logged_users(): void { $this @@ -53,7 +54,7 @@ public function it_shows_error_for_non_logged_users(): void ->assertRedirect(route('login')); } - /** @test */ + #[Test] public function it_shows_validation_error_if_current_password_is_invalid(): void { /** @var User $user */ @@ -71,7 +72,7 @@ public function it_shows_validation_error_if_current_password_is_invalid(): void ->assertInvalid(['current-password']); } - /** @test */ + #[Test] public function it_shows_validation_error_if_new_password_confirmation_does_not_match(): void { /** @var User $user */ @@ -89,7 +90,7 @@ public function it_shows_validation_error_if_new_password_confirmation_does_not_ ->assertInvalid(['new-password']); } - /** @test */ + #[Test] public function it_has_success_key_on_session_when_password_has_been_changed(): void { /** @var User $user */ diff --git a/tests/Feature/Http/Controllers/Account/ProfileControllerTest.php b/tests/Feature/Http/Controllers/Account/ProfileControllerTest.php index 7e0fe3dd..da756a4d 100644 --- a/tests/Feature/Http/Controllers/Account/ProfileControllerTest.php +++ b/tests/Feature/Http/Controllers/Account/ProfileControllerTest.php @@ -25,6 +25,8 @@ namespace Tests\Feature\Http\Controllers\Account; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; use Gamify\Events\AvatarUploaded; use Gamify\Events\ProfileUpdated; use Gamify\Models\User; @@ -50,7 +52,7 @@ protected function setUp(): void $this->user = $user; } - /** @test */ + #[Test] public function guests_should_not_access_profiles(): void { $this @@ -58,7 +60,7 @@ public function guests_should_not_access_profiles(): void ->assertRedirect(route('login')); } - /** @test */ + #[Test] public function users_should_see_their_own_profile(): void { $this @@ -67,7 +69,7 @@ public function users_should_see_their_own_profile(): void ->assertRedirect(route('profiles.show', ['username' => $this->user->username])); } - /** @test */ + #[Test] public function guests_should_not_access_the_edit_profile_form(): void { $this @@ -75,7 +77,7 @@ public function guests_should_not_access_the_edit_profile_form(): void ->assertRedirect(route('login')); } - /** @test */ + #[Test] public function users_should_see_the_edit_profile_form(): void { $this @@ -87,7 +89,7 @@ public function users_should_see_the_edit_profile_form(): void ->assertViewHas('user', $this->user); } - /** @test */ + #[Test] public function guests_should_not_access_the_update_profile_endpoint(): void { /** @var UserProfile $want */ @@ -106,7 +108,7 @@ public function guests_should_not_access_the_update_profile_endpoint(): void ->assertRedirect(route('login')); } - /** @test */ + #[Test] public function users_should_update_its_own_profile(): void { /** @var UserProfile $want */ @@ -143,11 +145,8 @@ public function users_should_update_its_own_profile(): void ]); } - /** - * @test - * - * @dataProvider provideWrongDataForUserProfileModification - */ + #[Test] + #[DataProvider('provideWrongDataForUserProfileModification')] public function users_should_get_errors_when_updating_its_own_profile_with_wrong_data( array $data, array $errors @@ -221,7 +220,7 @@ public static function provideWrongDataForUserProfileModification(): Generator ]; } - /** @test */ + #[Test] public function users_should_update_its_own_avatar(): void { Storage::fake('public'); @@ -241,7 +240,7 @@ public function users_should_update_its_own_avatar(): void $this->assertStringEndsWith('avatar-thumb.jpg', $this->user->profile->avatarUrl); } - /** @test */ + #[Test] public function event_should_be_dispatched_when_user_profile_is_updating_at_least_one_attribute(): void { Event::fake([ @@ -261,7 +260,7 @@ public function event_should_be_dispatched_when_user_profile_is_updating_at_leas Event::assertDispatched(ProfileUpdated::class); } - /** @test */ + #[Test] public function event_should_be_dispatched_when_user_is_updating_at_least_one_attribute(): void { Event::fake([ @@ -280,7 +279,7 @@ public function event_should_be_dispatched_when_user_is_updating_at_least_one_at Event::assertDispatched(ProfileUpdated::class); } - /** @test */ + #[Test] public function event_should_not_be_dispatched_when_user_profile_is_not_updating_any_attribute(): void { Event::fake([ @@ -299,7 +298,7 @@ public function event_should_not_be_dispatched_when_user_profile_is_not_updating Event::assertNotDispatched(ProfileUpdated::class); } - /** @test */ + #[Test] public function event_should_be_dispatched_when_the_user_uploads_an_avatar(): void { Event::fake(); @@ -324,7 +323,7 @@ public function event_should_be_dispatched_when_the_user_uploads_an_avatar(): vo Event::assertNotDispatched(ProfileUpdated::class); } - /** @test */ + #[Test] public function event_should_not_be_dispatched_when_the_user_does_not_upload_an_avatar(): void { Event::fake(); diff --git a/tests/Feature/Http/Controllers/Admin/AdminBadgeControllerTest.php b/tests/Feature/Http/Controllers/Admin/AdminBadgeControllerTest.php index 91bd7be3..3c384e30 100644 --- a/tests/Feature/Http/Controllers/Admin/AdminBadgeControllerTest.php +++ b/tests/Feature/Http/Controllers/Admin/AdminBadgeControllerTest.php @@ -25,6 +25,8 @@ namespace Tests\Feature\Http\Controllers\Admin; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; use Gamify\Enums\Roles; use Gamify\Models\Badge; use Gamify\Models\User; @@ -45,7 +47,7 @@ protected function setUp(): void $this->user = $user; } - /** @test */ + #[Test] public function players_should_not_see_the_index_view(): void { $this @@ -54,7 +56,7 @@ public function players_should_not_see_the_index_view(): void ->assertForbidden(); } - /** @test */ + #[Test] public function admins_should_see_the_index_view(): void { $this->user->role = Roles::Admin(); @@ -66,7 +68,7 @@ public function admins_should_see_the_index_view(): void ->assertViewIs('admin.badge.index'); } - /** @test */ + #[Test] public function players_should_not_see_the_new_badge_form(): void { $this @@ -75,7 +77,7 @@ public function players_should_not_see_the_new_badge_form(): void ->assertForbidden(); } - /** @test */ + #[Test] public function admins_should_see_the_new_badge_form(): void { $this->user->role = Roles::Admin(); @@ -87,7 +89,7 @@ public function admins_should_see_the_new_badge_form(): void ->assertViewIs('admin.badge.create'); } - /** @test */ + #[Test] public function players_should_not_create_badges(): void { /** @var Badge $want */ @@ -109,7 +111,7 @@ public function players_should_not_create_badges(): void ]); } - /** @test */ + #[Test] public function admins_should_create_badges(): void { $this->user->role = Roles::Admin(); @@ -148,11 +150,8 @@ public function admins_should_create_badges(): void $this->assertEquals($wantTags, $badge->tagArrayNormalized); } - /** - * @test - * - * @dataProvider provideWrongDataForBadgeCreation - */ + #[Test] + #[DataProvider('provideWrongDataForBadgeCreation')] public function admins_should_get_errors_when_creating_badges_with_wrong_data( array $data, array $errors @@ -259,7 +258,7 @@ public static function provideWrongDataForBadgeCreation(): Generator ]; } - /** @test */ + #[Test] public function players_should_not_see_any_badge(): void { $want = Badge::factory()->create(); @@ -270,7 +269,7 @@ public function players_should_not_see_any_badge(): void ->assertForbidden(); } - /** @test */ + #[Test] public function admins_should_see_any_badge(): void { $this->user->role = Roles::Admin(); @@ -285,7 +284,7 @@ public function admins_should_see_any_badge(): void ->assertViewHas('badge', $badge); } - /** @test */ + #[Test] public function players_should_not_see_the_edit_badge_form(): void { $want = Badge::factory()->create(); @@ -296,7 +295,7 @@ public function players_should_not_see_the_edit_badge_form(): void ->assertForbidden(); } - /** @test */ + #[Test] public function admins_should_see_the_edit_badge_form(): void { $this->user->role = Roles::Admin(); @@ -311,7 +310,7 @@ public function admins_should_see_the_edit_badge_form(): void ->assertViewHas('badge', $badge); } - /** @test */ + #[Test] public function players_should_not_update_badges(): void { /** @var Badge $want */ @@ -325,11 +324,8 @@ public function players_should_not_update_badges(): void $this->assertModelExists($want); } - /** - * @test - * - * @dataProvider providesDataForBadgeEdition - */ + #[Test] + #[DataProvider('providesDataForBadgeEdition')] public function admins_should_update_badges( array $wantData, ): void { @@ -381,11 +377,8 @@ public static function providesDataForBadgeEdition(): Generator ]; } - /** - * @test - * - * @dataProvider provideWrongDataForBadgeModification - */ + #[Test] + #[DataProvider('provideWrongDataForBadgeModification')] public function admins_should_get_errors_when_updating_badges_with_wrong_data( array $data, array $errors @@ -492,7 +485,7 @@ public static function provideWrongDataForBadgeModification(): Generator ]; } - /** @test */ + #[Test] public function players_should_not_delete_levels(): void { $badge = Badge::factory()->create(); @@ -503,7 +496,7 @@ public function players_should_not_delete_levels(): void ->assertForbidden(); } - /** @test */ + #[Test] public function admins_should_delete_badges(): void { $this->user->role = Roles::Admin(); diff --git a/tests/Feature/Http/Controllers/Admin/AdminBadgeDataTablesControllerTest.php b/tests/Feature/Http/Controllers/Admin/AdminBadgeDataTablesControllerTest.php index dcdfbfe5..8ea8c825 100644 --- a/tests/Feature/Http/Controllers/Admin/AdminBadgeDataTablesControllerTest.php +++ b/tests/Feature/Http/Controllers/Admin/AdminBadgeDataTablesControllerTest.php @@ -25,6 +25,7 @@ namespace Tests\Feature\Http\Controllers\Admin; +use PHPUnit\Framework\Attributes\Test; use Gamify\Enums\Roles; use Gamify\Models\Badge; use Gamify\Models\User; @@ -44,7 +45,7 @@ protected function setUp(): void $this->user = $user; } - /** @test */ + #[Test] public function admins_should_get_data_tables_data(): void { $this->user->role = Roles::Admin(); @@ -73,7 +74,7 @@ public function admins_should_get_data_tables_data(): void ]); } - /** @test */ + #[Test] public function users_should_not_get_data_tables_data(): void { $this diff --git a/tests/Feature/Http/Controllers/Admin/AdminDashboardControllerTest.php b/tests/Feature/Http/Controllers/Admin/AdminDashboardControllerTest.php index 7d5a4ec3..c992ea1c 100644 --- a/tests/Feature/Http/Controllers/Admin/AdminDashboardControllerTest.php +++ b/tests/Feature/Http/Controllers/Admin/AdminDashboardControllerTest.php @@ -25,6 +25,7 @@ namespace Tests\Feature\Http\Controllers\Admin; +use PHPUnit\Framework\Attributes\Test; use Gamify\Models\User; use Tests\Feature\TestCase; @@ -39,7 +40,7 @@ protected function setUp(): void $this->actingAs($admin); } - /** @test */ + #[Test] public function access_is_restricted_to_admins(): void { $test_data = [ @@ -56,7 +57,7 @@ public function access_is_restricted_to_admins(): void } } - /** @test */ + #[Test] public function index_returns_proper_content(): void { $this->get(route('admin.home')) diff --git a/tests/Feature/Http/Controllers/Admin/AdminLevelControllerTest.php b/tests/Feature/Http/Controllers/Admin/AdminLevelControllerTest.php index 11f92d8e..6575f3a6 100644 --- a/tests/Feature/Http/Controllers/Admin/AdminLevelControllerTest.php +++ b/tests/Feature/Http/Controllers/Admin/AdminLevelControllerTest.php @@ -25,6 +25,8 @@ namespace Tests\Feature\Http\Controllers\Admin; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; use Gamify\Enums\Roles; use Gamify\Models\Level; use Gamify\Models\User; @@ -45,7 +47,7 @@ protected function setUp(): void $this->user = $user; } - /** @test */ + #[Test] public function players_should_not_see_the_index_view(): void { $this @@ -54,7 +56,7 @@ public function players_should_not_see_the_index_view(): void ->assertForbidden(); } - /** @test */ + #[Test] public function admins_should_see_the_index_view(): void { $this->user->role = Roles::Admin(); @@ -66,7 +68,7 @@ public function admins_should_see_the_index_view(): void ->assertViewIs('admin.level.index'); } - /** @test */ + #[Test] public function players_should_not_see_the_new_level_form(): void { $this @@ -75,7 +77,7 @@ public function players_should_not_see_the_new_level_form(): void ->assertForbidden(); } - /** @test */ + #[Test] public function admins_should_see_the_new_level_form(): void { $this->user->role = Roles::Admin(); @@ -87,7 +89,7 @@ public function admins_should_see_the_new_level_form(): void ->assertViewIs('admin.level.create'); } - /** @test */ + #[Test] public function players_should_not_create_levels(): void { /** @var Level $want */ @@ -108,7 +110,7 @@ public function players_should_not_create_levels(): void ]); } - /** @test */ + #[Test] public function admins_should_create_levels(): void { $this->user->role = Roles::Admin(); @@ -133,11 +135,8 @@ public function admins_should_create_levels(): void ]); } - /** - * @test - * - * @dataProvider provideWrongDataForLevelCreation - */ + #[Test] + #[DataProvider('provideWrongDataForLevelCreation')] public function admins_should_get_errors_when_creating_levels_with_wrong_data( array $data, array $errors @@ -222,7 +221,7 @@ public static function provideWrongDataForLevelCreation(): Generator ]; } - /** @test */ + #[Test] public function players_should_not_see_any_level(): void { $want = Level::factory()->create(); @@ -233,7 +232,7 @@ public function players_should_not_see_any_level(): void ->assertForbidden(); } - /** @test */ + #[Test] public function admins_should_see_any_level(): void { $this->user->role = Roles::Admin(); @@ -248,7 +247,7 @@ public function admins_should_see_any_level(): void ->assertViewHas('level', $level); } - /** @test */ + #[Test] public function players_should_not_see_the_edit_level_form(): void { $want = Level::factory()->create(); @@ -259,7 +258,7 @@ public function players_should_not_see_the_edit_level_form(): void ->assertForbidden(); } - /** @test */ + #[Test] public function admins_should_see_the_edit_level_form(): void { $this->user->role = Roles::Admin(); @@ -274,7 +273,7 @@ public function admins_should_see_the_edit_level_form(): void ->assertViewHas('level', $level); } - /** @test */ + #[Test] public function players_should_not_update_levels(): void { /** @var Level $want */ @@ -288,7 +287,7 @@ public function players_should_not_update_levels(): void $this->assertModelExists($want); } - /** @test */ + #[Test] public function admins_should_update_levels(): void { $this->user->role = Roles::Admin(); @@ -317,11 +316,8 @@ public function admins_should_update_levels(): void ]); } - /** - * @test - * - * @dataProvider provideWrongDataForLevelModification - */ + #[Test] + #[DataProvider('provideWrongDataForLevelModification')] public function admins_should_get_errors_when_updating_levels_with_wrong_data( array $data, array $errors @@ -406,7 +402,7 @@ public static function provideWrongDataForLevelModification(): Generator ]; } - /** @test */ + #[Test] public function players_should_not_delete_levels(): void { $level = Level::factory()->create(); @@ -417,7 +413,7 @@ public function players_should_not_delete_levels(): void ->assertForbidden(); } - /** @test */ + #[Test] public function admins_should_delete_levels(): void { $this->user->role = Roles::Admin(); diff --git a/tests/Feature/Http/Controllers/Admin/AdminLevelDataTablesControllerTest.php b/tests/Feature/Http/Controllers/Admin/AdminLevelDataTablesControllerTest.php index 2197139d..a445362c 100644 --- a/tests/Feature/Http/Controllers/Admin/AdminLevelDataTablesControllerTest.php +++ b/tests/Feature/Http/Controllers/Admin/AdminLevelDataTablesControllerTest.php @@ -25,6 +25,7 @@ namespace Tests\Feature\Http\Controllers\Admin; +use PHPUnit\Framework\Attributes\Test; use Gamify\Enums\Roles; use Gamify\Models\Level; use Gamify\Models\User; @@ -44,7 +45,7 @@ protected function setUp(): void $this->user = $user; } - /** @test */ + #[Test] public function admins_should_get_data_tables_data(): void { $this->user->role = Roles::Admin(); @@ -70,7 +71,7 @@ public function admins_should_get_data_tables_data(): void ]); } - /** @test */ + #[Test] public function users_should_not_get_data_tables_data(): void { $this @@ -79,7 +80,7 @@ public function users_should_not_get_data_tables_data(): void ->assertForbidden(); } - /** @test */ + #[Test] public function it_should_fail_if_ajax_is_not_used(): void { $this diff --git a/tests/Feature/Http/Controllers/Admin/AdminQuestionControllerTest.php b/tests/Feature/Http/Controllers/Admin/AdminQuestionControllerTest.php index f6b0af97..24cc608c 100644 --- a/tests/Feature/Http/Controllers/Admin/AdminQuestionControllerTest.php +++ b/tests/Feature/Http/Controllers/Admin/AdminQuestionControllerTest.php @@ -25,6 +25,8 @@ namespace Tests\Feature\Http\Controllers\Admin; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; use Gamify\Http\Middleware\OnlyAjax; use Gamify\Models\Question; use Gamify\Models\User; @@ -43,7 +45,7 @@ protected function setUp(): void $this->actingAs($admin); } - /** @test */ + #[Test] public function access_is_restricted_to_admins(): void { /** @var Question $question */ @@ -75,7 +77,7 @@ public function access_is_restricted_to_admins(): void ->assertForbidden(); } - /** @test */ + #[Test] public function index_returns_proper_content(): void { $this->get(route('admin.questions.index')) @@ -83,7 +85,7 @@ public function index_returns_proper_content(): void ->assertViewIs('admin.question.index'); } - /** @test */ + #[Test] public function create_returns_proper_content(): void { $this->get(route('admin.questions.create')) @@ -91,7 +93,7 @@ public function create_returns_proper_content(): void ->assertViewIs('admin.question.create'); } - /** @test */ + #[Test] public function store_creates_an_object(): void { /** @var Question $question */ @@ -144,7 +146,7 @@ public function store_creates_an_object(): void $this->assertCount(2, $newQuestion->choices); } - /** @test */ + #[Test] public function store_returns_errors_on_invalid_data(): void { /** @var Question $want */ @@ -162,7 +164,7 @@ public function store_returns_errors_on_invalid_data(): void ]); } - /** @test */ + #[Test] public function show_returns_proper_content(): void { /** @var Question $question */ @@ -174,7 +176,7 @@ public function show_returns_proper_content(): void ->assertSee($question->name); } - /** @test */ + #[Test] public function edit_returns_proper_content(): void { /** @var Question $question */ @@ -186,11 +188,8 @@ public function edit_returns_proper_content(): void ->assertSee($question->name); } - /** - * @test - * - * @dataProvider providesTestCasesForEdition - */ + #[Test] + #[DataProvider('providesTestCasesForEdition')] public function update_edits_an_object( array $want ): void { @@ -251,7 +250,7 @@ public static function providesTestCasesForEdition(): \Generator ]; } - /** @test */ + #[Test] public function update_returns_errors_on_invalid_data(): void { /** @var Question $question */ @@ -270,7 +269,7 @@ public function update_returns_errors_on_invalid_data(): void $this->assertEquals('Question gold', $question->name); } - /** @test */ + #[Test] public function destroy_deletes_an_object(): void { /** @var Question $question */ diff --git a/tests/Feature/Http/Controllers/Admin/AdminQuestionDataTablesControllerTest.php b/tests/Feature/Http/Controllers/Admin/AdminQuestionDataTablesControllerTest.php index 6fb27bcb..9f3f9262 100644 --- a/tests/Feature/Http/Controllers/Admin/AdminQuestionDataTablesControllerTest.php +++ b/tests/Feature/Http/Controllers/Admin/AdminQuestionDataTablesControllerTest.php @@ -25,6 +25,7 @@ namespace Tests\Feature\Http\Controllers\Admin; +use PHPUnit\Framework\Attributes\Test; use Gamify\Enums\Roles; use Gamify\Models\Question; use Gamify\Models\User; @@ -44,7 +45,7 @@ protected function setUp(): void $this->user = $user; } - /** @test */ + #[Test] public function admins_should_get_data_tables_data(): void { $this->user->role = Roles::Admin(); @@ -71,7 +72,7 @@ public function admins_should_get_data_tables_data(): void ]); } - /** @test */ + #[Test] public function users_should_not_get_data_tables_data(): void { $this @@ -80,7 +81,7 @@ public function users_should_not_get_data_tables_data(): void ->assertForbidden(); } - /** @test */ + #[Test] public function it_should_fail_if_ajax_is_not_used(): void { $this diff --git a/tests/Feature/Http/Controllers/Admin/AdminRewardControllerTest.php b/tests/Feature/Http/Controllers/Admin/AdminRewardControllerTest.php index bbd4e525..7b80537e 100644 --- a/tests/Feature/Http/Controllers/Admin/AdminRewardControllerTest.php +++ b/tests/Feature/Http/Controllers/Admin/AdminRewardControllerTest.php @@ -25,6 +25,8 @@ namespace Tests\Feature\Http\Controllers\Admin; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; use Gamify\Enums\Roles; use Gamify\Models\Badge; use Gamify\Models\User; @@ -48,7 +50,7 @@ protected function setUp(): void $this->user = $user; } - /** @test */ + #[Test] public function players_should_not_see_the_index_view(): void { $this @@ -57,7 +59,7 @@ public function players_should_not_see_the_index_view(): void ->assertForbidden(); } - /** @test */ + #[Test] public function admins_should_see_the_index_view(): void { $this->user->role = Roles::Admin(); @@ -77,7 +79,7 @@ public function admins_should_see_the_index_view(): void ->assertViewIs('admin.reward.index'); } - /** @test */ + #[Test] public function players_should_not_reward_experience(): void { /** @var User $user */ @@ -102,7 +104,7 @@ public function players_should_not_reward_experience(): void $this->assertEquals(0, $user->experience); } - /** @test */ + #[Test] public function admins_should_reward_experience(): void { $this->user->role = Roles::Admin(); @@ -129,11 +131,8 @@ public function admins_should_reward_experience(): void $this->assertEquals($want['points'], $user->experience); } - /** - * @test - * - * @dataProvider provideWrongDataForExperienceRewarding - */ + #[Test] + #[DataProvider('provideWrongDataForExperienceRewarding')] public function admins_should_get_errors_when_rewarding_experience_with_wrong_data( array $data, array $errors, @@ -199,7 +198,7 @@ public static function provideWrongDataForExperienceRewarding(): Generator ]; } - /** @test */ + #[Test] public function players_should_not_reward_badges(): void { /** @var User $user */ @@ -221,7 +220,7 @@ public function players_should_not_reward_badges(): void $this->assertEquals(0, $user->badges()->count()); } - /** @test */ + #[Test] public function admins_should_reward_badges(): void { $this->user->role = Roles::Admin(); @@ -245,11 +244,8 @@ public function admins_should_reward_badges(): void $this->assertEquals(1, $user->badges()->count()); } - /** - * @test - * - * @dataProvider provideWrongDataForBadgeRewarding - */ + #[Test] + #[DataProvider('provideWrongDataForBadgeRewarding')] public function admins_should_get_errors_when_rewarding_badges_with_wrong_data( array $data, array $errors, diff --git a/tests/Feature/Http/Controllers/Admin/AdminUserControllerTest.php b/tests/Feature/Http/Controllers/Admin/AdminUserControllerTest.php index d4f6a0d4..8a3b95e6 100644 --- a/tests/Feature/Http/Controllers/Admin/AdminUserControllerTest.php +++ b/tests/Feature/Http/Controllers/Admin/AdminUserControllerTest.php @@ -25,6 +25,8 @@ namespace Tests\Feature\Http\Controllers\Admin; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; use Gamify\Enums\Roles; use Gamify\Models\User; use Generator; @@ -44,7 +46,7 @@ protected function setUp(): void $this->user = $user; } - /** @test */ + #[Test] public function players_should_not_see_the_index_view(): void { $this @@ -53,7 +55,7 @@ public function players_should_not_see_the_index_view(): void ->assertForbidden(); } - /** @test */ + #[Test] public function admins_should_see_the_index_view(): void { $this->user->role = Roles::Admin(); @@ -65,7 +67,7 @@ public function admins_should_see_the_index_view(): void ->assertViewIs('admin.user.index'); } - /** @test */ + #[Test] public function players_should_not_see_the_new_user_form(): void { $this @@ -74,7 +76,7 @@ public function players_should_not_see_the_new_user_form(): void ->assertForbidden(); } - /** @test */ + #[Test] public function admins_should_see_the_new_user_form(): void { $this->user->role = Roles::Admin(); @@ -86,7 +88,7 @@ public function admins_should_see_the_new_user_form(): void ->assertViewIs('admin.user.create'); } - /** @test */ + #[Test] public function players_should_not_create_users(): void { /** @var User $want */ @@ -108,7 +110,7 @@ public function players_should_not_create_users(): void ]); } - /** @test */ + #[Test] public function admins_should_create_users(): void { $this->user->role = Roles::Admin(); @@ -135,11 +137,8 @@ public function admins_should_create_users(): void ]); } - /** - * @test - * - * @dataProvider provideWrongDataForUserCreation - */ + #[Test] + #[DataProvider('provideWrongDataForUserCreation')] public function admins_should_get_errors_when_creating_users_with_wrong_data( array $data, array $errors @@ -240,7 +239,7 @@ public static function provideWrongDataForUserCreation(): Generator ]; } - /** @test */ + #[Test] public function players_should_not_see_any_user(): void { $want = User::factory()->create(); @@ -251,7 +250,7 @@ public function players_should_not_see_any_user(): void ->assertForbidden(); } - /** @test */ + #[Test] public function admins_should_see_any_user(): void { $this->user->role = Roles::Admin(); @@ -266,7 +265,7 @@ public function admins_should_see_any_user(): void ->assertViewHas('user', $want); } - /** @test */ + #[Test] public function players_should_not_see_the_edit_user_form(): void { $want = User::factory()->create(); @@ -277,7 +276,7 @@ public function players_should_not_see_the_edit_user_form(): void ->assertForbidden(); } - /** @test */ + #[Test] public function admins_should_see_the_edit_user_form(): void { $this->user->role = Roles::Admin(); @@ -292,7 +291,7 @@ public function admins_should_see_the_edit_user_form(): void ->assertViewHas('user', $want); } - /** @test */ + #[Test] public function players_should_not_update_users(): void { /** @var User $want */ @@ -306,7 +305,7 @@ public function players_should_not_update_users(): void $this->assertModelExists($want); } - /** @test */ + #[Test] public function admins_should_update_users(): void { $this->user->role = Roles::Admin(); @@ -335,7 +334,7 @@ public function admins_should_update_users(): void ]); } - /** @test */ + #[Test] public function admins_should_not_update_their_own_role(): void { $this->user->role = Roles::Admin(); @@ -363,11 +362,8 @@ public function admins_should_not_update_their_own_role(): void ]); } - /** - * @test - * - * @dataProvider provideWrongDataForUserModification - */ + #[Test] + #[DataProvider('provideWrongDataForUserModification')] public function admins_should_get_errors_when_updating_users_with_wrong_data( array $data, array $errors @@ -441,7 +437,7 @@ public static function provideWrongDataForUserModification(): Generator ]; } - /** @test */ + #[Test] public function players_should_not_delete_users(): void { /** @var User $user */ @@ -453,7 +449,7 @@ public function players_should_not_delete_users(): void ->assertForbidden(); } - /** @test */ + #[Test] public function admins_should_not_delete_themselves(): void { $this->user->role = Roles::Admin(); @@ -466,7 +462,7 @@ public function admins_should_not_delete_themselves(): void $this->assertModelExists($this->user); } - /** @test */ + #[Test] public function admins_should_delete_users(): void { $this->user->role = Roles::Admin(); diff --git a/tests/Feature/Http/Controllers/Admin/AdminUserDataTablesControllerTest.php b/tests/Feature/Http/Controllers/Admin/AdminUserDataTablesControllerTest.php index e3faa59c..60de5de1 100644 --- a/tests/Feature/Http/Controllers/Admin/AdminUserDataTablesControllerTest.php +++ b/tests/Feature/Http/Controllers/Admin/AdminUserDataTablesControllerTest.php @@ -25,6 +25,7 @@ namespace Tests\Feature\Http\Controllers\Admin; +use PHPUnit\Framework\Attributes\Test; use Gamify\Enums\Roles; use Gamify\Models\User; use Tests\Feature\TestCase; @@ -43,7 +44,7 @@ protected function setUp(): void $this->user = $user; } - /** @test */ + #[Test] public function admins_should_get_data_tables_data(): void { $this->user->role = Roles::Admin(); @@ -71,7 +72,7 @@ public function admins_should_get_data_tables_data(): void ]); } - /** @test */ + #[Test] public function users_should_not_get_data_tables_data(): void { $this diff --git a/tests/Feature/Http/Controllers/HomeControllerTest.php b/tests/Feature/Http/Controllers/HomeControllerTest.php index 11a8aec5..223ffa12 100644 --- a/tests/Feature/Http/Controllers/HomeControllerTest.php +++ b/tests/Feature/Http/Controllers/HomeControllerTest.php @@ -25,12 +25,13 @@ namespace Tests\Feature\Http\Controllers; +use PHPUnit\Framework\Attributes\Test; use Gamify\Models\User; use Tests\Feature\TestCase; class HomeControllerTest extends TestCase { - /** @test */ + #[Test] public function index_returns_proper_content(): void { /** @var User $user */ diff --git a/tests/Feature/Http/Controllers/LeaderBoardControllerTest.php b/tests/Feature/Http/Controllers/LeaderBoardControllerTest.php index edc8dde1..e559986f 100644 --- a/tests/Feature/Http/Controllers/LeaderBoardControllerTest.php +++ b/tests/Feature/Http/Controllers/LeaderBoardControllerTest.php @@ -25,11 +25,12 @@ namespace Tests\Feature\Http\Controllers; +use PHPUnit\Framework\Attributes\Test; use Tests\Feature\TestCase; class LeaderBoardControllerTest extends TestCase { - /** @test */ + #[Test] public function it_should_be_accessible_for_guests(): void { $this diff --git a/tests/Feature/Http/Controllers/MarkNotificationAsReadControllerTest.php b/tests/Feature/Http/Controllers/MarkNotificationAsReadControllerTest.php index d40ac599..a9870221 100644 --- a/tests/Feature/Http/Controllers/MarkNotificationAsReadControllerTest.php +++ b/tests/Feature/Http/Controllers/MarkNotificationAsReadControllerTest.php @@ -25,6 +25,7 @@ namespace Tests\Feature\Http\Controllers; +use PHPUnit\Framework\Attributes\Test; use Gamify\Models\Badge; use Gamify\Models\User; use Gamify\Notifications\BadgeUnlocked; @@ -33,7 +34,7 @@ class MarkNotificationAsReadControllerTest extends TestCase { - /** @test */ + #[Test] public function it_should_mark_a_notification_as_read(): void { /** @var User $user */ @@ -58,7 +59,7 @@ public function it_should_mark_a_notification_as_read(): void $this->assertCount(1, $user->refresh()->unreadNotifications); } - /** @test */ + #[Test] public function it_should_mark_all_notifications_as_read(): void { /** @var User $user */ diff --git a/tests/Feature/Http/Controllers/QuestionControllerTest.php b/tests/Feature/Http/Controllers/QuestionControllerTest.php index 758051f6..27a4fa38 100644 --- a/tests/Feature/Http/Controllers/QuestionControllerTest.php +++ b/tests/Feature/Http/Controllers/QuestionControllerTest.php @@ -25,6 +25,7 @@ namespace Tests\Feature\Http\Controllers; +use PHPUnit\Framework\Attributes\Test; use Gamify\Events\QuestionAnswered; use Gamify\Models\Question; use Gamify\Models\User; @@ -46,7 +47,7 @@ protected function setUp(): void $this->user = $user; } - /** @test */ + #[Test] public function it_should_show_the_questions_dashboard(): void { $this @@ -64,7 +65,7 @@ public function it_should_show_the_questions_dashboard(): void ]); } - /** @test */ + #[Test] public function it_should_response_not_found_when_question_is_not_published(): void { /** @var Question $question */ @@ -77,7 +78,7 @@ public function it_should_response_not_found_when_question_is_not_published(): v ->assertNotFound(); } - /** @test */ + #[Test] public function it_should_show_the_question_when_it_is_not_answered(): void { /** @var Question $question */ @@ -93,7 +94,7 @@ public function it_should_show_the_question_when_it_is_not_answered(): void ->assertSeeText($question->name); } - /** @test */ + #[Test] public function it_should_add_the_user_response_after_answering(): void { /** @var Question $question */ @@ -121,7 +122,7 @@ public function it_should_add_the_user_response_after_answering(): void ]); } - /** @test */ + #[Test] public function it_fires_an_event_when_question_is_answered_correctly(): void { /** @var Question $question */ @@ -149,7 +150,7 @@ public function it_fires_an_event_when_question_is_answered_correctly(): void }); } - /** @test */ + #[Test] public function it_fires_an_event_when_question_is_answered_incorrectly(): void { /** @var Question $question */ @@ -177,7 +178,7 @@ public function it_fires_an_event_when_question_is_answered_incorrectly(): void }); } - /** @test */ + #[Test] public function it_should_response_404_when_hashids_service_fails(): void { /** @var Question $question */ diff --git a/tests/Feature/Http/Controllers/ShowUserProfileControllerTest.php b/tests/Feature/Http/Controllers/ShowUserProfileControllerTest.php index eb3c282d..1d3851b7 100644 --- a/tests/Feature/Http/Controllers/ShowUserProfileControllerTest.php +++ b/tests/Feature/Http/Controllers/ShowUserProfileControllerTest.php @@ -25,6 +25,7 @@ namespace Tests\Feature\Http\Controllers; +use PHPUnit\Framework\Attributes\Test; use Gamify\Models\User; use Tests\Feature\TestCase; @@ -43,7 +44,7 @@ protected function setUp(): void $this->user = $user; } - /** @test */ + #[Test] public function users_should_see_another_user_profiles_without_edit_buttons(): void { /** @var User $user */ @@ -59,7 +60,7 @@ public function users_should_see_another_user_profiles_without_edit_buttons(): v ->assertDontSeeText(__('user/profile.change_password')); } - /** @test */ + #[Test] public function users_should_see_its_own_profile_edit_buttons(): void { $this diff --git a/tests/Feature/Http/Middleware/OnlyAjaxTest.php b/tests/Feature/Http/Middleware/OnlyAjaxTest.php index 543a5fce..f3d3cc2a 100644 --- a/tests/Feature/Http/Middleware/OnlyAjaxTest.php +++ b/tests/Feature/Http/Middleware/OnlyAjaxTest.php @@ -25,6 +25,7 @@ namespace Tests\Feature\Http\Middleware; +use PHPUnit\Framework\Attributes\Test; use Gamify\Http\Middleware\OnlyAjax; use Illuminate\Support\Facades\Route; use Symfony\Component\HttpFoundation\Response as ResponseCode; @@ -44,7 +45,7 @@ protected function setUp(): void }); } - /** @test */ + #[Test] public function it_forbids_non_ajax_requests(): void { $this->withoutExceptionHandling(); @@ -64,7 +65,7 @@ public function it_forbids_non_ajax_requests(): void $this->assertEquals(count($httpVerbs), $exceptionCount, 'Expected a 403 forbidden'); } - /** @test */ + #[Test] public function it_passes_with_ajax_requests(): void { $httpVerbs = ['get', 'put', 'post', 'patch', 'delete']; diff --git a/tests/Feature/Http/Middleware/RedirectIfAuthenticatedTest.php b/tests/Feature/Http/Middleware/RedirectIfAuthenticatedTest.php index bdc38c8e..4dcd0394 100644 --- a/tests/Feature/Http/Middleware/RedirectIfAuthenticatedTest.php +++ b/tests/Feature/Http/Middleware/RedirectIfAuthenticatedTest.php @@ -25,6 +25,7 @@ namespace Tests\Feature\Http\Middleware; +use PHPUnit\Framework\Attributes\Test; use Gamify\Http\Middleware\RedirectIfAuthenticated; use Gamify\Models\User; use Gamify\Providers\RouteServiceProvider; @@ -44,7 +45,7 @@ protected function setUp(): void }); } - /** @test */ + #[Test] public function it_response_ok_for_non_authenticated_users(): void { $response = $this->get(self::TEST_ENDPOINT); @@ -53,7 +54,7 @@ public function it_response_ok_for_non_authenticated_users(): void $response->assertSee('Access granted for non authenticated users'); } - /** @test */ + #[Test] public function it_redirects_to_home_for_authenticated_users_requests(): void { /** @var User $user */ diff --git a/tests/Feature/Libs/Game/GameTest.php b/tests/Feature/Libs/Game/GameTest.php index c9e2b458..38c61051 100644 --- a/tests/Feature/Libs/Game/GameTest.php +++ b/tests/Feature/Libs/Game/GameTest.php @@ -25,6 +25,8 @@ namespace Tests\Feature\Libs\Game; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; use Gamify\Libs\Game\Game; use Gamify\Models\Badge; use Gamify\Models\Point; @@ -35,7 +37,7 @@ class GameTest extends TestCase { - /** @test */ + #[Test] public function it_increments_repetitions_for_a_given_badge(): void { /** @var User $user */ @@ -52,7 +54,7 @@ public function it_increments_repetitions_for_a_given_badge(): void $this->assertEquals(1, $user->progressToCompleteTheBadge($badge)->repetitions); } - /** @test */ + #[Test] public function it_increments_repetitions_for_a_given_badge_that_was_already_initiated(): void { /** @var User $user */ @@ -71,7 +73,7 @@ public function it_increments_repetitions_for_a_given_badge_that_was_already_ini $this->assertEquals(2, $user->progressToCompleteTheBadge($badge)->repetitions); } - /** @test */ + #[Test] public function it_completes_badge_when_reach_required_repetitions(): void { /** @var User $user */ @@ -87,7 +89,7 @@ public function it_completes_badge_when_reach_required_repetitions(): void $this->assertTrue($user->hasUnlockedBadge($badge)); } - /** @test */ + #[Test] public function it_does_not_complete_badge_when_required_repetitions_are_not_reached(): void { /** @var User $user */ @@ -103,7 +105,7 @@ public function it_does_not_complete_badge_when_required_repetitions_are_not_rea $this->assertFalse($user->hasUnlockedBadge($badge)); } - /** @test */ + #[Test] public function it_does_not_update_repetitions_if_badge_was_already_completed(): void { /** @var User $user */ @@ -122,7 +124,7 @@ public function it_does_not_update_repetitions_if_badge_was_already_completed(): $this->assertEquals(1, $user->progressToCompleteTheBadge($badge)->repetitions); } - /** @test */ + #[Test] public function it_completes_a_badge_for_a_user(): void { /** @var User $user */ @@ -136,7 +138,7 @@ public function it_completes_a_badge_for_a_user(): void $this->assertTrue($user->hasUnlockedBadge($badge)); } - /** @test */ + #[Test] public function it_completes_a_badge_when_a_user_had_already_started_it(): void { /** @var User $user */ @@ -154,11 +156,8 @@ public function it_completes_a_badge_when_a_user_had_already_started_it(): void $this->assertTrue($user->hasUnlockedBadge($badge)); } - /** - * @test - * - * @dataProvider provideRankingTestCases - */ + #[Test] + #[DataProvider('provideRankingTestCases')] public function it_should_return_the_first_players_with_the_highest_score( int $numberOfPlayers, array $expectedPlayers, diff --git a/tests/Feature/Listeners/AddBadgesOnAvatarUploadedTest.php b/tests/Feature/Listeners/AddBadgesOnAvatarUploadedTest.php index f89b781c..c80773d9 100644 --- a/tests/Feature/Listeners/AddBadgesOnAvatarUploadedTest.php +++ b/tests/Feature/Listeners/AddBadgesOnAvatarUploadedTest.php @@ -25,6 +25,7 @@ namespace Tests\Feature\Listeners; +use PHPUnit\Framework\Attributes\Test; use Gamify\Enums\BadgeActuators; use Gamify\Events\AvatarUploaded; use Gamify\Listeners\AddBadgesOnAvatarUploaded; @@ -36,7 +37,7 @@ class AddBadgesOnAvatarUploadedTest extends TestCase { - /** @test */ + #[Test] public function it_should_listen_for_the_proper_event(): void { Event::fake(); @@ -46,7 +47,7 @@ public function it_should_listen_for_the_proper_event(): void ); } - /** @test */ + #[Test] public function it_increments_badges_when_user_uploads_avatar(): void { /** @var User $user */ @@ -67,7 +68,7 @@ public function it_increments_badges_when_user_uploads_avatar(): void $this->assertEquals(1, $user->progressToCompleteTheBadge($badge)?->repetitions); } - /** @test */ + #[Test] public function it_does_not_increment_badges_when_user_uploads_avatar(): void { /** @var User $user */ diff --git a/tests/Feature/Listeners/AddBadgesOnProfileUpdatedTest.php b/tests/Feature/Listeners/AddBadgesOnProfileUpdatedTest.php index 35f3c61d..82c7fd15 100644 --- a/tests/Feature/Listeners/AddBadgesOnProfileUpdatedTest.php +++ b/tests/Feature/Listeners/AddBadgesOnProfileUpdatedTest.php @@ -25,6 +25,7 @@ namespace Tests\Feature\Listeners; +use PHPUnit\Framework\Attributes\Test; use Gamify\Enums\BadgeActuators; use Gamify\Events\SocialLogin; use Gamify\Events\ProfileUpdated; @@ -39,7 +40,7 @@ class AddBadgesOnProfileUpdatedTest extends TestCase { - /** @test */ + #[Test] public function it_should_listen_for_the_proper_events(): void { Event::fake(); @@ -49,7 +50,7 @@ public function it_should_listen_for_the_proper_events(): void ); } - /** @test */ + #[Test] public function it_increments_badges_when_user_updates_profile(): void { /** @var User $user */ @@ -71,7 +72,7 @@ public function it_increments_badges_when_user_updates_profile(): void $this->assertEquals(1, $user->progressToCompleteTheBadge($badge)->repetitions); } - /** @test */ + #[Test] public function it_does_not_increment_badges_when_user_updates_profile(): void { /** @var User $user */ diff --git a/tests/Feature/Listeners/AddBadgesOnQuestionAnsweredTest.php b/tests/Feature/Listeners/AddBadgesOnQuestionAnsweredTest.php index 0f28155a..99109803 100644 --- a/tests/Feature/Listeners/AddBadgesOnQuestionAnsweredTest.php +++ b/tests/Feature/Listeners/AddBadgesOnQuestionAnsweredTest.php @@ -25,6 +25,8 @@ namespace Tests\Feature\Listeners; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; use Gamify\Enums\BadgeActuators; use Gamify\Events\QuestionAnswered; use Gamify\Listeners\AddBadgesOnQuestionAnswered; @@ -37,7 +39,7 @@ class AddBadgesOnQuestionAnsweredTest extends TestCase { - /** @test */ + #[Test] public function it_should_listen_for_the_proper_event(): void { Event::fake(); @@ -47,11 +49,8 @@ public function it_should_listen_for_the_proper_event(): void ); } - /** - * @test - * - * @dataProvider provideTestCasesThatShouldTriggerABadge - */ + #[Test] + #[DataProvider('provideTestCasesThatShouldTriggerABadge')] public function it_should_increment_badges_when_criteria_is_met( array $badgeAttributes, array $questionAttributes, @@ -150,11 +149,8 @@ public static function provideTestCasesThatShouldTriggerABadge(): \Generator ]; } - /** - * @test - * - * @dataProvider provideTestCasesThatShouldNotTriggerABadge - */ + #[Test] + #[DataProvider('provideTestCasesThatShouldNotTriggerABadge')] public function it_should_not_increment_badges_when_criteria_is_not_met( array $badgeAttributes, array $questionAttributes, diff --git a/tests/Feature/Listeners/AddBadgesOnUserLoggedInTest.php b/tests/Feature/Listeners/AddBadgesOnUserLoggedInTest.php index a082eca6..4a2fff0f 100644 --- a/tests/Feature/Listeners/AddBadgesOnUserLoggedInTest.php +++ b/tests/Feature/Listeners/AddBadgesOnUserLoggedInTest.php @@ -25,6 +25,7 @@ namespace Tests\Feature\Listeners; +use PHPUnit\Framework\Attributes\Test; use Gamify\Enums\BadgeActuators; use Gamify\Events\SocialLogin; use Gamify\Listeners\AddBadgesOnUserLoggedIn; @@ -37,7 +38,7 @@ class AddBadgesOnUserLoggedInTest extends TestCase { - /** @test */ + #[Test] public function it_should_listen_for_the_proper_event(): void { Event::fake(); @@ -51,7 +52,7 @@ public function it_should_listen_for_the_proper_event(): void ); } - /** @test */ + #[Test] public function it_increments_badges_when_user_logs_in(): void { /** @var User $user */ @@ -72,7 +73,7 @@ public function it_increments_badges_when_user_logs_in(): void $this->assertEquals(1, $user->progressToCompleteTheBadge($badge)?->repetitions); } - /** @test */ + #[Test] public function it_does_not_increment_badges_when_user_logs_in(): void { /** @var User $user */ @@ -93,7 +94,7 @@ public function it_does_not_increment_badges_when_user_logs_in(): void $this->assertNull($user->progressToCompleteTheBadge($badge)); } - /** @test */ + #[Test] public function it_increments_badges_when_user_use_social_login(): void { /** @var User $user */ @@ -114,7 +115,7 @@ public function it_increments_badges_when_user_use_social_login(): void $this->assertEquals(1, $user->progressToCompleteTheBadge($badge)?->repetitions); } - /** @test */ + #[Test] public function it_does_not_increment_badges_when_user_use_social_login(): void { /** @var User $user */ diff --git a/tests/Feature/Listeners/AddReputationTest.php b/tests/Feature/Listeners/AddReputationTest.php index 358b7b22..a98afb56 100644 --- a/tests/Feature/Listeners/AddReputationTest.php +++ b/tests/Feature/Listeners/AddReputationTest.php @@ -25,6 +25,7 @@ namespace Tests\Feature\Listeners; +use PHPUnit\Framework\Attributes\Test; use Gamify\Events\QuestionAnswered; use Gamify\Listeners\AddReputation; use Gamify\Models\Question; @@ -35,7 +36,7 @@ class AddReputationTest extends TestCase { - /** @test */ + #[Test] public function it_should_listen_for_the_proper_event(): void { Event::fake(); @@ -45,7 +46,7 @@ public function it_should_listen_for_the_proper_event(): void ); } - /** @test */ + #[Test] public function it_increments_the_user_experience(): void { /** @var User $user */ diff --git a/tests/Feature/Listeners/UpdateCachedUserExperienceTest.php b/tests/Feature/Listeners/UpdateCachedUserExperienceTest.php index e40ffd3c..62907a9b 100644 --- a/tests/Feature/Listeners/UpdateCachedUserExperienceTest.php +++ b/tests/Feature/Listeners/UpdateCachedUserExperienceTest.php @@ -25,6 +25,7 @@ namespace Tests\Feature\Listeners; +use PHPUnit\Framework\Attributes\Test; use Gamify\Events\PointCreated; use Gamify\Events\PointDeleted; use Gamify\Listeners\UpdateCachedUserExperience; @@ -35,7 +36,7 @@ class UpdateCachedUserExperienceTest extends TestCase { - /** @test */ + #[Test] public function it_should_listen_for_the_proper_event(): void { Event::fake(); @@ -49,7 +50,7 @@ public function it_should_listen_for_the_proper_event(): void ); } - /** @test */ + #[Test] public function it_updates_the_cached_value_on_point_creation(): void { /** @var User $user */ @@ -64,7 +65,7 @@ public function it_updates_the_cached_value_on_point_creation(): void $this->assertEquals(5, $user->experience); } - /** @test */ + #[Test] public function it_updates_the_cached_value_on_point_deletion(): void { /** @var User $user */ diff --git a/tests/Feature/Models/BadgeTest.php b/tests/Feature/Models/BadgeTest.php index 8c2a9b5e..6f1388ed 100644 --- a/tests/Feature/Models/BadgeTest.php +++ b/tests/Feature/Models/BadgeTest.php @@ -25,13 +25,14 @@ namespace Tests\Feature\Models; +use PHPUnit\Framework\Attributes\Test; use Gamify\Enums\BadgeActuators; use Gamify\Models\Badge; use Tests\Feature\TestCase; class BadgeTest extends TestCase { - /** @test */ + #[Test] public function it_should_return_the_default_image_if_badge_has_not_image(): void { /** @var Badge $badge */ @@ -40,7 +41,7 @@ public function it_should_return_the_default_image_if_badge_has_not_image(): voi $this->assertEquals('/images/missing_badge.png', $badge->image); } - /** @test */ + #[Test] public function it_should_return_only_active_badges(): void { Badge::factory() @@ -56,7 +57,7 @@ public function it_should_return_only_active_badges(): void $this->assertEquals($want->pluck('name'), Badge::active()->pluck('name')); } - /** @test */ + #[Test] public function it_should_return_only_active_badges_with_the_specified_actuators(): void { Badge::factory() @@ -81,7 +82,7 @@ public function it_should_return_only_active_badges_with_the_specified_actuators $this->assertEquals($want->pluck('name'), $badges->pluck('name')); } - /** @test */ + #[Test] public function it_should_return_only_active_badges_with_the_question_actuators_and_specified_tags(): void { // active but without tags diff --git a/tests/Feature/Models/LevelTest.php b/tests/Feature/Models/LevelTest.php index cb282f8d..53a6105b 100644 --- a/tests/Feature/Models/LevelTest.php +++ b/tests/Feature/Models/LevelTest.php @@ -25,6 +25,8 @@ namespace Tests\Feature\Models; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; use Gamify\Models\Level; use Generator; use Illuminate\Foundation\Testing\WithFaker; @@ -34,7 +36,7 @@ class LevelTest extends TestCase { use WithFaker; - /** @test */ + #[Test] public function it_should_find_the_default_level_when_levels_has_not_been_created_yet(): void { $want = Level::defaultLevel(); @@ -48,7 +50,7 @@ public function it_should_find_the_default_level_when_levels_has_not_been_create $this->assertEquals($want->required_points, $level->required_points); } - /** @test */ + #[Test] public function it_should_find_next_level_even_when_levels_has_not_been_created_yet(): void { $want = Level::defaultLevel(); @@ -62,11 +64,8 @@ public function it_should_find_next_level_even_when_levels_has_not_been_created_ $this->assertEquals($want->required_points, $level->required_points); } - /** - * @test - * - * @dataProvider provideFindLevelTestCases - */ + #[Test] + #[DataProvider('provideFindLevelTestCases')] public function it_should_return_the_proper_level_based_on_experience( array $levels, int $experience, @@ -140,11 +139,8 @@ public static function provideFindLevelTestCases(): Generator ]; } - /** - * @test - * - * @dataProvider provideFindNextLevelTestCases - */ + #[Test] + #[DataProvider('provideFindNextLevelTestCases')] public function it_should_return_the_next_level_based_on_experience( array $levels, int $experience, @@ -218,7 +214,7 @@ public static function provideFindNextLevelTestCases(): Generator ]; } - /** @test */ + #[Test] public function it_should_return_the_default_image_if_level_has_not_image(): void { /** @var Level $level */ diff --git a/tests/Feature/Models/QuestionTest.php b/tests/Feature/Models/QuestionTest.php index 984630e4..2b2818c9 100644 --- a/tests/Feature/Models/QuestionTest.php +++ b/tests/Feature/Models/QuestionTest.php @@ -25,6 +25,7 @@ namespace Tests\Feature\Models; +use PHPUnit\Framework\Attributes\Test; use Gamify\Events\QuestionPublished; use Gamify\Exceptions\QuestionPublishingException; use Gamify\Models\Question; @@ -34,7 +35,7 @@ class QuestionTest extends TestCase { - /** @test */ + #[Test] public function it_should_return_only_published_questions(): void { Question::factory() @@ -62,7 +63,7 @@ public function it_should_return_only_published_questions(): void ); } - /** @test */ + #[Test] public function it_should_return_only_public_published_questions(): void { Question::factory() @@ -92,7 +93,7 @@ public function it_should_return_only_public_published_questions(): void ); } - /** @test */ + #[Test] public function it_should_collect_only_scheduled_questions(): void { Question::factory() @@ -120,7 +121,7 @@ public function it_should_collect_only_scheduled_questions(): void ); } - /** @test */ + #[Test] public function it_should_return_true_if_question_can_be_published(): void { /** @var Question $question */ @@ -132,7 +133,7 @@ public function it_should_return_true_if_question_can_be_published(): void $this->assertTrue($question->canBePublished()); } - /** @test */ + #[Test] public function it_should_return_false_if_question_can_not_be_published(): void { /** @var Question $question */ @@ -143,7 +144,7 @@ public function it_should_return_false_if_question_can_not_be_published(): void $this->assertFalse($question->canBePublished()); } - /** @test */ + #[Test] public function it_triggers_an_event_when_a_question_is_published(): void { /** @var Question $question */ @@ -159,7 +160,7 @@ public function it_triggers_an_event_when_a_question_is_published(): void Event::assertDispatched(QuestionPublished::class); } - /** @test */ + #[Test] public function it_does_not_trigger_an_event_when_a_question_was_already_published(): void { /** @var Question $question */ @@ -174,7 +175,7 @@ public function it_does_not_trigger_an_event_when_a_question_was_already_publish Event::assertNotDispatched(QuestionPublished::class); } - /** @test */ + #[Test] public function it_does_not_trigger_an_event_when_a_question_is_scheduled(): void { /** @var Question $question */ @@ -192,7 +193,7 @@ public function it_does_not_trigger_an_event_when_a_question_is_scheduled(): voi Event::assertNotDispatched(QuestionPublished::class); } - /** @test */ + #[Test] public function it_throws_an_exception_when_trying_to_publish_a_question_without_at_least_two_choices(): void { $this->withoutExceptionHandling(); @@ -207,7 +208,7 @@ public function it_throws_an_exception_when_trying_to_publish_a_question_without $question->publish(); } - /** @test */ + #[Test] public function it_throws_an_exception_when_trying_to_publish_a_question_without_a_correct_choice(): void { $this->withoutExceptionHandling(); @@ -222,7 +223,7 @@ public function it_throws_an_exception_when_trying_to_publish_a_question_without $question->publish(); } - /** @test */ + #[Test] public function it_publishes_question_when_date_is_on_the_past(): void { /** @var Question $question */ @@ -238,7 +239,7 @@ public function it_publishes_question_when_date_is_on_the_past(): void $this->assertEquals(Question::PUBLISH_STATUS, $question->status); } - /** @test */ + #[Test] public function it_schedules_question_publication_when_date_is_in_the_future(): void { /** @var Question $question */ @@ -254,7 +255,7 @@ public function it_schedules_question_publication_when_date_is_in_the_future(): $this->assertEquals(Question::FUTURE_STATUS, $question->status); } - /** @test */ + #[Test] public function it_does_not_trigger_an_event_when_publish_fails(): void { /** @var Question $question */ @@ -279,7 +280,7 @@ public function it_does_not_trigger_an_event_when_publish_fails(): void * @see \Gamify\Presenters\QuestionPresenter */ - /** @test */ + #[Test] public function it_returns_formatted_publication_date_using_presenter(): void { /** @var Question $question */ @@ -291,7 +292,7 @@ public function it_returns_formatted_publication_date_using_presenter(): void $this->assertEquals('2020-01-02 03:04', $question->present()->publicationDate); } - /** @test */ + #[Test] public function it_returns_empty_string_when_publication_date_is_not_set_using_presenter(): void { /** @var Question $question */ @@ -303,7 +304,7 @@ public function it_returns_empty_string_when_publication_date_is_not_set_using_p $this->assertEquals('', $question->present()->publicationDate); } - /** @test */ + #[Test] public function it_should_return_the_hash_of_the_question(): void { /** @var Question $question */ diff --git a/tests/Feature/Models/UserResponseTest.php b/tests/Feature/Models/UserResponseTest.php index 3d9550bb..1ebcdd12 100644 --- a/tests/Feature/Models/UserResponseTest.php +++ b/tests/Feature/Models/UserResponseTest.php @@ -25,6 +25,8 @@ namespace Tests\Feature\Models; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; use Gamify\Models\Question; use Gamify\Models\User; use Gamify\Models\UserResponse; @@ -35,11 +37,8 @@ class UserResponseTest extends TestCase { use WithFaker; - /** - * @test - * - * @dataProvider providesScoreForUserResponseTest - */ + #[Test] + #[DataProvider('providesScoreForUserResponseTest')] public function it_should_return_the_user_response_score_of_a_question( int $score, int $want, @@ -87,7 +86,7 @@ public static function providesScoreForUserResponseTest(): \Generator ]; } - /** @test */ + #[Test] public function it_should_return_the_user_response_choices_of_a_question(): void { /** @var Question $question */ @@ -117,7 +116,7 @@ public function it_should_return_the_user_response_choices_of_a_question(): void $this->assertEquals($choices, $response->choices()); } - /** @test */ + #[Test] public function it_should_return_if_a_choice_is_within_the_user_response_of_a_question(): void { /** @var Question $question */ diff --git a/tests/Feature/Models/UserTest.php b/tests/Feature/Models/UserTest.php index bfc6e4b6..0651a406 100644 --- a/tests/Feature/Models/UserTest.php +++ b/tests/Feature/Models/UserTest.php @@ -25,6 +25,8 @@ namespace Tests\Feature\Models; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; use Gamify\Models\Badge; use Gamify\Models\Level; use Gamify\Models\Point; @@ -37,11 +39,8 @@ class UserTest extends TestCase { - /** - * @test - * - * @dataProvider providesPendingVisibleQuestionsPaginationTestCases - */ + #[Test] + #[DataProvider('providesPendingVisibleQuestionsPaginationTestCases')] public function it_should_paginate_the_public_questions_pending_to_be_answered( int $questions_count, int $per_page_limit, @@ -86,7 +85,7 @@ public static function providesPendingVisibleQuestionsPaginationTestCases(): \Ge ]; } - /** @test */ + #[Test] public function it_should_return_the_default_image_when_avatar_is_not_set(): void { /** @var User $user */ @@ -95,7 +94,7 @@ public function it_should_return_the_default_image_when_avatar_is_not_set(): voi $this->assertEquals('/images/missing_profile.png', $user->profile->avatarUrl); } - /** @test */ + #[Test] public function getCompletedBadges_returns_a_collection(): void { /** @var User $user */ @@ -104,7 +103,7 @@ public function getCompletedBadges_returns_a_collection(): void $this->assertInstanceOf(Collection::class, $user->unlockedBadges()); } - /** @test */ + #[Test] public function getCompletedBadges_returns_empty_collection_when_no_badges(): void { /** @var User $user */ @@ -113,7 +112,7 @@ public function getCompletedBadges_returns_empty_collection_when_no_badges(): vo $this->assertCount(0, $user->unlockedBadges()); } - /** @test */ + #[Test] public function hasBadgeCompleted_returns_false_when_badge_is_not_completed(): void { /** @var User $user */ @@ -125,7 +124,7 @@ public function hasBadgeCompleted_returns_false_when_badge_is_not_completed(): v $this->assertFalse($user->hasUnlockedBadge($badge)); } - /** @test */ + #[Test] public function hasBadgeCompleted_returns_false_when_badge_is_completed(): void { /** @var User $user */ @@ -142,7 +141,7 @@ public function hasBadgeCompleted_returns_false_when_badge_is_completed(): void $this->assertTrue($user->hasUnlockedBadge($badge)); } - /** @test */ + #[Test] public function it_should_get_empty_string_when_birthdate_is_not_set(): void { /** @var User $user */ @@ -153,11 +152,8 @@ public function it_should_get_empty_string_when_birthdate_is_not_set(): void $this->assertEmpty($user->present()->birthdate); } - /** - * @test - * - * @dataProvider providesPointsToNextLevelTestCases - */ + #[Test] + #[DataProvider('providesPointsToNextLevelTestCases')] public function it_should_return_points_to_the_next_level( int $experience, int $nextLevelExperience, @@ -211,11 +207,8 @@ public static function providesPointsToNextLevelTestCases(): \Generator ]; } - /** - * @test - * - * @dataProvider providesNextLevelCompletionTestCases - */ + #[Test] + #[DataProvider('providesNextLevelCompletionTestCases')] public function it_should_return_level_completion( int $experience, int $nextLevelExperience, @@ -269,7 +262,7 @@ public static function providesNextLevelCompletionTestCases(): \Generator ]; } - /** @test */ + #[Test] public function it_should_return_the_user_response_of_a_question(): void { /** @var Question $question */ @@ -291,7 +284,7 @@ public function it_should_return_the_user_response_of_a_question(): void $this->assertInstanceOf(UserResponse::class, $response); } - /** @test */ + #[Test] public function it_should_return_the_user_progress_for_a_badge(): void { /** @var Badge $badge */ diff --git a/tests/Feature/Presenters/QuestionPresenterTest.php b/tests/Feature/Presenters/QuestionPresenterTest.php index a9306140..d728c252 100644 --- a/tests/Feature/Presenters/QuestionPresenterTest.php +++ b/tests/Feature/Presenters/QuestionPresenterTest.php @@ -25,13 +25,14 @@ namespace Tests\Feature\Presenters; +use PHPUnit\Framework\Attributes\Test; use Gamify\Models\Question; use Gamify\Models\User; use Tests\Feature\TestCase; class QuestionPresenterTest extends TestCase { - /** @test */ + #[Test] public function it_should_return_not_available_when_the_creator_is_not_set(): void { /** @var Question $question */ @@ -42,7 +43,7 @@ public function it_should_return_not_available_when_the_creator_is_not_set(): vo $this->assertEquals('N/A', $question->present()->creator()); } - /** @test */ + #[Test] public function it_should_return_the_creator_of_a_question(): void { /** @var Question $question */ @@ -87,7 +88,7 @@ public function it_should_return_the_creator_of_a_question(): void $this->assertEquals($user->username, $newQuestion->present()->creator()); } - /** @test */ + #[Test] public function it_should_return_not_available_when_the_updater_is_not_set(): void { /** @var Question $question */ @@ -98,7 +99,7 @@ public function it_should_return_not_available_when_the_updater_is_not_set(): vo $this->assertEquals('N/A', $question->present()->updater()); } - /** @test */ + #[Test] public function it_should_return_the_updater_of_a_question(): void { /** @var Question $question */ diff --git a/tests/Feature/Services/SocialAccountServiceTest.php b/tests/Feature/Services/SocialAccountServiceTest.php index e4642e47..34c411c3 100644 --- a/tests/Feature/Services/SocialAccountServiceTest.php +++ b/tests/Feature/Services/SocialAccountServiceTest.php @@ -25,6 +25,7 @@ namespace Tests\Feature\Services; +use PHPUnit\Framework\Attributes\Test; use Gamify\Models\LinkedSocialAccount; use Gamify\Models\User; use Gamify\Services\SocialAccountService; @@ -36,7 +37,7 @@ class SocialAccountServiceTest extends TestCase const EXTERNAL_USER_ID = 'external-id'; - /** @test * */ + #[Test] public function it_creates_social_account_when_the_user_does_not_exist(): void { /** @var User $want */ @@ -66,7 +67,7 @@ public function it_creates_social_account_when_the_user_does_not_exist(): void ]); } - /** @test * */ + #[Test] public function it_creates_social_account_when_the_user_exists(): void { /** @var User $want */ @@ -92,7 +93,7 @@ public function it_creates_social_account_when_the_user_exists(): void ]); } - /** @test * */ + #[Test] public function it_creates_an_user_with_an_unique_username_when_the_username_is_already_in_use(): void { User::factory()->create([ @@ -130,7 +131,7 @@ public function it_creates_an_user_with_an_unique_username_when_the_username_is_ ]); } - /** @test * */ + #[Test] public function it_returns_the_user_which_has_the_related_social_account(): void { /** @var User $want */ diff --git a/tests/Feature/Services/UsernameGeneratorServiceTest.php b/tests/Feature/Services/UsernameGeneratorServiceTest.php index f1b6f48f..18c641ea 100644 --- a/tests/Feature/Services/UsernameGeneratorServiceTest.php +++ b/tests/Feature/Services/UsernameGeneratorServiceTest.php @@ -25,17 +25,16 @@ namespace Tests\Feature\Services; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; use Gamify\Models\User; use Gamify\Services\UsernameGeneratorService; use Tests\Feature\TestCase; class UsernameGeneratorServiceTest extends TestCase { - /** - * @test - * - * @dataProvider providesTestCasesForUsernameCreationFromText - */ + #[Test] + #[DataProvider('providesTestCasesForUsernameCreationFromText')] public function it_should_return_a_username_from_the_text( string $input, string $want @@ -72,11 +71,8 @@ public static function providesTestCasesForUsernameCreationFromText(): \Generato ]; } - /** - * @test - * - * @dataProvider providesTestCasesForUsernameCreationFromEmail - */ + #[Test] + #[DataProvider('providesTestCasesForUsernameCreationFromEmail')] public function it_should_return_a_username_from_the_email( string $input, string $want @@ -103,7 +99,7 @@ public static function providesTestCasesForUsernameCreationFromEmail(): \Generat ]; } - /** @test */ + #[Test] public function it_should_raise_exception_if_email_is_not_valid(): void { $generator = new UsernameGeneratorService(); diff --git a/tests/Feature/Views/Components/Tags/FormSelectTagsTest.php b/tests/Feature/Views/Components/Tags/FormSelectTagsTest.php index 5fd3db51..6dbe056b 100644 --- a/tests/Feature/Views/Components/Tags/FormSelectTagsTest.php +++ b/tests/Feature/Views/Components/Tags/FormSelectTagsTest.php @@ -25,13 +25,14 @@ namespace Tests\Feature\Views\Components\Tags; +use PHPUnit\Framework\Attributes\Test; use Gamify\Models\Question; use Gamify\View\Components\Tags\FormSelectTags; use Tests\Feature\TestCase; class FormSelectTagsTest extends TestCase { - /** @test */ + #[Test] public function it_should_render_the_tags_component(): void { // Create some tags by tagging a model. diff --git a/tests/Unit/Models/LevelTest.php b/tests/Unit/Models/LevelTest.php index 61f1ec1b..7d8a0c38 100644 --- a/tests/Unit/Models/LevelTest.php +++ b/tests/Unit/Models/LevelTest.php @@ -25,6 +25,7 @@ namespace Tests\Unit\Models; +use PHPUnit\Framework\Attributes\Test; use Gamify\Models\Level; use Tests\TestCase; @@ -50,7 +51,7 @@ public function test_contains_valid_casts_properties(): void ], $m->getCasts()); } - /** @test */ + #[Test] public function it_returns_the_default_level(): void { $level = Level::defaultLevel(); diff --git a/tests/Unit/Models/PointTest.php b/tests/Unit/Models/PointTest.php index f38f8e2f..ede36032 100644 --- a/tests/Unit/Models/PointTest.php +++ b/tests/Unit/Models/PointTest.php @@ -25,13 +25,14 @@ namespace Tests\Unit\Models; +use PHPUnit\Framework\Attributes\Test; use Gamify\Models\Point; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Tests\TestCase; class PointTest extends TestCase { - /** @test */ + #[Test] public function it_should_contain_valid_fillable_properties(): void { $m = new Point(); @@ -41,7 +42,7 @@ public function it_should_contain_valid_fillable_properties(): void ], $m->getFillable()); } - /** @test */ + #[Test] public function it_should_contain_valid_casts_properties(): void { $m = new Point(); @@ -50,7 +51,7 @@ public function it_should_contain_valid_casts_properties(): void ], $m->getCasts()); } - /** @test */ + #[Test] public function it_should_have_a_user_relation(): void { $m = new Point(); diff --git a/tests/Unit/Models/QuestionChoiceTest.php b/tests/Unit/Models/QuestionChoiceTest.php index 47aebf36..e96c4570 100644 --- a/tests/Unit/Models/QuestionChoiceTest.php +++ b/tests/Unit/Models/QuestionChoiceTest.php @@ -25,6 +25,7 @@ namespace Tests\Unit\Models; +use PHPUnit\Framework\Attributes\Test; use Gamify\Models\QuestionChoice; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Tests\TestCase; @@ -55,7 +56,7 @@ public function test_question_relation(): void $this->assertInstanceOf(BelongsTo::class, $r); } - /** @test */ + #[Test] public function it_is_considered_correct_when_score_is_positive(): void { $m = new QuestionChoice(); @@ -64,7 +65,7 @@ public function it_is_considered_correct_when_score_is_positive(): void $this->assertTrue($m->isCorrect()); } - /** @test */ + #[Test] public function it_is_considered_incorrect_when_score_is_zero(): void { $m = new QuestionChoice(); @@ -73,7 +74,7 @@ public function it_is_considered_incorrect_when_score_is_zero(): void $this->assertFalse($m->isCorrect()); } - /** @test */ + #[Test] public function it_is_considered_incorrect_when_score_is_negative(): void { $m = new QuestionChoice(); diff --git a/tests/Unit/Models/QuestionTest.php b/tests/Unit/Models/QuestionTest.php index 3ad7ed97..0d5e2ccc 100644 --- a/tests/Unit/Models/QuestionTest.php +++ b/tests/Unit/Models/QuestionTest.php @@ -25,6 +25,7 @@ namespace Tests\Unit\Models; +use PHPUnit\Framework\Attributes\Test; use Gamify\Models\Question; use Illuminate\Database\Eloquent\Relations\HasMany; use Tests\TestCase; @@ -82,7 +83,7 @@ public function test_excerpt_method(): void } } - /** @test */ + #[Test] public function it_should_return_the_slug_of_the_question(): void { /** @var Question $question */ diff --git a/tests/Unit/Models/UserTest.php b/tests/Unit/Models/UserTest.php index 5676a6d0..52c45850 100644 --- a/tests/Unit/Models/UserTest.php +++ b/tests/Unit/Models/UserTest.php @@ -25,6 +25,8 @@ namespace Tests\Unit\Models; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; use Gamify\Enums\Roles; use Gamify\Models\Level; use Gamify\Models\User; @@ -37,7 +39,7 @@ class UserTest extends TestCase { - /** @test */ + #[Test] public function contains_valid_fillable_properties(): void { $m = new User(); @@ -51,7 +53,7 @@ public function contains_valid_fillable_properties(): void ], $m->getFillable()); } - /** @test */ + #[Test] public function contains_valid_hidden_properties(): void { $m = new User(); @@ -62,7 +64,7 @@ public function contains_valid_hidden_properties(): void ], $m->getHidden()); } - /** @test */ + #[Test] public function contains_valid_casts_properties(): void { $m = new User(); @@ -75,11 +77,8 @@ public function contains_valid_casts_properties(): void ], $m->getCasts()); } - /** - * @test - * - * @dataProvider provideDataToTestAdminMembership - */ + #[Test] + #[DataProvider('provideDataToTestAdminMembership')] public function it_should_return_if_user_is_admin( string $role, bool $shouldBeAdmin, @@ -104,7 +103,7 @@ public static function provideDataToTestAdminMembership(): Generator ]; } - /** @test */ + #[Test] public function profile_relation(): void { $m = new User(); @@ -114,7 +113,7 @@ public function profile_relation(): void $this->assertInstanceOf(HasOne::class, $r); } - /** @test */ + #[Test] public function answeredQuestions_relation(): void { $m = new User(); @@ -124,7 +123,7 @@ public function answeredQuestions_relation(): void $this->assertInstanceOf(BelongsToMany::class, $r); } - /** @test */ + #[Test] public function badges_relation(): void { $m = new User(); @@ -134,7 +133,7 @@ public function badges_relation(): void $this->assertInstanceOf(BelongsToMany::class, $r); } - /** @test */ + #[Test] public function points_relation(): void { $m = new User(); @@ -144,7 +143,7 @@ public function points_relation(): void $this->assertInstanceOf(HasMany::class, $r); } - /** @test */ + #[Test] public function accounts_relation(): void { $m = new User(); @@ -154,11 +153,8 @@ public function accounts_relation(): void $this->assertInstanceOf(HasMany::class, $r); } - /** - * @test - * - * @dataProvider provideTestCasesForUsername - */ + #[Test] + #[DataProvider('provideTestCasesForUsername')] public function lowercase_username_when_set( string $input, string $want, @@ -193,7 +189,7 @@ public static function provideTestCasesForUsername(): Generator ]; } - /** @test */ + #[Test] public function hashes_password_when_set(): void { Hash::shouldReceive('make')->once()->andReturn('hashed'); diff --git a/tests/Unit/Rules/UsernameRuleTest.php b/tests/Unit/Rules/UsernameRuleTest.php index fab43ce1..d0a42640 100644 --- a/tests/Unit/Rules/UsernameRuleTest.php +++ b/tests/Unit/Rules/UsernameRuleTest.php @@ -25,6 +25,8 @@ namespace Tests\Unit\Rules; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; use Gamify\Rules\UsernameRule; use Generator; use Illuminate\Support\Facades\Validator; @@ -32,11 +34,8 @@ class UsernameRuleTest extends TestCase { - /** - * @test - * - * @dataProvider providesWrongUsernames - */ + #[Test] + #[DataProvider('providesWrongUsernames')] public function it_should_fail_with_wrong_usernames( string $input ): void { @@ -71,11 +70,8 @@ public static function providesWrongUsernames(): Generator ]; } - /** - * @test - * - * @dataProvider providesValidUsernames - */ + #[Test] + #[DataProvider('providesValidUsernames')] public function it_should_pass_valid_usernames( string $input ): void { diff --git a/tests/Unit/Services/HashIdServiceTest.php b/tests/Unit/Services/HashIdServiceTest.php index 70403f70..64508961 100644 --- a/tests/Unit/Services/HashIdServiceTest.php +++ b/tests/Unit/Services/HashIdServiceTest.php @@ -25,12 +25,13 @@ namespace Tests\Unit\Services; +use PHPUnit\Framework\Attributes\Test; use Gamify\Services\HashIdService; use Tests\TestCase; class HashIdServiceTest extends TestCase { - /** @test */ + #[Test] public function it_should_get_the_same_number_after_encoding_it_and_decoding_it(): void { $input = fake()->randomNumber(); @@ -41,7 +42,7 @@ public function it_should_get_the_same_number_after_encoding_it_and_decoding_it( $this->assertEquals($input, $s->decode($hash)); } - /** @test */ + #[Test] public function it_should_return_the_hash_of_the_input(): void { $number = fake()->randomNumber(); @@ -51,7 +52,7 @@ public function it_should_return_the_hash_of_the_input(): void $this->assertNotEquals($number, $s->encode($number)); } - /** @test */ + #[Test] public function it_should_return_the_same_if_input_is_not_a_hash(): void { $number = fake()->randomNumber(); From 48cc64fb89016626bad0829fb6f380825d429c19 Mon Sep 17 00:00:00 2001 From: Shift Date: Fri, 8 Mar 2024 18:41:03 +0000 Subject: [PATCH 3/3] Define test classes as `final` --- tests/Feature/Actions/CreateUserTest.php | 2 +- tests/Feature/Actions/PublishQuestionActionTest.php | 2 +- tests/Feature/Auth/AuthenticationTest.php | 2 +- tests/Feature/Auth/EmailVerificationTest.php | 2 +- tests/Feature/Auth/PasswordConfirmationTest.php | 2 +- tests/Feature/Auth/PasswordResetTest.php | 2 +- tests/Feature/Auth/RegistrationTest.php | 2 +- tests/Feature/Auth/SocialAuthenticationTest.php | 2 +- .../Feature/Console/Commands/PublishScheduledQuestionsTest.php | 2 +- .../Http/Controllers/Account/ChangePasswordControllerTest.php | 2 +- .../Feature/Http/Controllers/Account/ProfileControllerTest.php | 2 +- .../Feature/Http/Controllers/Admin/AdminBadgeControllerTest.php | 2 +- .../Controllers/Admin/AdminBadgeDataTablesControllerTest.php | 2 +- .../Http/Controllers/Admin/AdminDashboardControllerTest.php | 2 +- .../Feature/Http/Controllers/Admin/AdminLevelControllerTest.php | 2 +- .../Controllers/Admin/AdminLevelDataTablesControllerTest.php | 2 +- .../Http/Controllers/Admin/AdminQuestionControllerTest.php | 2 +- .../Controllers/Admin/AdminQuestionDataTablesControllerTest.php | 2 +- .../Http/Controllers/Admin/AdminRewardControllerTest.php | 2 +- .../Feature/Http/Controllers/Admin/AdminUserControllerTest.php | 2 +- .../Controllers/Admin/AdminUserDataTablesControllerTest.php | 2 +- tests/Feature/Http/Controllers/HomeControllerTest.php | 2 +- tests/Feature/Http/Controllers/LeaderBoardControllerTest.php | 2 +- .../Http/Controllers/MarkNotificationAsReadControllerTest.php | 2 +- tests/Feature/Http/Controllers/QuestionControllerTest.php | 2 +- .../Feature/Http/Controllers/ShowUserProfileControllerTest.php | 2 +- tests/Feature/Http/Middleware/OnlyAjaxTest.php | 2 +- tests/Feature/Http/Middleware/RedirectIfAuthenticatedTest.php | 2 +- tests/Feature/Libs/Game/GameTest.php | 2 +- tests/Feature/Listeners/AddBadgesOnAvatarUploadedTest.php | 2 +- tests/Feature/Listeners/AddBadgesOnProfileUpdatedTest.php | 2 +- tests/Feature/Listeners/AddBadgesOnQuestionAnsweredTest.php | 2 +- tests/Feature/Listeners/AddBadgesOnUserLoggedInTest.php | 2 +- tests/Feature/Listeners/AddReputationTest.php | 2 +- tests/Feature/Listeners/UpdateCachedUserExperienceTest.php | 2 +- tests/Feature/Models/BadgeTest.php | 2 +- tests/Feature/Models/LevelTest.php | 2 +- tests/Feature/Models/QuestionTest.php | 2 +- tests/Feature/Models/UserResponseTest.php | 2 +- tests/Feature/Models/UserTest.php | 2 +- tests/Feature/Presenters/QuestionPresenterTest.php | 2 +- tests/Feature/Services/SocialAccountServiceTest.php | 2 +- tests/Feature/Services/UsernameGeneratorServiceTest.php | 2 +- tests/Feature/Views/Components/Tags/FormSelectTagsTest.php | 2 +- tests/Unit/Models/BadgeTest.php | 2 +- tests/Unit/Models/LevelTest.php | 2 +- tests/Unit/Models/LinkedSocialAccountTest.php | 2 +- tests/Unit/Models/PointTest.php | 2 +- tests/Unit/Models/QuestionChoiceTest.php | 2 +- tests/Unit/Models/QuestionTest.php | 2 +- tests/Unit/Models/UserProfileTest.php | 2 +- tests/Unit/Models/UserTest.php | 2 +- tests/Unit/Rules/UsernameRuleTest.php | 2 +- tests/Unit/Services/HashIdServiceTest.php | 2 +- 54 files changed, 54 insertions(+), 54 deletions(-) diff --git a/tests/Feature/Actions/CreateUserTest.php b/tests/Feature/Actions/CreateUserTest.php index a65f07cc..857de63b 100644 --- a/tests/Feature/Actions/CreateUserTest.php +++ b/tests/Feature/Actions/CreateUserTest.php @@ -31,7 +31,7 @@ use Gamify\Models\UserProfile; use Tests\Feature\TestCase; -class CreateUserTest extends TestCase +final class CreateUserTest extends TestCase { #[Test] public function it_should_create_a_user_with_its_profile(): void diff --git a/tests/Feature/Actions/PublishQuestionActionTest.php b/tests/Feature/Actions/PublishQuestionActionTest.php index 7e55bc4d..91dae168 100644 --- a/tests/Feature/Actions/PublishQuestionActionTest.php +++ b/tests/Feature/Actions/PublishQuestionActionTest.php @@ -34,7 +34,7 @@ use Illuminate\Support\Facades\Event; use Tests\Feature\TestCase; -class PublishQuestionActionTest extends TestCase +final class PublishQuestionActionTest extends TestCase { #[Test] public function it_triggers_an_event_when_a_question_is_published(): void diff --git a/tests/Feature/Auth/AuthenticationTest.php b/tests/Feature/Auth/AuthenticationTest.php index 0b43f192..c31fe76e 100644 --- a/tests/Feature/Auth/AuthenticationTest.php +++ b/tests/Feature/Auth/AuthenticationTest.php @@ -8,7 +8,7 @@ use Illuminate\Support\Facades\Event; use Tests\Feature\TestCase; -class AuthenticationTest extends TestCase +final class AuthenticationTest extends TestCase { public function test_login_screen_can_be_rendered(): void { diff --git a/tests/Feature/Auth/EmailVerificationTest.php b/tests/Feature/Auth/EmailVerificationTest.php index 437f07a0..936568f4 100644 --- a/tests/Feature/Auth/EmailVerificationTest.php +++ b/tests/Feature/Auth/EmailVerificationTest.php @@ -9,7 +9,7 @@ use Illuminate\Support\Facades\URL; use Tests\Feature\TestCase; -class EmailVerificationTest extends TestCase +final class EmailVerificationTest extends TestCase { public function test_email_verification_screen_can_be_rendered(): void { diff --git a/tests/Feature/Auth/PasswordConfirmationTest.php b/tests/Feature/Auth/PasswordConfirmationTest.php index 553cf4e2..85b5b2ed 100644 --- a/tests/Feature/Auth/PasswordConfirmationTest.php +++ b/tests/Feature/Auth/PasswordConfirmationTest.php @@ -5,7 +5,7 @@ use Gamify\Models\User; use Tests\Feature\TestCase; -class PasswordConfirmationTest extends TestCase +final class PasswordConfirmationTest extends TestCase { public function test_confirm_password_screen_can_be_rendered(): void { diff --git a/tests/Feature/Auth/PasswordResetTest.php b/tests/Feature/Auth/PasswordResetTest.php index 1a8bfdf4..66884af8 100644 --- a/tests/Feature/Auth/PasswordResetTest.php +++ b/tests/Feature/Auth/PasswordResetTest.php @@ -7,7 +7,7 @@ use Illuminate\Support\Facades\Notification; use Tests\Feature\TestCase; -class PasswordResetTest extends TestCase +final class PasswordResetTest extends TestCase { public function test_reset_password_link_screen_can_be_rendered(): void { diff --git a/tests/Feature/Auth/RegistrationTest.php b/tests/Feature/Auth/RegistrationTest.php index 508363fc..010c356f 100644 --- a/tests/Feature/Auth/RegistrationTest.php +++ b/tests/Feature/Auth/RegistrationTest.php @@ -9,7 +9,7 @@ use Generator; use Tests\Feature\TestCase; -class RegistrationTest extends TestCase +final class RegistrationTest extends TestCase { public function test_registration_screen_can_be_rendered(): void { diff --git a/tests/Feature/Auth/SocialAuthenticationTest.php b/tests/Feature/Auth/SocialAuthenticationTest.php index b12ecace..071f051e 100644 --- a/tests/Feature/Auth/SocialAuthenticationTest.php +++ b/tests/Feature/Auth/SocialAuthenticationTest.php @@ -10,7 +10,7 @@ use Mockery; use Tests\Feature\TestCase; -class SocialAuthenticationTest extends TestCase +final class SocialAuthenticationTest extends TestCase { #[Test] public function it_should_authenticate_users_using_social_login(): void diff --git a/tests/Feature/Console/Commands/PublishScheduledQuestionsTest.php b/tests/Feature/Console/Commands/PublishScheduledQuestionsTest.php index 89d6ff25..32f2781a 100644 --- a/tests/Feature/Console/Commands/PublishScheduledQuestionsTest.php +++ b/tests/Feature/Console/Commands/PublishScheduledQuestionsTest.php @@ -29,7 +29,7 @@ use Gamify\Models\Question; use Tests\Feature\TestCase; -class PublishScheduledQuestionsTest extends TestCase +final class PublishScheduledQuestionsTest extends TestCase { #[Test] public function it_should_not_publish_questions_if_it_is_not_the_right_time_yet(): void diff --git a/tests/Feature/Http/Controllers/Account/ChangePasswordControllerTest.php b/tests/Feature/Http/Controllers/Account/ChangePasswordControllerTest.php index 69035683..9ad421e8 100644 --- a/tests/Feature/Http/Controllers/Account/ChangePasswordControllerTest.php +++ b/tests/Feature/Http/Controllers/Account/ChangePasswordControllerTest.php @@ -30,7 +30,7 @@ use Illuminate\Support\Facades\Hash; use Tests\Feature\TestCase; -class ChangePasswordControllerTest extends TestCase +final class ChangePasswordControllerTest extends TestCase { const VALID_PASSWORD = 'foo#B4rBaz'; diff --git a/tests/Feature/Http/Controllers/Account/ProfileControllerTest.php b/tests/Feature/Http/Controllers/Account/ProfileControllerTest.php index da756a4d..62d3ce6b 100644 --- a/tests/Feature/Http/Controllers/Account/ProfileControllerTest.php +++ b/tests/Feature/Http/Controllers/Account/ProfileControllerTest.php @@ -38,7 +38,7 @@ use Illuminate\Support\Facades\Storage; use Tests\Feature\TestCase; -class ProfileControllerTest extends TestCase +final class ProfileControllerTest extends TestCase { private User $user; diff --git a/tests/Feature/Http/Controllers/Admin/AdminBadgeControllerTest.php b/tests/Feature/Http/Controllers/Admin/AdminBadgeControllerTest.php index 3c384e30..0ceedeff 100644 --- a/tests/Feature/Http/Controllers/Admin/AdminBadgeControllerTest.php +++ b/tests/Feature/Http/Controllers/Admin/AdminBadgeControllerTest.php @@ -33,7 +33,7 @@ use Generator; use Tests\Feature\TestCase; -class AdminBadgeControllerTest extends TestCase +final class AdminBadgeControllerTest extends TestCase { private User $user; diff --git a/tests/Feature/Http/Controllers/Admin/AdminBadgeDataTablesControllerTest.php b/tests/Feature/Http/Controllers/Admin/AdminBadgeDataTablesControllerTest.php index 8ea8c825..2643cbb4 100644 --- a/tests/Feature/Http/Controllers/Admin/AdminBadgeDataTablesControllerTest.php +++ b/tests/Feature/Http/Controllers/Admin/AdminBadgeDataTablesControllerTest.php @@ -31,7 +31,7 @@ use Gamify\Models\User; use Tests\Feature\TestCase; -class AdminBadgeDataTablesControllerTest extends TestCase +final class AdminBadgeDataTablesControllerTest extends TestCase { private User $user; diff --git a/tests/Feature/Http/Controllers/Admin/AdminDashboardControllerTest.php b/tests/Feature/Http/Controllers/Admin/AdminDashboardControllerTest.php index c992ea1c..af84aa2a 100644 --- a/tests/Feature/Http/Controllers/Admin/AdminDashboardControllerTest.php +++ b/tests/Feature/Http/Controllers/Admin/AdminDashboardControllerTest.php @@ -29,7 +29,7 @@ use Gamify\Models\User; use Tests\Feature\TestCase; -class AdminDashboardControllerTest extends TestCase +final class AdminDashboardControllerTest extends TestCase { protected function setUp(): void { diff --git a/tests/Feature/Http/Controllers/Admin/AdminLevelControllerTest.php b/tests/Feature/Http/Controllers/Admin/AdminLevelControllerTest.php index 6575f3a6..71d7487a 100644 --- a/tests/Feature/Http/Controllers/Admin/AdminLevelControllerTest.php +++ b/tests/Feature/Http/Controllers/Admin/AdminLevelControllerTest.php @@ -33,7 +33,7 @@ use Generator; use Tests\Feature\TestCase; -class AdminLevelControllerTest extends TestCase +final class AdminLevelControllerTest extends TestCase { private User $user; diff --git a/tests/Feature/Http/Controllers/Admin/AdminLevelDataTablesControllerTest.php b/tests/Feature/Http/Controllers/Admin/AdminLevelDataTablesControllerTest.php index a445362c..86721a8d 100644 --- a/tests/Feature/Http/Controllers/Admin/AdminLevelDataTablesControllerTest.php +++ b/tests/Feature/Http/Controllers/Admin/AdminLevelDataTablesControllerTest.php @@ -31,7 +31,7 @@ use Gamify\Models\User; use Tests\Feature\TestCase; -class AdminLevelDataTablesControllerTest extends TestCase +final class AdminLevelDataTablesControllerTest extends TestCase { private User $user; diff --git a/tests/Feature/Http/Controllers/Admin/AdminQuestionControllerTest.php b/tests/Feature/Http/Controllers/Admin/AdminQuestionControllerTest.php index 24cc608c..733f762a 100644 --- a/tests/Feature/Http/Controllers/Admin/AdminQuestionControllerTest.php +++ b/tests/Feature/Http/Controllers/Admin/AdminQuestionControllerTest.php @@ -33,7 +33,7 @@ use Tests\DataGenerator\QuestionDataGenerator; use Tests\Feature\TestCase; -class AdminQuestionControllerTest extends TestCase +final class AdminQuestionControllerTest extends TestCase { protected function setUp(): void { diff --git a/tests/Feature/Http/Controllers/Admin/AdminQuestionDataTablesControllerTest.php b/tests/Feature/Http/Controllers/Admin/AdminQuestionDataTablesControllerTest.php index 9f3f9262..b131caeb 100644 --- a/tests/Feature/Http/Controllers/Admin/AdminQuestionDataTablesControllerTest.php +++ b/tests/Feature/Http/Controllers/Admin/AdminQuestionDataTablesControllerTest.php @@ -31,7 +31,7 @@ use Gamify\Models\User; use Tests\Feature\TestCase; -class AdminQuestionDataTablesControllerTest extends TestCase +final class AdminQuestionDataTablesControllerTest extends TestCase { private User $user; diff --git a/tests/Feature/Http/Controllers/Admin/AdminRewardControllerTest.php b/tests/Feature/Http/Controllers/Admin/AdminRewardControllerTest.php index 7b80537e..95f8292a 100644 --- a/tests/Feature/Http/Controllers/Admin/AdminRewardControllerTest.php +++ b/tests/Feature/Http/Controllers/Admin/AdminRewardControllerTest.php @@ -34,7 +34,7 @@ use Illuminate\Foundation\Testing\WithFaker; use Tests\Feature\TestCase; -class AdminRewardControllerTest extends TestCase +final class AdminRewardControllerTest extends TestCase { use WithFaker; diff --git a/tests/Feature/Http/Controllers/Admin/AdminUserControllerTest.php b/tests/Feature/Http/Controllers/Admin/AdminUserControllerTest.php index 8a3b95e6..e76b9c1f 100644 --- a/tests/Feature/Http/Controllers/Admin/AdminUserControllerTest.php +++ b/tests/Feature/Http/Controllers/Admin/AdminUserControllerTest.php @@ -32,7 +32,7 @@ use Generator; use Tests\Feature\TestCase; -class AdminUserControllerTest extends TestCase +final class AdminUserControllerTest extends TestCase { private User $user; diff --git a/tests/Feature/Http/Controllers/Admin/AdminUserDataTablesControllerTest.php b/tests/Feature/Http/Controllers/Admin/AdminUserDataTablesControllerTest.php index 60de5de1..73977bba 100644 --- a/tests/Feature/Http/Controllers/Admin/AdminUserDataTablesControllerTest.php +++ b/tests/Feature/Http/Controllers/Admin/AdminUserDataTablesControllerTest.php @@ -30,7 +30,7 @@ use Gamify\Models\User; use Tests\Feature\TestCase; -class AdminUserDataTablesControllerTest extends TestCase +final class AdminUserDataTablesControllerTest extends TestCase { private User $user; diff --git a/tests/Feature/Http/Controllers/HomeControllerTest.php b/tests/Feature/Http/Controllers/HomeControllerTest.php index 223ffa12..7c9d0024 100644 --- a/tests/Feature/Http/Controllers/HomeControllerTest.php +++ b/tests/Feature/Http/Controllers/HomeControllerTest.php @@ -29,7 +29,7 @@ use Gamify\Models\User; use Tests\Feature\TestCase; -class HomeControllerTest extends TestCase +final class HomeControllerTest extends TestCase { #[Test] public function index_returns_proper_content(): void diff --git a/tests/Feature/Http/Controllers/LeaderBoardControllerTest.php b/tests/Feature/Http/Controllers/LeaderBoardControllerTest.php index e559986f..c3d05c62 100644 --- a/tests/Feature/Http/Controllers/LeaderBoardControllerTest.php +++ b/tests/Feature/Http/Controllers/LeaderBoardControllerTest.php @@ -28,7 +28,7 @@ use PHPUnit\Framework\Attributes\Test; use Tests\Feature\TestCase; -class LeaderBoardControllerTest extends TestCase +final class LeaderBoardControllerTest extends TestCase { #[Test] public function it_should_be_accessible_for_guests(): void diff --git a/tests/Feature/Http/Controllers/MarkNotificationAsReadControllerTest.php b/tests/Feature/Http/Controllers/MarkNotificationAsReadControllerTest.php index a9870221..4ee0816c 100644 --- a/tests/Feature/Http/Controllers/MarkNotificationAsReadControllerTest.php +++ b/tests/Feature/Http/Controllers/MarkNotificationAsReadControllerTest.php @@ -32,7 +32,7 @@ use Illuminate\Notifications\Notification; use Tests\Feature\TestCase; -class MarkNotificationAsReadControllerTest extends TestCase +final class MarkNotificationAsReadControllerTest extends TestCase { #[Test] public function it_should_mark_a_notification_as_read(): void diff --git a/tests/Feature/Http/Controllers/QuestionControllerTest.php b/tests/Feature/Http/Controllers/QuestionControllerTest.php index 27a4fa38..ee55c99d 100644 --- a/tests/Feature/Http/Controllers/QuestionControllerTest.php +++ b/tests/Feature/Http/Controllers/QuestionControllerTest.php @@ -33,7 +33,7 @@ use Illuminate\Support\Facades\Event; use Tests\Feature\TestCase; -class QuestionControllerTest extends TestCase +final class QuestionControllerTest extends TestCase { private User $user; diff --git a/tests/Feature/Http/Controllers/ShowUserProfileControllerTest.php b/tests/Feature/Http/Controllers/ShowUserProfileControllerTest.php index 1d3851b7..6308476b 100644 --- a/tests/Feature/Http/Controllers/ShowUserProfileControllerTest.php +++ b/tests/Feature/Http/Controllers/ShowUserProfileControllerTest.php @@ -29,7 +29,7 @@ use Gamify\Models\User; use Tests\Feature\TestCase; -class ShowUserProfileControllerTest extends TestCase +final class ShowUserProfileControllerTest extends TestCase { private User $user; diff --git a/tests/Feature/Http/Middleware/OnlyAjaxTest.php b/tests/Feature/Http/Middleware/OnlyAjaxTest.php index f3d3cc2a..8e915e5b 100644 --- a/tests/Feature/Http/Middleware/OnlyAjaxTest.php +++ b/tests/Feature/Http/Middleware/OnlyAjaxTest.php @@ -32,7 +32,7 @@ use Symfony\Component\HttpKernel\Exception\HttpException; use Tests\Feature\TestCase; -class OnlyAjaxTest extends TestCase +final class OnlyAjaxTest extends TestCase { const TEST_ENDPOINT = '/_test/ajax'; diff --git a/tests/Feature/Http/Middleware/RedirectIfAuthenticatedTest.php b/tests/Feature/Http/Middleware/RedirectIfAuthenticatedTest.php index 4dcd0394..b2f7e724 100644 --- a/tests/Feature/Http/Middleware/RedirectIfAuthenticatedTest.php +++ b/tests/Feature/Http/Middleware/RedirectIfAuthenticatedTest.php @@ -32,7 +32,7 @@ use Illuminate\Support\Facades\Route; use Tests\Feature\TestCase; -class RedirectIfAuthenticatedTest extends TestCase +final class RedirectIfAuthenticatedTest extends TestCase { const TEST_ENDPOINT = '/_test/only_for_guests'; diff --git a/tests/Feature/Libs/Game/GameTest.php b/tests/Feature/Libs/Game/GameTest.php index 38c61051..8d4799e2 100644 --- a/tests/Feature/Libs/Game/GameTest.php +++ b/tests/Feature/Libs/Game/GameTest.php @@ -35,7 +35,7 @@ use Illuminate\Support\Arr; use Tests\Feature\TestCase; -class GameTest extends TestCase +final class GameTest extends TestCase { #[Test] public function it_increments_repetitions_for_a_given_badge(): void diff --git a/tests/Feature/Listeners/AddBadgesOnAvatarUploadedTest.php b/tests/Feature/Listeners/AddBadgesOnAvatarUploadedTest.php index c80773d9..8d0a30e7 100644 --- a/tests/Feature/Listeners/AddBadgesOnAvatarUploadedTest.php +++ b/tests/Feature/Listeners/AddBadgesOnAvatarUploadedTest.php @@ -35,7 +35,7 @@ use Mockery; use Tests\Feature\TestCase; -class AddBadgesOnAvatarUploadedTest extends TestCase +final class AddBadgesOnAvatarUploadedTest extends TestCase { #[Test] public function it_should_listen_for_the_proper_event(): void diff --git a/tests/Feature/Listeners/AddBadgesOnProfileUpdatedTest.php b/tests/Feature/Listeners/AddBadgesOnProfileUpdatedTest.php index 82c7fd15..1623b184 100644 --- a/tests/Feature/Listeners/AddBadgesOnProfileUpdatedTest.php +++ b/tests/Feature/Listeners/AddBadgesOnProfileUpdatedTest.php @@ -38,7 +38,7 @@ use Mockery; use Tests\Feature\TestCase; -class AddBadgesOnProfileUpdatedTest extends TestCase +final class AddBadgesOnProfileUpdatedTest extends TestCase { #[Test] public function it_should_listen_for_the_proper_events(): void diff --git a/tests/Feature/Listeners/AddBadgesOnQuestionAnsweredTest.php b/tests/Feature/Listeners/AddBadgesOnQuestionAnsweredTest.php index 99109803..76dbb24b 100644 --- a/tests/Feature/Listeners/AddBadgesOnQuestionAnsweredTest.php +++ b/tests/Feature/Listeners/AddBadgesOnQuestionAnsweredTest.php @@ -37,7 +37,7 @@ use Mockery; use Tests\Feature\TestCase; -class AddBadgesOnQuestionAnsweredTest extends TestCase +final class AddBadgesOnQuestionAnsweredTest extends TestCase { #[Test] public function it_should_listen_for_the_proper_event(): void diff --git a/tests/Feature/Listeners/AddBadgesOnUserLoggedInTest.php b/tests/Feature/Listeners/AddBadgesOnUserLoggedInTest.php index 4a2fff0f..2aedfa2e 100644 --- a/tests/Feature/Listeners/AddBadgesOnUserLoggedInTest.php +++ b/tests/Feature/Listeners/AddBadgesOnUserLoggedInTest.php @@ -36,7 +36,7 @@ use Mockery; use Tests\Feature\TestCase; -class AddBadgesOnUserLoggedInTest extends TestCase +final class AddBadgesOnUserLoggedInTest extends TestCase { #[Test] public function it_should_listen_for_the_proper_event(): void diff --git a/tests/Feature/Listeners/AddReputationTest.php b/tests/Feature/Listeners/AddReputationTest.php index a98afb56..d1db6b27 100644 --- a/tests/Feature/Listeners/AddReputationTest.php +++ b/tests/Feature/Listeners/AddReputationTest.php @@ -34,7 +34,7 @@ use Mockery; use Tests\Feature\TestCase; -class AddReputationTest extends TestCase +final class AddReputationTest extends TestCase { #[Test] public function it_should_listen_for_the_proper_event(): void diff --git a/tests/Feature/Listeners/UpdateCachedUserExperienceTest.php b/tests/Feature/Listeners/UpdateCachedUserExperienceTest.php index 62907a9b..6f9f6090 100644 --- a/tests/Feature/Listeners/UpdateCachedUserExperienceTest.php +++ b/tests/Feature/Listeners/UpdateCachedUserExperienceTest.php @@ -34,7 +34,7 @@ use Illuminate\Support\Facades\Event; use Tests\Feature\TestCase; -class UpdateCachedUserExperienceTest extends TestCase +final class UpdateCachedUserExperienceTest extends TestCase { #[Test] public function it_should_listen_for_the_proper_event(): void diff --git a/tests/Feature/Models/BadgeTest.php b/tests/Feature/Models/BadgeTest.php index 6f1388ed..9a0f4a7e 100644 --- a/tests/Feature/Models/BadgeTest.php +++ b/tests/Feature/Models/BadgeTest.php @@ -30,7 +30,7 @@ use Gamify\Models\Badge; use Tests\Feature\TestCase; -class BadgeTest extends TestCase +final class BadgeTest extends TestCase { #[Test] public function it_should_return_the_default_image_if_badge_has_not_image(): void diff --git a/tests/Feature/Models/LevelTest.php b/tests/Feature/Models/LevelTest.php index 53a6105b..9bcdd4a5 100644 --- a/tests/Feature/Models/LevelTest.php +++ b/tests/Feature/Models/LevelTest.php @@ -32,7 +32,7 @@ use Illuminate\Foundation\Testing\WithFaker; use Tests\Feature\TestCase; -class LevelTest extends TestCase +final class LevelTest extends TestCase { use WithFaker; diff --git a/tests/Feature/Models/QuestionTest.php b/tests/Feature/Models/QuestionTest.php index 2b2818c9..4fc89c90 100644 --- a/tests/Feature/Models/QuestionTest.php +++ b/tests/Feature/Models/QuestionTest.php @@ -33,7 +33,7 @@ use Illuminate\Support\Facades\Event; use Tests\Feature\TestCase; -class QuestionTest extends TestCase +final class QuestionTest extends TestCase { #[Test] public function it_should_return_only_published_questions(): void diff --git a/tests/Feature/Models/UserResponseTest.php b/tests/Feature/Models/UserResponseTest.php index 1ebcdd12..9cf7b6c4 100644 --- a/tests/Feature/Models/UserResponseTest.php +++ b/tests/Feature/Models/UserResponseTest.php @@ -33,7 +33,7 @@ use Illuminate\Foundation\Testing\WithFaker; use Tests\Feature\TestCase; -class UserResponseTest extends TestCase +final class UserResponseTest extends TestCase { use WithFaker; diff --git a/tests/Feature/Models/UserTest.php b/tests/Feature/Models/UserTest.php index 0651a406..b5679ceb 100644 --- a/tests/Feature/Models/UserTest.php +++ b/tests/Feature/Models/UserTest.php @@ -37,7 +37,7 @@ use Illuminate\Database\Eloquent\Collection; use Tests\Feature\TestCase; -class UserTest extends TestCase +final class UserTest extends TestCase { #[Test] #[DataProvider('providesPendingVisibleQuestionsPaginationTestCases')] diff --git a/tests/Feature/Presenters/QuestionPresenterTest.php b/tests/Feature/Presenters/QuestionPresenterTest.php index d728c252..4b17695c 100644 --- a/tests/Feature/Presenters/QuestionPresenterTest.php +++ b/tests/Feature/Presenters/QuestionPresenterTest.php @@ -30,7 +30,7 @@ use Gamify\Models\User; use Tests\Feature\TestCase; -class QuestionPresenterTest extends TestCase +final class QuestionPresenterTest extends TestCase { #[Test] public function it_should_return_not_available_when_the_creator_is_not_set(): void diff --git a/tests/Feature/Services/SocialAccountServiceTest.php b/tests/Feature/Services/SocialAccountServiceTest.php index 34c411c3..96cb8ec8 100644 --- a/tests/Feature/Services/SocialAccountServiceTest.php +++ b/tests/Feature/Services/SocialAccountServiceTest.php @@ -31,7 +31,7 @@ use Gamify\Services\SocialAccountService; use Tests\Feature\TestCase; -class SocialAccountServiceTest extends TestCase +final class SocialAccountServiceTest extends TestCase { const PROVIDER_NAME = 'testing-provider'; diff --git a/tests/Feature/Services/UsernameGeneratorServiceTest.php b/tests/Feature/Services/UsernameGeneratorServiceTest.php index 18c641ea..983fd67d 100644 --- a/tests/Feature/Services/UsernameGeneratorServiceTest.php +++ b/tests/Feature/Services/UsernameGeneratorServiceTest.php @@ -31,7 +31,7 @@ use Gamify\Services\UsernameGeneratorService; use Tests\Feature\TestCase; -class UsernameGeneratorServiceTest extends TestCase +final class UsernameGeneratorServiceTest extends TestCase { #[Test] #[DataProvider('providesTestCasesForUsernameCreationFromText')] diff --git a/tests/Feature/Views/Components/Tags/FormSelectTagsTest.php b/tests/Feature/Views/Components/Tags/FormSelectTagsTest.php index 6dbe056b..32ceda48 100644 --- a/tests/Feature/Views/Components/Tags/FormSelectTagsTest.php +++ b/tests/Feature/Views/Components/Tags/FormSelectTagsTest.php @@ -30,7 +30,7 @@ use Gamify\View\Components\Tags\FormSelectTags; use Tests\Feature\TestCase; -class FormSelectTagsTest extends TestCase +final class FormSelectTagsTest extends TestCase { #[Test] public function it_should_render_the_tags_component(): void diff --git a/tests/Unit/Models/BadgeTest.php b/tests/Unit/Models/BadgeTest.php index 095a1eb0..8d3875c4 100644 --- a/tests/Unit/Models/BadgeTest.php +++ b/tests/Unit/Models/BadgeTest.php @@ -29,7 +29,7 @@ use Gamify\Models\Badge; use Tests\TestCase; -class BadgeTest extends TestCase +final class BadgeTest extends TestCase { public function test_contains_valid_fillable_properties(): void { diff --git a/tests/Unit/Models/LevelTest.php b/tests/Unit/Models/LevelTest.php index 7d8a0c38..beaaa59b 100644 --- a/tests/Unit/Models/LevelTest.php +++ b/tests/Unit/Models/LevelTest.php @@ -29,7 +29,7 @@ use Gamify\Models\Level; use Tests\TestCase; -class LevelTest extends TestCase +final class LevelTest extends TestCase { public function test_contains_valid_fillable_properties(): void { diff --git a/tests/Unit/Models/LinkedSocialAccountTest.php b/tests/Unit/Models/LinkedSocialAccountTest.php index f6dc6777..edeac10e 100644 --- a/tests/Unit/Models/LinkedSocialAccountTest.php +++ b/tests/Unit/Models/LinkedSocialAccountTest.php @@ -29,7 +29,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; use Tests\TestCase; -class LinkedSocialAccountTest extends TestCase +final class LinkedSocialAccountTest extends TestCase { public function test_contains_valid_fillable_properties(): void { diff --git a/tests/Unit/Models/PointTest.php b/tests/Unit/Models/PointTest.php index ede36032..99d15772 100644 --- a/tests/Unit/Models/PointTest.php +++ b/tests/Unit/Models/PointTest.php @@ -30,7 +30,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; use Tests\TestCase; -class PointTest extends TestCase +final class PointTest extends TestCase { #[Test] public function it_should_contain_valid_fillable_properties(): void diff --git a/tests/Unit/Models/QuestionChoiceTest.php b/tests/Unit/Models/QuestionChoiceTest.php index e96c4570..f84be142 100644 --- a/tests/Unit/Models/QuestionChoiceTest.php +++ b/tests/Unit/Models/QuestionChoiceTest.php @@ -30,7 +30,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; use Tests\TestCase; -class QuestionChoiceTest extends TestCase +final class QuestionChoiceTest extends TestCase { public function test_contains_valid_fillable_properties(): void { diff --git a/tests/Unit/Models/QuestionTest.php b/tests/Unit/Models/QuestionTest.php index 0d5e2ccc..3b0b146d 100644 --- a/tests/Unit/Models/QuestionTest.php +++ b/tests/Unit/Models/QuestionTest.php @@ -30,7 +30,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany; use Tests\TestCase; -class QuestionTest extends TestCase +final class QuestionTest extends TestCase { public function test_contains_valid_fillable_properties(): void { diff --git a/tests/Unit/Models/UserProfileTest.php b/tests/Unit/Models/UserProfileTest.php index cdf7cd1b..2ccca41c 100644 --- a/tests/Unit/Models/UserProfileTest.php +++ b/tests/Unit/Models/UserProfileTest.php @@ -29,7 +29,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; use Tests\TestCase; -class UserProfileTest extends TestCase +final class UserProfileTest extends TestCase { public function test_contains_valid_fillable_properties(): void { diff --git a/tests/Unit/Models/UserTest.php b/tests/Unit/Models/UserTest.php index 52c45850..fcb656d7 100644 --- a/tests/Unit/Models/UserTest.php +++ b/tests/Unit/Models/UserTest.php @@ -37,7 +37,7 @@ use Illuminate\Support\Facades\Hash; use Tests\TestCase; -class UserTest extends TestCase +final class UserTest extends TestCase { #[Test] public function contains_valid_fillable_properties(): void diff --git a/tests/Unit/Rules/UsernameRuleTest.php b/tests/Unit/Rules/UsernameRuleTest.php index d0a42640..5b4d1110 100644 --- a/tests/Unit/Rules/UsernameRuleTest.php +++ b/tests/Unit/Rules/UsernameRuleTest.php @@ -32,7 +32,7 @@ use Illuminate\Support\Facades\Validator; use Tests\TestCase; -class UsernameRuleTest extends TestCase +final class UsernameRuleTest extends TestCase { #[Test] #[DataProvider('providesWrongUsernames')] diff --git a/tests/Unit/Services/HashIdServiceTest.php b/tests/Unit/Services/HashIdServiceTest.php index 64508961..247334d3 100644 --- a/tests/Unit/Services/HashIdServiceTest.php +++ b/tests/Unit/Services/HashIdServiceTest.php @@ -29,7 +29,7 @@ use Gamify\Services\HashIdService; use Tests\TestCase; -class HashIdServiceTest extends TestCase +final class HashIdServiceTest extends TestCase { #[Test] public function it_should_get_the_same_number_after_encoding_it_and_decoding_it(): void