From 9c381b96dbce6748f88fc8e3fa2cfa98aeaac7ad Mon Sep 17 00:00:00 2001 From: Shift Date: Wed, 3 Jul 2024 13:31:54 +0000 Subject: [PATCH 1/4] Bump PHPUnit dependencies --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 1f32b2c0..30890d10 100644 --- a/composer.json +++ b/composer.json @@ -59,8 +59,8 @@ "beyondcode/laravel-dump-server": "^1.9", "fakerphp/faker": "^1.9.1", "mockery/mockery": "^1.4.4", - "nunomaduro/collision": "^6.3", - "phpunit/phpunit": "^9.5.10", + "nunomaduro/collision": "^7.0", + "phpunit/phpunit": "^10.0", "spatie/laravel-ignition": "^2.0", "tightenco/duster": "0.3.2" }, From afbe67457df0757b69774302221fcebede7100b0 Mon Sep 17 00:00:00 2001 From: Shift Date: Wed, 3 Jul 2024 13:31:55 +0000 Subject: [PATCH 2/4] Ignore PHPUnit cache folder --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 5262a2a0..07bf6298 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,6 @@ /public/js/location.js.map /storage/debugbar /storage/framework/testing -.phpunit.result.cache +/.phpunit.cache .idea/* phpunit.xml From 6fdab3b5cd5702b7a298361f06427c662ec56340 Mon Sep 17 00:00:00 2001 From: Shift Date: Wed, 3 Jul 2024 13:31:56 +0000 Subject: [PATCH 3/4] Adopt PHP attributes in test classes --- tests/Api/BioApiTest.php | 9 +- tests/Api/ConferenceApiTest.php | 11 +- tests/Api/JsonApiTest.php | 4 +- tests/Api/MeApiTest.php | 4 +- tests/Api/TalkApiTest.php | 17 +- .../Commands/TweetImportantCFPDatesTest.php | 9 +- tests/Feature/AcceptanceTest.php | 5 +- tests/Feature/AccountTest.php | 25 +-- tests/Feature/AdminTest.php | 7 +- tests/Feature/BiosTest.php | 13 +- ...CallingAllPapersConferenceImporterTest.php | 44 ++--- tests/Feature/ConferenceIssuesTest.php | 11 +- tests/Feature/ConferenceTest.php | 169 +++++++++--------- tests/Feature/NotificationTest.php | 13 +- tests/Feature/PublicSpeakerProfileTest.php | 43 ++--- tests/Feature/RejectionTest.php | 5 +- tests/Feature/SpeakerPackageTest.php | 19 +- tests/Feature/SubmissionTest.php | 33 ++-- .../SyncCallingAllPapersEventsTest.php | 5 +- tests/Feature/TalkReactionsTest.php | 7 +- tests/Feature/TalkTest.php | 41 ++--- tests/Feature/UserTest.php | 9 +- .../VerifyConferenceImporterHeartbeatTest.php | 5 +- tests/Integration/GeocoderTest.php | 7 +- 24 files changed, 271 insertions(+), 244 deletions(-) diff --git a/tests/Api/BioApiTest.php b/tests/Api/BioApiTest.php index 3c51e85a..c16c6020 100644 --- a/tests/Api/BioApiTest.php +++ b/tests/Api/BioApiTest.php @@ -2,11 +2,12 @@ namespace Tests\Api; +use PHPUnit\Framework\Attributes\Test; use App\Models\Bio; class BioApiTest extends ApiTestCase { - /** @test */ + #[Test] public function can_fetch_all_user_bios(): void { $response = $this->call('GET', '/api/user/1/bios'); @@ -16,7 +17,7 @@ public function can_fetch_all_user_bios(): void $this->assertIsArray($data->data); } - /** @test */ + #[Test] public function can_fetch_one_user_bio(): void { $bioId = Bio::first()->id; @@ -27,7 +28,7 @@ public function can_fetch_one_user_bio(): void $this->assertIsObject($data->data); } - /** @test */ + #[Test] public function cannot_fetch_all_bios_for_other_user(): void { $response = $this->call('GET', 'api/user/2/bios'); @@ -35,7 +36,7 @@ public function cannot_fetch_all_bios_for_other_user(): void $this->assertEquals(404, $response->getStatusCode()); } - /** @test */ + #[Test] public function cannot_fetch_one_bio_for_other_user(): void { $bioId = Bio::where('user_id', 2)->first()->id; diff --git a/tests/Api/ConferenceApiTest.php b/tests/Api/ConferenceApiTest.php index ba847113..58710434 100644 --- a/tests/Api/ConferenceApiTest.php +++ b/tests/Api/ConferenceApiTest.php @@ -2,11 +2,12 @@ namespace Tests\Api; +use PHPUnit\Framework\Attributes\Test; use App\Models\Conference; class ConferenceApiTest extends ApiTestCase { - /** @test */ + #[Test] public function can_fetch_all_conferences(): void { $response = $this->call('GET', 'api/conferences'); @@ -16,7 +17,7 @@ public function can_fetch_all_conferences(): void $this->assertIsArray($data->data); } - /** @test */ + #[Test] public function can_fetch_one_conference(): void { $conferenceId = Conference::first()->id; @@ -27,7 +28,7 @@ public function can_fetch_one_conference(): void $this->assertIsObject($data->data); } - /** @test */ + #[Test] public function cfp_url_returns_if_set(): void { $conference = Conference::create([ @@ -44,7 +45,7 @@ public function cfp_url_returns_if_set(): void $this->assertEquals('http://awesome.com/cfp', $data->data->attributes->cfp_url); } - /** @test */ + #[Test] public function cfp_url_returns_null_on_api_if_not_set(): void { $conference = Conference::create([ @@ -60,7 +61,7 @@ public function cfp_url_returns_null_on_api_if_not_set(): void $this->assertNull($data->data->attributes->cfp_url); } - /** @test */ + #[Test] public function unclosed_cfp_returns_open_and_future_cfp(): void { Conference::factory() diff --git a/tests/Api/JsonApiTest.php b/tests/Api/JsonApiTest.php index 6b06a54f..44d46a1f 100644 --- a/tests/Api/JsonApiTest.php +++ b/tests/Api/JsonApiTest.php @@ -2,9 +2,11 @@ namespace Tests\Api; +use PHPUnit\Framework\Attributes\Test; + class JsonApiTest extends ApiTestCase { - /** @test */ + #[Test] public function uses_correct_json_api_header(): void { $response = $this->call('GET', '/api/user/1/talks'); diff --git a/tests/Api/MeApiTest.php b/tests/Api/MeApiTest.php index f3343257..2f65c559 100644 --- a/tests/Api/MeApiTest.php +++ b/tests/Api/MeApiTest.php @@ -2,9 +2,11 @@ namespace Tests\Api; +use PHPUnit\Framework\Attributes\Test; + class MeApiTest extends ApiTestCase { - /** @test */ + #[Test] public function can_fetch_my_info(): void { $response = $this->call('GET', 'api/me'); diff --git a/tests/Api/TalkApiTest.php b/tests/Api/TalkApiTest.php index 19c461e9..931ad0be 100644 --- a/tests/Api/TalkApiTest.php +++ b/tests/Api/TalkApiTest.php @@ -2,12 +2,13 @@ namespace Tests\Api; +use PHPUnit\Framework\Attributes\Test; use App\Models\Talk; use App\Models\TalkRevision; class TalkApiTest extends ApiTestCase { - /** @test */ + #[Test] public function can_fetch_all_talks_for_user(): void { $response = $this->call('GET', 'api/user/1/talks'); @@ -17,7 +18,7 @@ public function can_fetch_all_talks_for_user(): void $this->assertCount(2, $data->data); } - /** @test */ + #[Test] public function all_talks_doesnt_return_archived_talks(): void { $toBeArchivedTalk = $this->user->talks()->create([]); @@ -36,7 +37,7 @@ public function all_talks_doesnt_return_archived_talks(): void $this->assertCount(2, $data->data); } - /** @test */ + #[Test] public function including_archived_talks(): void { Talk::factory() @@ -50,7 +51,7 @@ public function including_archived_talks(): void $response->assertJsonFragment(['title' => 'My Archived Talk']); } - /** @test */ + #[Test] public function excluding_archived_talks(): void { Talk::factory() @@ -64,7 +65,7 @@ public function excluding_archived_talks(): void $response->assertJsonMissing(['title' => 'My Archived Talk']); } - /** @test */ + #[Test] public function all_talks_return_alpha_sorted(): void { $response = $this->call('GET', 'api/user/1/talks'); @@ -76,7 +77,7 @@ public function all_talks_return_alpha_sorted(): void $this->assertEquals('My great talk', $titles->last()); } - /** @test */ + #[Test] public function can_fetch_one_talk(): void { $talkId = Talk::first()->id; @@ -87,7 +88,7 @@ public function can_fetch_one_talk(): void $this->assertIsObject($data->data); } - /** @test */ + #[Test] public function cannot_fetch_all_talks_for_other_users(): void { $response = $this->call('GET', 'api/user/2/talks'); @@ -95,7 +96,7 @@ public function cannot_fetch_all_talks_for_other_users(): void $this->assertEquals(404, $response->getStatusCode()); } - /** @test */ + #[Test] public function cannot_fetch_one_talk_for_other_users(): void { $talkId = Talk::where('author_id', 2)->first()->id; diff --git a/tests/Console/Commands/TweetImportantCFPDatesTest.php b/tests/Console/Commands/TweetImportantCFPDatesTest.php index fc5ad416..ac1c1ea1 100644 --- a/tests/Console/Commands/TweetImportantCFPDatesTest.php +++ b/tests/Console/Commands/TweetImportantCFPDatesTest.php @@ -2,6 +2,7 @@ namespace Tests\Console\Commands; +use PHPUnit\Framework\Attributes\Test; use App\Console\Commands\TweetImportantCFPDates; use App\Models\Conference; use Atymic\Twitter\ApiV1\Service\Twitter; @@ -10,7 +11,7 @@ class TweetImportantCFPDatesTest extends TestCase { - /** @test */ + #[Test] public function cfps_opening_today_should_be_tweeted(): void { // starts today, ends next week @@ -25,7 +26,7 @@ public function cfps_opening_today_should_be_tweeted(): void (new TweetImportantCFPDates($mock, 0))->handle(); } - /** @test */ + #[Test] public function cfps_closing_tomorrow_should_be_tweeted(): void { // started last week, ends tomorrow @@ -40,7 +41,7 @@ public function cfps_closing_tomorrow_should_be_tweeted(): void (new TweetImportantCFPDates($mock, 0))->handle(); } - /** @test */ + #[Test] public function cfps_not_opening_today_nor_closing_tomorrow_should_not_be_tweeted(): void { // started last week, ends next week @@ -55,7 +56,7 @@ public function cfps_not_opening_today_nor_closing_tomorrow_should_not_be_tweete (new TweetImportantCFPDates($mock, 0))->handle(); } - /** @test */ + #[Test] public function cfps_that_open_and_close_same_day_should_not_be_tweeted(): void { Conference::factory()->create([ diff --git a/tests/Feature/AcceptanceTest.php b/tests/Feature/AcceptanceTest.php index 28f04e67..5e9713dd 100644 --- a/tests/Feature/AcceptanceTest.php +++ b/tests/Feature/AcceptanceTest.php @@ -2,6 +2,7 @@ namespace Tests; +use PHPUnit\Framework\Attributes\Test; use App\Models\Acceptance; use App\Models\Conference; use App\Models\Submission; @@ -12,7 +13,7 @@ class AcceptanceTest extends TestCase { - /** @test */ + #[Test] public function can_create_from_submission(): void { $user = User::factory()->create(); @@ -36,7 +37,7 @@ public function can_create_from_submission(): void $this->assertEquals($submission->id, $acceptance->submission->id); } - /** @test */ + #[Test] public function user_can_remove_acceptance_via_http(): void { $user = User::factory()->create(); diff --git a/tests/Feature/AccountTest.php b/tests/Feature/AccountTest.php index c6958498..b5596358 100644 --- a/tests/Feature/AccountTest.php +++ b/tests/Feature/AccountTest.php @@ -2,6 +2,7 @@ namespace Tests\Feature; +use PHPUnit\Framework\Attributes\Test; use App\Http\Livewire\ConferenceList; use App\Models\Bio; use App\Models\Conference; @@ -18,7 +19,7 @@ class AccountTest extends TestCase { - /** @test */ + #[Test] public function users_can_log_in(): void { $user = User::factory()->create(['password' => Hash::make('super-secret')]); @@ -32,7 +33,7 @@ public function users_can_log_in(): void $response->assertSessionDoesntHaveErrors('email'); } - /** @test */ + #[Test] public function logging_in_with_invalid_credentials(): void { $user = User::factory()->create(); @@ -46,7 +47,7 @@ public function logging_in_with_invalid_credentials(): void $response->assertSessionHasErrors('email'); } - /** @test */ + #[Test] public function user_can_update_their_profile(): void { $user = User::factory()->create(); @@ -75,7 +76,7 @@ public function user_can_update_their_profile(): void ]); } - /** @test */ + #[Test] public function user_can_update_their_profile_picture(): void { Storage::fake(); @@ -96,7 +97,7 @@ public function user_can_update_their_profile_picture(): void Storage::disk()->assertExists(User::PROFILE_PICTURE_HIRES_PATH . $user->profile_picture); } - /** @test */ + #[Test] public function password_reset_emails_are_sent_for_valid_users(): void { Notification::fake(); @@ -109,7 +110,7 @@ public function password_reset_emails_are_sent_for_valid_users(): void Notification::assertSentTo($user, ResetPassword::class); } - /** @test */ + #[Test] public function user_can_reset_their_password_from_email_link(): void { Notification::fake(); @@ -149,7 +150,7 @@ function ($notification, $channels) use (&$token) { ])->assertLocation('dashboard'); } - /** @test */ + #[Test] public function users_can_delete_their_accounts(): void { $user = User::factory()->create(); @@ -162,7 +163,7 @@ public function users_can_delete_their_accounts(): void $this->assertModelMissing($user); } - /** @test */ + #[Test] public function deleting_a_user_deletes_its_associated_entities(): void { $user = User::factory()->create(); @@ -204,7 +205,7 @@ public function deleting_a_user_deletes_its_associated_entities(): void ]); } - /** @test */ + #[Test] public function users_can_dismiss_a_conference(): void { $user = User::factory()->create(); @@ -220,7 +221,7 @@ public function users_can_dismiss_a_conference(): void ]); } - /** @test */ + #[Test] public function users_can_undismiss_a_conference(): void { $user = User::factory()->create(); @@ -236,7 +237,7 @@ public function users_can_undismiss_a_conference(): void ]); } - /** @test */ + #[Test] public function users_can_favorite_a_conference(): void { $user = User::factory()->create(); @@ -252,7 +253,7 @@ public function users_can_favorite_a_conference(): void ]); } - /** @test */ + #[Test] public function users_can_unfavorite_a_conference(): void { $user = User::factory()->create(); diff --git a/tests/Feature/AdminTest.php b/tests/Feature/AdminTest.php index 8358363b..2a49de47 100644 --- a/tests/Feature/AdminTest.php +++ b/tests/Feature/AdminTest.php @@ -2,13 +2,14 @@ namespace Tests\Feature; +use PHPUnit\Framework\Attributes\Test; use App\Models\Conference; use App\Models\User; use Tests\TestCase; class AdminTest extends TestCase { - /** @test */ + #[Test] public function admins_can_edit_other_peoples_conferences(): void { $user = User::factory()->create(); @@ -29,7 +30,7 @@ public function admins_can_edit_other_peoples_conferences(): void $this->assertEquals('The New Name That Is Not The Old Name', $conference->fresh()->title); } - /** @test */ + #[Test] public function admins_can_see_edit_button_for_other_peoples_conferences(): void { $admin = User::factory()->admin()->create(); @@ -40,7 +41,7 @@ public function admins_can_see_edit_button_for_other_peoples_conferences(): void ->assertSee('Edit'); } - /** @test */ + #[Test] public function only_admins_can_change_conference_status(): void { $user = User::factory()->create(); diff --git a/tests/Feature/BiosTest.php b/tests/Feature/BiosTest.php index 278b997e..0057b999 100644 --- a/tests/Feature/BiosTest.php +++ b/tests/Feature/BiosTest.php @@ -2,13 +2,14 @@ namespace Tests\Feature; +use PHPUnit\Framework\Attributes\Test; use App\Models\Bio; use App\Models\User; use Tests\TestCase; class BiosTest extends TestCase { - /** @test */ + #[Test] public function user_can_create_a_private_bio(): void { $user = User::factory()->create(); @@ -29,7 +30,7 @@ public function user_can_create_a_private_bio(): void ]); } - /** @test */ + #[Test] public function user_can_create_a_public_bio(): void { $user = User::factory()->create(); @@ -50,7 +51,7 @@ public function user_can_create_a_public_bio(): void ]); } - /** @test */ + #[Test] public function user_can_edit_their_bio(): void { $user = User::factory()->create(); @@ -70,7 +71,7 @@ public function user_can_edit_their_bio(): void ]); } - /** @test */ + #[Test] public function user_cannot_edit_a_bio_that_they_do_not_own(): void { $userA = User::factory()->create(); @@ -82,7 +83,7 @@ public function user_cannot_edit_a_bio_that_they_do_not_own(): void $response->assertNotFound(); } - /** @test */ + #[Test] public function user_can_delete_their_bio(): void { $user = User::factory()->create(); @@ -97,7 +98,7 @@ public function user_can_delete_their_bio(): void $this->assertModelMissing($bio); } - /** @test */ + #[Test] public function user_cannot_delete_a_bio_they_dont_own(): void { $userA = User::factory()->create(); diff --git a/tests/Feature/CallingAllPapersConferenceImporterTest.php b/tests/Feature/CallingAllPapersConferenceImporterTest.php index bd9050c2..9bbf4f63 100644 --- a/tests/Feature/CallingAllPapersConferenceImporterTest.php +++ b/tests/Feature/CallingAllPapersConferenceImporterTest.php @@ -2,6 +2,8 @@ namespace Tests\Feature; +use PHPUnit\Framework\Attributes\Before; +use PHPUnit\Framework\Attributes\Test; use App\CallingAllPapers\ConferenceImporter; use App\Casts\Coordinates; use App\Exceptions\InvalidAddressGeocodingException; @@ -14,7 +16,7 @@ class CallingAllPapersConferenceImporterTest extends TestCase { use MocksCallingAllPapers; - /** @before */ + #[Before] public function prepareEventStub() { parent::setUp(); @@ -22,7 +24,7 @@ public function prepareEventStub() $this->stubEvent(); } - /** @test */ + #[Test] public function it_gets_the_id_from_the_rel_link(): void { $this->mockClient(); @@ -36,7 +38,7 @@ public function it_gets_the_id_from_the_rel_link(): void $this->assertEquals($this->eventId, $conference->calling_all_papers_id); } - /** @test */ + #[Test] public function epoch_start_dates_are_nullified_prior_to_validation(): void { $this->mockClient(); @@ -53,7 +55,7 @@ public function epoch_start_dates_are_nullified_prior_to_validation(): void $this->assertEquals($this->eventId, $conference->calling_all_papers_id); } - /** @test */ + #[Test] public function it_imports_basic_text_fields(): void { $this->mockClient(); @@ -69,7 +71,7 @@ public function it_imports_basic_text_fields(): void $this->assertEquals($this->eventStub->uri, $conference->cfp_url); } - /** @test */ + #[Test] public function it_imports_dates_if_we_dont_care_about_time_zones(): void { $event = $this->eventStub; @@ -119,7 +121,7 @@ public function it_imports_dates_if_we_dont_care_about_time_zones(): void ); } - /** @test */ + #[Test] public function imported_dates_are_adjusted_for_daylight_saving_time_changes(): void { $this->mockClient(); @@ -143,7 +145,7 @@ public function imported_dates_are_adjusted_for_daylight_saving_time_changes(): $this->assertEquals('2017-12-22T00:00:00-05:00', $conference->ends_at->toIso8601String()); } - /** @test */ + #[Test] public function it_imports_null_dates_as_null(): void { $event = $this->eventStub; @@ -160,7 +162,7 @@ public function it_imports_null_dates_as_null(): void $this->assertNull($conference->cfp_ends_at); } - /** @test */ + #[Test] public function it_imports_Jan_1_1970_dates_as_null(): void { $event = $this->eventStub; @@ -180,7 +182,7 @@ public function it_imports_Jan_1_1970_dates_as_null(): void $this->assertNull($conference->cfp_starts_at); } - /** @test */ + #[Test] public function invalid_dates_are_ignored(): void { $event = $this->eventStub; @@ -203,7 +205,7 @@ public function invalid_dates_are_ignored(): void $this->assertNull($conference->cfp_ends_at); } - /** @test */ + #[Test] public function it_imports_zero_in_latitude_or_longitude_as_null(): void { $event = $this->eventStub; @@ -222,7 +224,7 @@ public function it_imports_zero_in_latitude_or_longitude_as_null(): void $this->assertNull($conference->longitude); } - /** @test */ + #[Test] public function it_fills_latitude_and_longitude_from_location_if_lat_long_are_null(): void { $event = $this->eventStub; @@ -246,7 +248,7 @@ public function it_fills_latitude_and_longitude_from_location_if_lat_long_are_nu $this->assertEquals('-77.0259036', $conference->longitude); } - /** @test */ + #[Test] public function it_keeps_lat_long_values_null_if_no_results(): void { $event = $this->eventStub; @@ -270,7 +272,7 @@ public function it_keeps_lat_long_values_null_if_no_results(): void $this->assertNull($conference->longitude); } - /** @test */ + #[Test] public function imported_conferences_are_approved(): void { $this->mockClient(); @@ -281,7 +283,7 @@ public function imported_conferences_are_approved(): void $this->assertTrue(Conference::first()->is_approved); } - /** @test */ + #[Test] public function it_updates_data_for_existing_conferences(): void { $this->mockClient(); @@ -308,7 +310,7 @@ public function it_updates_data_for_existing_conferences(): void $this->assertEquals($updatedEvent->eventUri, $updatedConference->url); } - /** @test */ + #[Test] public function updating_existing_unapproved_conferences_leaves_them_unapproved(): void { $this->mockClient(); @@ -325,7 +327,7 @@ public function updating_existing_unapproved_conferences_leaves_them_unapproved( $this->assertFalse(Conference::first()->is_approved); } - /** @test */ + #[Test] public function conferences_with_cfp_end_after_conference_start_are_rejected(): void { $this->mockClient(); @@ -344,7 +346,7 @@ public function conferences_with_cfp_end_after_conference_start_are_rejected(): $this->assertNotNull($conference->rejected_at); } - /** @test */ + #[Test] public function conferences_with_over_2_year_duration_are_rejected(): void { $this->mockClient(); @@ -363,7 +365,7 @@ public function conferences_with_over_2_year_duration_are_rejected(): void $this->assertNotNull($conference->rejected_at); } - /** @test */ + #[Test] public function conferences_with_cfp_duration_over_2_years_are_rejected(): void { $this->mockClient(); @@ -382,7 +384,7 @@ public function conferences_with_cfp_duration_over_2_years_are_rejected(): void $this->assertNotNull($conference->rejected_at); } - /** @test */ + #[Test] public function rejected_conferences_cannot_be_reimported(): void { $this->mockClient(); @@ -405,7 +407,7 @@ public function rejected_conferences_cannot_be_reimported(): void $this->assertEquals(1, $conferenceCount); } - /** @test */ + #[Test] public function conferences_with_null_cfp_start_are_valid_with_cfp_end_less_than_2_years_in_future(): void { $this->mockClient(); @@ -421,7 +423,7 @@ public function conferences_with_null_cfp_start_are_valid_with_cfp_end_less_than $this->assertEquals(1, Conference::count()); } - /** @test */ + #[Test] public function conferences_with_null_start_are_valid_with_end_less_than_2_years_in_future(): void { $this->mockClient(); diff --git a/tests/Feature/ConferenceIssuesTest.php b/tests/Feature/ConferenceIssuesTest.php index 185a1973..3dfa9c8d 100644 --- a/tests/Feature/ConferenceIssuesTest.php +++ b/tests/Feature/ConferenceIssuesTest.php @@ -2,6 +2,7 @@ namespace Tests\Feature; +use PHPUnit\Framework\Attributes\Test; use App\Models\Conference; use App\Models\ConferenceIssue; use App\Models\User; @@ -14,7 +15,7 @@ class ConferenceIssuesTest extends TestCase { use RefreshDatabase; - /** @test */ + #[Test] function saving_a_conference_issue(): void { Notification::fake(); @@ -39,7 +40,7 @@ function saving_a_conference_issue(): void Notification::assertSentToTightenSlack(ConferenceIssueReported::class); } - /** @test */ + #[Test] function conference_issues_must_contain_a_reason_and_note(): void { Notification::fake(); @@ -56,7 +57,7 @@ function conference_issues_must_contain_a_reason_and_note(): void Notification::assertNothingSent(); } - /** @test */ + #[Test] function conference_issue_reasons_must_be_an_expected_value(): void { Notification::fake(); @@ -76,7 +77,7 @@ function conference_issue_reasons_must_be_an_expected_value(): void Notification::assertNothingSent(); } - /** @test */ + #[Test] function issues_that_have_not_been_closed_are_open(): void { $openIssue = ConferenceIssue::factory()->create([ @@ -90,7 +91,7 @@ function issues_that_have_not_been_closed_are_open(): void $this->assertFalse($closedIssue->isOpen()); } - /** @test */ + #[Test] function closing_an_issue(): void { $user = User::factory()->create(); diff --git a/tests/Feature/ConferenceTest.php b/tests/Feature/ConferenceTest.php index 7642f443..bffeb72c 100644 --- a/tests/Feature/ConferenceTest.php +++ b/tests/Feature/ConferenceTest.php @@ -2,6 +2,7 @@ namespace Tests\Feature; +use PHPUnit\Framework\Attributes\Test; use App\Http\Livewire\ConferenceList; use App\Models\Conference; use App\Models\User; @@ -12,7 +13,7 @@ class ConferenceTest extends TestCase { - /** @test */ + #[Test] public function user_can_create_conference(): void { $user = User::factory()->create(); @@ -30,7 +31,7 @@ public function user_can_create_conference(): void ]); } - /** @test */ + #[Test] public function a_conference_can_include_location_coordinates(): void { $user = User::factory()->create(); @@ -53,7 +54,7 @@ public function a_conference_can_include_location_coordinates(): void ]); } - /** @test */ + #[Test] public function a_conference_cannot_end_before_it_begins(): void { $user = User::factory()->create(); @@ -75,7 +76,7 @@ public function a_conference_cannot_end_before_it_begins(): void ]); } - /** @test */ + #[Test] public function conference_title_is_required(): void { $user = User::factory()->create(); @@ -88,7 +89,7 @@ public function conference_title_is_required(): void $response->assertSessionHasErrors('title'); } - /** @test */ + #[Test] public function conference_description_is_required(): void { $user = User::factory()->create(); @@ -101,7 +102,7 @@ public function conference_description_is_required(): void $response->assertSessionHasErrors('description'); } - /** @test */ + #[Test] public function conference_url_is_required(): void { $user = User::factory()->create(); @@ -114,7 +115,7 @@ public function conference_url_is_required(): void $response->assertSessionHasErrors('url'); } - /** @test */ + #[Test] public function conference_start_date_must_be_a_valid_date(): void { $user = User::factory()->create(); @@ -129,7 +130,7 @@ public function conference_start_date_must_be_a_valid_date(): void $response->assertSessionHasErrors('starts_at'); } - /** @test */ + #[Test] public function conference_end_date_must_be_a_valid_date(): void { $user = User::factory()->create(); @@ -144,7 +145,7 @@ public function conference_end_date_must_be_a_valid_date(): void $response->assertSessionHasErrors('ends_at'); } - /** @test */ + #[Test] public function conference_end_date_must_not_be_before_start_date(): void { $user = User::factory()->create(); @@ -160,7 +161,7 @@ public function conference_end_date_must_not_be_before_start_date(): void $response->assertSessionHasErrors('ends_at'); } - /** @test */ + #[Test] public function conference_can_be_a_single_day_conference(): void { $user = User::factory()->create(); @@ -178,7 +179,7 @@ public function conference_can_be_a_single_day_conference(): void $this->assertDatabaseHas(Conference::class, $input); } - /** @test */ + #[Test] public function conference_cfp_start_date_must_be_a_valid_date(): void { $user = User::factory()->create(); @@ -193,7 +194,7 @@ public function conference_cfp_start_date_must_be_a_valid_date(): void $response->assertSessionHasErrors('cfp_starts_at'); } - /** @test */ + #[Test] public function conference_cfp_end_date_must_be_a_valid_date(): void { $user = User::factory()->create(); @@ -208,7 +209,7 @@ public function conference_cfp_end_date_must_be_a_valid_date(): void $response->assertSessionHasErrors('cfp_ends_at'); } - /** @test */ + #[Test] public function conference_cfp_end_date_must_not_be_before_cfp_start_date(): void { $user = User::factory()->create(); @@ -224,7 +225,7 @@ public function conference_cfp_end_date_must_not_be_before_cfp_start_date(): voi $response->assertSessionHasErrors('cfp_ends_at'); } - /** @test */ + #[Test] public function conference_cfp_start_date_must_be_before_the_conference_start_date(): void { $user = User::factory()->create(); @@ -241,7 +242,7 @@ public function conference_cfp_start_date_must_be_before_the_conference_start_da $response->assertSessionHasErrors('cfp_starts_at'); } - /** @test */ + #[Test] public function conference_cfp_end_date_must_be_before_the_conference_start_date(): void { $user = User::factory()->create(); @@ -258,7 +259,7 @@ public function conference_cfp_end_date_must_be_before_the_conference_start_date $response->assertSessionHasErrors('cfp_ends_at'); } - /** @test */ + #[Test] public function it_creates_a_conference_with_the_minimum_required_input(): void { $user = User::factory()->create(); @@ -273,7 +274,7 @@ public function it_creates_a_conference_with_the_minimum_required_input(): void $this->assertDatabaseHas(Conference::class, $input); } - /** @test */ + #[Test] public function conference_dates_are_saved_if_provided(): void { $user = User::factory()->create(); @@ -292,7 +293,7 @@ public function conference_dates_are_saved_if_provided(): void $this->assertDatabaseHas(Conference::class, $input); } - /** @test */ + #[Test] public function conference_cfp_url_is_saved_if_provided(): void { $user = User::factory()->create(); @@ -308,7 +309,7 @@ public function conference_cfp_url_is_saved_if_provided(): void $this->assertDatabaseHas(Conference::class, $input); } - /** @test */ + #[Test] public function empty_dates_are_treated_as_null(): void { $user = User::factory()->create(); @@ -335,7 +336,7 @@ public function empty_dates_are_treated_as_null(): void ]); } - /** @test */ + #[Test] public function non_admins_cannot_submit_admin_only_fields(): void { $user = User::factory()->create(); @@ -354,7 +355,7 @@ public function non_admins_cannot_submit_admin_only_fields(): void $this->assertFalse($conference->is_shared); } - /** @test */ + #[Test] public function creating_a_conference_redirects_to_the_new_conference(): void { $user = User::factory()->create(); @@ -370,7 +371,7 @@ public function creating_a_conference_redirects_to_the_new_conference(): void $response->assertRedirect("conferences/{$conference->id}"); } - /** @test */ + #[Test] public function a_conference_has_cfp_by_default(): void { $user = User::factory()->create(); @@ -389,7 +390,7 @@ public function a_conference_has_cfp_by_default(): void ]); } - /** @test */ + #[Test] public function a_conference_can_be_marked_no_cfp(): void { $user = User::factory()->create(); @@ -409,7 +410,7 @@ public function a_conference_can_be_marked_no_cfp(): void ]); } - /** @test */ + #[Test] public function has_cfp_must_be_a_boolean(): void { $user = User::factory()->create(); @@ -425,7 +426,7 @@ public function has_cfp_must_be_a_boolean(): void $response->assertSessionHasErrors('has_cfp'); } - /** @test */ + #[Test] public function conferences_marked_no_cfp_must_not_include_cfp_fields(): void { $user = User::factory()->create(); @@ -448,7 +449,7 @@ public function conferences_marked_no_cfp_must_not_include_cfp_fields(): void $response->assertSessionHasErrors('cfp_ends_at'); } - /** @test */ + #[Test] public function user_can_edit_conference(): void { $user = User::factory()->create(); @@ -476,7 +477,7 @@ public function user_can_edit_conference(): void ]); } - /** @test */ + #[Test] public function location_coordinates_can_be_updated(): void { $user = User::factory()->create(); @@ -496,7 +497,7 @@ public function location_coordinates_can_be_updated(): void ]); } - /** @test */ + #[Test] public function a_conference_cannot_be_updated_to_end_before_it_begins(): void { $user = User::factory()->create(); @@ -520,7 +521,7 @@ public function a_conference_cannot_be_updated_to_end_before_it_begins(): void ); } - /** @test */ + #[Test] public function conferences_accept_proposals_during_the_call_for_papers(): void { $conference = Conference::factory()->create([ @@ -531,7 +532,7 @@ public function conferences_accept_proposals_during_the_call_for_papers(): void $this->assertTrue($conference->isCurrentlyAcceptingProposals()); } - /** @test */ + #[Test] public function conferences_dont_accept_proposals_outside_of_the_call_for_papers(): void { $conference = Conference::factory()->create([ @@ -549,7 +550,7 @@ public function conferences_dont_accept_proposals_outside_of_the_call_for_papers $this->assertFalse($conference->isCurrentlyAcceptingProposals()); } - /** @test */ + #[Test] public function conferences_that_havent_announced_their_cfp_are_not_accepting_proposals(): void { $conference = Conference::factory()->create([ @@ -560,7 +561,7 @@ public function conferences_that_havent_announced_their_cfp_are_not_accepting_pr $this->assertFalse($conference->isCurrentlyAcceptingProposals()); } - /** @test */ + #[Test] public function non_owners_can_view_conference(): void { $user = User::factory()->create(); @@ -574,7 +575,7 @@ public function non_owners_can_view_conference(): void ->assertSee($conference->title); } - /** @test */ + #[Test] public function guests_can_view_conference(): void { $conference = Conference::factory()->approved()->create(); @@ -583,7 +584,7 @@ public function guests_can_view_conference(): void ->assertSee($conference->title); } - /** @test */ + #[Test] public function guests_can_view_conference_list(): void { $user = User::factory()->create(); @@ -599,14 +600,14 @@ public function guests_can_view_conference_list(): void ->assertSee($conference->title); } - /** @test */ + #[Test] public function guests_cannot_create_conference(): void { $this->get('conferences/create') ->assertRedirect('login'); } - /** @test */ + #[Test] public function it_can_pull_only_approved_conferences(): void { Conference::factory()->notApproved()->create(); @@ -615,7 +616,7 @@ public function it_can_pull_only_approved_conferences(): void $this->assertEquals(1, Conference::approved()->count()); } - /** @test */ + #[Test] public function it_can_pull_only_not_shared_conferences(): void { Conference::factory()->create(); @@ -624,7 +625,7 @@ public function it_can_pull_only_not_shared_conferences(): void $this->assertEquals(1, Conference::notShared()->count()); } - /** @test */ + #[Test] public function sorting_by_cfp_filters_out_null_cfp(): void { Carbon::setTestNow('2023-05-04'); @@ -654,7 +655,7 @@ public function sorting_by_cfp_filters_out_null_cfp(): void $response->assertDontSee($nullCfp->title); } - /** @test */ + #[Test] public function sorting_by_event_date(): void { Carbon::setTestNow('2023-05-04'); @@ -678,7 +679,7 @@ public function sorting_by_event_date(): void ], $response->conferences); } - /** @test */ + #[Test] public function sorting_by_cfp_opening_date(): void { $conferenceA = Conference::factory()->create([ @@ -700,7 +701,7 @@ public function sorting_by_cfp_opening_date(): void ], $response->conferences); } - /** @test */ + #[Test] public function sorting_by_cfp_closing_date(): void { $conferenceA = Conference::factory()->create([ @@ -724,7 +725,7 @@ public function sorting_by_cfp_closing_date(): void ], $response->conferences); } - /** @test */ + #[Test] public function dismissed_conferences_do_not_show_up_in_conference_list(): void { $user = User::factory()->create(); @@ -735,7 +736,7 @@ public function dismissed_conferences_do_not_show_up_in_conference_list(): void $response->assertDontSee($conference->title); } - /** @test */ + #[Test] public function filtering_by_open_cfp_hides_non_cfp_conferences(): void { $user = User::factory()->create(); @@ -750,7 +751,7 @@ public function filtering_by_open_cfp_hides_non_cfp_conferences(): void ->assertDontSee($conference->title); } - /** @test */ + #[Test] public function filtering_by_open_cfp_hides_conferences_without_event_dates(): void { $user = User::factory()->create(); @@ -769,7 +770,7 @@ public function filtering_by_open_cfp_hides_conferences_without_event_dates(): v ->assertDontSee($conference->title); } - /** @test */ + #[Test] public function filtering_by_future_cfp_hides_non_cfp_conferences(): void { $user = User::factory()->create(); @@ -784,7 +785,7 @@ public function filtering_by_future_cfp_hides_non_cfp_conferences(): void ->assertDontSee($conference->title); } - /** @test */ + #[Test] public function filtering_by_unclosed_cfp_shows_open_and_future_cfp(): void { $user = User::factory()->create(); @@ -806,7 +807,7 @@ public function filtering_by_unclosed_cfp_shows_open_and_future_cfp(): void ->assertDontSee('No CFP Conference'); } - /** @test */ + #[Test] public function filtering_by_future_shows_future_conferences(): void { $conferenceA = Conference::factory()->create([ @@ -824,7 +825,7 @@ public function filtering_by_future_shows_future_conferences(): void $response->assertDontSee('Conference B'); } - /** @test */ + #[Test] public function filtering_by_future_shows_future_cfp_openings_when_sorting_by_cfp_opening(): void { $conferenceA = Conference::factory()->create([ @@ -844,7 +845,7 @@ public function filtering_by_future_shows_future_cfp_openings_when_sorting_by_cf $response->assertDontSee('Conference B'); } - /** @test */ + #[Test] public function filtering_by_future_shows_future_cfp_closings_when_sorting_by_cfp_closing(): void { $conferenceA = Conference::factory()->create([ @@ -866,7 +867,7 @@ public function filtering_by_future_shows_future_cfp_closings_when_sorting_by_cf $response->assertDontSee('Conference B'); } - /** @test */ + #[Test] public function filtering_by_dismissed_shows_dismissed_conferences(): void { $user = User::factory()->create(); @@ -877,7 +878,7 @@ public function filtering_by_dismissed_shows_dismissed_conferences(): void $response->assertSee($conference->title); } - /** @test */ + #[Test] public function filtering_by_dismissed_does_not_show_undismissed_conferences(): void { $user = User::factory()->create(); @@ -890,7 +891,7 @@ public function filtering_by_dismissed_does_not_show_undismissed_conferences(): ->assertDontSee($conference->title); } - /** @test */ + #[Test] public function filtering_by_favorites_shows_favorite_conferences(): void { $user = User::factory()->create(); @@ -901,7 +902,7 @@ public function filtering_by_favorites_shows_favorite_conferences(): void $response->assertSee($conference->title); } - /** @test */ + #[Test] public function filtering_by_favorites_does_not_show_nonfavorite_conferences(): void { $user = User::factory()->create(); @@ -912,7 +913,7 @@ public function filtering_by_favorites_does_not_show_nonfavorite_conferences(): $response->assertDontSee($conference->title); } - /** @test */ + #[Test] public function a_favorited_conference_cannot_be_dismissed(): void { $user = User::factory()->create(); @@ -926,7 +927,7 @@ public function a_favorited_conference_cannot_be_dismissed(): void $this->assertFalse($conference->isDismissedBy($user->fresh())); } - /** @test */ + #[Test] public function a_dismissed_conference_cannot_be_favorited(): void { $user = User::factory()->create(); @@ -940,7 +941,7 @@ public function a_dismissed_conference_cannot_be_favorited(): void $this->assertFalse($conference->isFavoritedBy($user->fresh())); } - /** @test */ + #[Test] public function displaying_event_dates_with_no_dates_set(): void { $conference = Conference::factory()->make([ @@ -951,7 +952,7 @@ public function displaying_event_dates_with_no_dates_set(): void $this->assertNull($conference->event_dates_display); } - /** @test */ + #[Test] public function displaying_event_dates_with_a_start_date_and_no_end_date(): void { $conference = Conference::factory()->make([ @@ -962,7 +963,7 @@ public function displaying_event_dates_with_a_start_date_and_no_end_date(): void $this->assertEquals('January 1, 2020', $conference->event_dates_display); } - /** @test */ + #[Test] public function displaying_event_dates_with_an_end_date_and_no_start_date(): void { $conference = Conference::factory()->make([ @@ -973,7 +974,7 @@ public function displaying_event_dates_with_an_end_date_and_no_start_date(): voi $this->assertNull($conference->event_dates_display); } - /** @test */ + #[Test] public function displaying_event_dates_with_the_same_start_and_end_dates(): void { $conference = Conference::factory()->make([ @@ -984,7 +985,7 @@ public function displaying_event_dates_with_the_same_start_and_end_dates(): void $this->assertEquals('January 1, 2020', $conference->event_dates_display); } - /** @test */ + #[Test] public function displaying_event_dates_with_the_different_start_and_end_dates(): void { $conference = Conference::factory()->make([ @@ -1004,7 +1005,7 @@ public function assertConferenceSort($expectedConferences, $conferences) } } - /** @test */ + #[Test] public function scoping_conferences_queries_where_has_dates(): void { $conferenceA = Conference::factory()->create(['starts_at' => Carbon::parse('yesterday'), 'ends_at' => Carbon::parse('tomorrow')]); @@ -1020,7 +1021,7 @@ public function scoping_conferences_queries_where_has_dates(): void $this->assertNotContains($conferenceD->id, $conferenceIds); } - /** @test */ + #[Test] public function scoping_conferences_queries_where_has_cfp_start_date(): void { $conferenceA = Conference::factory()->create(['cfp_starts_at' => Carbon::parse('yesterday')]); @@ -1032,7 +1033,7 @@ public function scoping_conferences_queries_where_has_cfp_start_date(): void $this->assertNotContains($conferenceB->id, $conferenceIds); } - /** @test */ + #[Test] public function scoping_conferences_queries_where_favorited_by_user(): void { $user = User::factory()->create(); @@ -1045,7 +1046,7 @@ public function scoping_conferences_queries_where_favorited_by_user(): void $this->assertNotContains($conferenceB->id, $conferenceIds); } - /** @test */ + #[Test] public function scoping_conferences_queries_where_dismissed_by_user(): void { $user = User::factory()->create(); @@ -1058,7 +1059,7 @@ public function scoping_conferences_queries_where_dismissed_by_user(): void $this->assertNotContains($conferenceB->id, $conferenceIds); } - /** @test */ + #[Test] public function scoping_conferences_queries_where_not_dismissed_by_user(): void { $user = User::factory()->create(); @@ -1071,7 +1072,7 @@ public function scoping_conferences_queries_where_not_dismissed_by_user(): void $this->assertContains($conferenceB->id, $conferenceIds); } - /** @test */ + #[Test] public function scoping_conferences_queries_where_cfp_is_open(): void { Carbon::setTestNow('2023-05-04'); @@ -1085,7 +1086,7 @@ public function scoping_conferences_queries_where_cfp_is_open(): void $this->assertNotContains($conferenceB->id, $conferenceIds); } - /** @test */ + #[Test] public function scoping_conferences_queries_where_cfp_is_future(): void { Carbon::setTestNow('2023-05-04'); @@ -1099,7 +1100,7 @@ public function scoping_conferences_queries_where_cfp_is_future(): void $this->assertContains($conferenceB->id, $conferenceIds); } - /** @test */ + #[Test] public function scoping_conferences_queries_where_has_cfp_end_date(): void { $conferenceA = Conference::factory()->create(['cfp_ends_at' => Carbon::parse('yesterday')]); @@ -1111,7 +1112,7 @@ public function scoping_conferences_queries_where_has_cfp_end_date(): void $this->assertNotContains($conferenceB->id, $conferenceIds); } - /** @test */ + #[Test] function scoping_conference_queries_by_event_year_and_month(): void { $conferenceA = Conference::factory()->dates('2023-01-01')->create(); @@ -1127,7 +1128,7 @@ function scoping_conference_queries_by_event_year_and_month(): void $this->assertNotContains($conferenceD->id, $conferenceIds); } - /** @test */ + #[Test] function scoping_conference_queries_by_cfp_start_year_and_month(): void { $conferenceA = Conference::factory()->cfpDates('2023-01-01')->create(); @@ -1143,7 +1144,7 @@ function scoping_conference_queries_by_cfp_start_year_and_month(): void $this->assertNotContains($conferenceD->id, $conferenceIds); } - /** @test */ + #[Test] function scoping_conference_queries_by_cfp_end_year_and_month(): void { $conferenceA = Conference::factory()->cfpDates('2023-01-01')->create(); @@ -1159,7 +1160,7 @@ function scoping_conference_queries_by_cfp_end_year_and_month(): void $this->assertNotContains($conferenceD->id, $conferenceIds); } - /** @test */ + #[Test] function conferences_with_reported_issues_are_flagged(): void { Notification::fake(); @@ -1174,7 +1175,7 @@ function conferences_with_reported_issues_are_flagged(): void $this->assertTrue($conference->isFlagged()); } - /** @test */ + #[Test] function conferences_with_closed_issues_are_not_flagged(): void { $conference = Conference::factory()->withClosedIssue()->create(); @@ -1183,7 +1184,7 @@ function conferences_with_closed_issues_are_not_flagged(): void $this->assertFalse($conference->isFlagged()); } - /** @test */ + #[Test] function rejected_conferences_are_not_found(): void { $user = User::factory()->create(); @@ -1194,7 +1195,7 @@ function rejected_conferences_are_not_found(): void $response->assertNotFound(); } - /** @test */ + #[Test] function admins_can_see_rejected_conferences(): void { $user = User::factory()->admin()->create(); @@ -1205,7 +1206,7 @@ function admins_can_see_rejected_conferences(): void $response->assertSuccessful(); } - /** @test */ + #[Test] function rejecting_conferences(): void { $conference = Conference::factory()->create(); @@ -1216,7 +1217,7 @@ function rejecting_conferences(): void $this->assertNotNull($conference->fresh()->rejected_at); } - /** @test */ + #[Test] function restoring_rejected_conferences(): void { $conference = Conference::factory()->rejected()->create(); @@ -1227,7 +1228,7 @@ function restoring_rejected_conferences(): void $this->assertNull($conference->rejected_at); } - /** @test */ + #[Test] function checking_whether_a_conferences_is_rejected(): void { $conferenceA = Conference::factory()->create(); @@ -1237,7 +1238,7 @@ function checking_whether_a_conferences_is_rejected(): void $this->assertTrue($conferenceB->isRejected()); } - /** @test */ + #[Test] public function searching_conferences_by_name(): void { $conferenceA = Conference::factory()->create(['location' => 'Boston, MA']); @@ -1249,7 +1250,7 @@ public function searching_conferences_by_name(): void $this->assertNotContains($conferenceB->id, $results->pluck('id')); } - /** @test */ + #[Test] public function past_conferences_are_not_searchable(): void { $conferenceA = Conference::factory()->dates(now()->subDay())->create(); @@ -1259,7 +1260,7 @@ public function past_conferences_are_not_searchable(): void $this->assertTrue($conferenceB->shouldBeSearchable()); } - /** @test */ + #[Test] public function rejected_conferences_are_not_searchable(): void { $conferenceA = Conference::factory()->create(['rejected_at' => now()]); @@ -1269,7 +1270,7 @@ public function rejected_conferences_are_not_searchable(): void $this->assertTrue($conferenceB->shouldBeSearchable()); } - /** @test */ + #[Test] public function conferences_with_open_issues_are_flagged_on_the_index_page(): void { $conference = Conference::factory()->withOpenIssue()->create(); @@ -1282,7 +1283,7 @@ public function conferences_with_open_issues_are_flagged_on_the_index_page(): vo }); } - /** @test */ + #[Test] public function conferences_with_open_issues_are_flagged_on_the_show_page(): void { $conference = Conference::factory()->withOpenIssue()->create(); @@ -1293,7 +1294,7 @@ public function conferences_with_open_issues_are_flagged_on_the_show_page(): voi $response->assertSee('An issue has been reported for this conference.'); } - /** @test */ + #[Test] public function conferences_with_open_issues_are_flagged_on_the_public_show_page(): void { $conference = Conference::factory()->withOpenIssue()->create(); diff --git a/tests/Feature/NotificationTest.php b/tests/Feature/NotificationTest.php index 308b2a70..1ebe7544 100644 --- a/tests/Feature/NotificationTest.php +++ b/tests/Feature/NotificationTest.php @@ -2,6 +2,7 @@ namespace Tests\Feature; +use PHPUnit\Framework\Attributes\Test; use App\Models\Conference; use App\Models\User; use App\Notifications\CFPsAreOpen; @@ -11,7 +12,7 @@ class NotificationTest extends TestCase { - /** @test */ + #[Test] public function command_will_trigger_notification_for_approved_and_not_shared_conference(): void { Notification::fake(); @@ -24,7 +25,7 @@ public function command_will_trigger_notification_for_approved_and_not_shared_co $this->assertTrue(Conference::first()->is_shared); } - /** @test */ + #[Test] public function command_will_not_trigger_notification_for_unapproved_conference(): void { Notification::fake(); @@ -36,7 +37,7 @@ public function command_will_not_trigger_notification_for_unapproved_conference( Notification::assertNotSentTo([$user], CFPsAreOpen::class); } - /** @test */ + #[Test] public function command_will_not_trigger_notification_for_already_shared_conference(): void { Notification::fake(); @@ -48,7 +49,7 @@ public function command_will_not_trigger_notification_for_already_shared_confere Notification::assertNotSentTo([$user], CFPsAreOpen::class); } - /** @test */ + #[Test] public function command_will_not_trigger_notification_for_closed_cfp(): void { Notification::fake(); @@ -60,7 +61,7 @@ public function command_will_not_trigger_notification_for_closed_cfp(): void Notification::assertNotSentTo([$user], CFPsAreOpen::class); } - /** @test */ + #[Test] public function command_will_not_trigger_notification_if_no_cfp_dates_given(): void { Notification::fake(); @@ -72,7 +73,7 @@ public function command_will_not_trigger_notification_if_no_cfp_dates_given(): v Notification::assertNotSentTo([$user], CFPsAreOpen::class); } - /** @test */ + #[Test] public function command_will_not_trigger_notification_for_opt_out_user(): void { Notification::fake(); diff --git a/tests/Feature/PublicSpeakerProfileTest.php b/tests/Feature/PublicSpeakerProfileTest.php index 22eb56c2..dd971a44 100644 --- a/tests/Feature/PublicSpeakerProfileTest.php +++ b/tests/Feature/PublicSpeakerProfileTest.php @@ -2,6 +2,7 @@ namespace Tests\Feature; +use PHPUnit\Framework\Attributes\Test; use App\Mail\ContactRequest; use App\Models\Bio; use App\Models\Talk; @@ -14,7 +15,7 @@ class PublicSpeakerProfileTest extends TestCase { - /** @test */ + #[Test] public function non_public_speakers_are_not_listed_on_the_public_speaker_page(): void { $user = User::factory()->disableProfile()->create(); @@ -23,7 +24,7 @@ public function non_public_speakers_are_not_listed_on_the_public_speaker_page(): ->assertDontSee($user->name); } - /** @test */ + #[Test] public function public_speakers_are_listed_on_the_public_speaker_page(): void { $user = User::factory()->enableProfile()->create([ @@ -34,7 +35,7 @@ public function public_speakers_are_listed_on_the_public_speaker_page(): void ->assertSee($user->name); } - /** @test */ + #[Test] function speakers_can_be_found_by_searching_state_abbreviation(): void { User::factory()->enableProfile()->create([ @@ -54,7 +55,7 @@ function speakers_can_be_found_by_searching_state_abbreviation(): void $response->assertDontSee('Ezra Bridger'); } - /** @test */ + #[Test] function searching_by_state_abbreviation_is_case_insensitive(): void { User::factory()->enableProfile()->create([ @@ -74,7 +75,7 @@ function searching_by_state_abbreviation_is_case_insensitive(): void $response->assertDontSee('Ezra Bridger'); } - /** @test */ + #[Test] function speakers_can_be_found_by_searching_state_name(): void { User::factory()->enableProfile()->create([ @@ -94,7 +95,7 @@ function speakers_can_be_found_by_searching_state_name(): void $response->assertDontSee('Ezra Bridger'); } - /** @test */ + #[Test] function searching_by_state_name_is_case_insensitive(): void { User::factory()->enableProfile()->create([ @@ -114,7 +115,7 @@ function searching_by_state_name_is_case_insensitive(): void $response->assertDontSee('Ezra Bridger'); } - /** @test */ + #[Test] public function non_public_speakers_do_not_have_public_speaker_profile_pages(): void { $user = User::factory()->disableProfile()->create([ @@ -126,7 +127,7 @@ public function non_public_speakers_do_not_have_public_speaker_profile_pages(): $response->assertNotFound(); } - /** @test */ + #[Test] public function public_speakers_have_public_speaker_profile_pages(): void { $user = User::factory()->enableProfile()->create([ @@ -137,7 +138,7 @@ public function public_speakers_have_public_speaker_profile_pages(): void ->assertSee($user->name); } - /** @test */ + #[Test] public function talks_marked_not_public_are_not_listed_publicly(): void { $user = User::factory()->enableProfile()->create([ @@ -156,7 +157,7 @@ public function talks_marked_not_public_are_not_listed_publicly(): void $response->assertDontSee($talkRevision->title); } - /** @test */ + #[Test] public function talks_marked_not_public_do_not_have_public_pages(): void { $user = User::factory()->enableProfile()->create([ @@ -177,7 +178,7 @@ public function talks_marked_not_public_do_not_have_public_pages(): void $response->assertNotFound(); } - /** @test */ + #[Test] public function talks_marked_public_are_listed_publicly(): void { $user = User::factory()->enableProfile()->create([ @@ -196,7 +197,7 @@ public function talks_marked_public_are_listed_publicly(): void $response->assertSee($talkRevision->title); } - /** @test */ + #[Test] public function bios_marked_public_are_listed_publicly(): void { $user = User::factory()->enableProfile()->create([ @@ -213,7 +214,7 @@ public function bios_marked_public_are_listed_publicly(): void $response->assertSee($bio->title); } - /** @test */ + #[Test] public function bios_marked_not_public_do_not_have_public_pages(): void { $user = User::factory()->enableProfile()->create([ @@ -229,7 +230,7 @@ public function bios_marked_not_public_do_not_have_public_pages(): void $response->assertDontSee('Private Bio'); } - /** @test */ + #[Test] public function bios_marked_public_have_public_pages(): void { $user = User::factory()->enableProfile()->create([ @@ -245,7 +246,7 @@ public function bios_marked_public_have_public_pages(): void $response->assertSee($bio->nickname); } - /** @test */ + #[Test] public function public_profile_page_is_off_by_default(): void { $user = User::factory()->create([ @@ -257,7 +258,7 @@ public function public_profile_page_is_off_by_default(): void $response->assertNotFound(); } - /** @test */ + #[Test] public function non_contactable_users_profile_pages_do_not_show_contact(): void { $this->withoutMiddleware(); @@ -277,7 +278,7 @@ public function non_contactable_users_profile_pages_do_not_show_contact(): void ->assertNotFound(); } - /** @test */ + #[Test] public function contactable_users_profile_pages_show_contact(): void { $user = User::factory()->enableProfile()->create([ @@ -294,7 +295,7 @@ public function contactable_users_profile_pages_show_contact(): void //sending email in next test } - /** @test */ + #[Test] public function user_can_be_contacted_from_profile(): void { Mail::fake(); @@ -319,7 +320,7 @@ public function user_can_be_contacted_from_profile(): void }); } - /** @test */ + #[Test] public function disabled_profile_user_cannot_be_contacted(): void { $user = User::factory()->disableProfile()->create([ @@ -334,7 +335,7 @@ public function disabled_profile_user_cannot_be_contacted(): void ->assertNotFound(); } - /** @test */ + #[Test] public function public_profile_pages_do_not_show_talks_for_other_users(): void { $user = User::factory()->enableProfile()->create([ @@ -359,7 +360,7 @@ public function public_profile_pages_do_not_show_talks_for_other_users(): void ->assertDontSee($talk->currentRevision->title); } - /** @test */ + #[Test] public function public_profile_pages_do_not_show_bios_for_other_users(): void { $user = User::factory()->enableProfile()->create([ diff --git a/tests/Feature/RejectionTest.php b/tests/Feature/RejectionTest.php index 81598c25..345bf6c3 100644 --- a/tests/Feature/RejectionTest.php +++ b/tests/Feature/RejectionTest.php @@ -2,6 +2,7 @@ namespace Tests\Feature; +use PHPUnit\Framework\Attributes\Test; use App\Models\Conference; use App\Models\Rejection; use App\Models\Submission; @@ -12,7 +13,7 @@ class RejectionTest extends TestCase { - /** @test */ + #[Test] public function can_create_from_submission(): void { $user = User::factory()->create(); @@ -36,7 +37,7 @@ public function can_create_from_submission(): void $this->assertEquals($submission->id, $rejection->submission->id); } - /** @test */ + #[Test] public function user_can_remove_rejection_via_http(): void { $user = User::factory()->create(); diff --git a/tests/Feature/SpeakerPackageTest.php b/tests/Feature/SpeakerPackageTest.php index 6d624b9e..49140fe3 100644 --- a/tests/Feature/SpeakerPackageTest.php +++ b/tests/Feature/SpeakerPackageTest.php @@ -2,6 +2,7 @@ namespace Tests\Feature; +use PHPUnit\Framework\Attributes\Test; use App\Casts\SpeakerPackage; use App\Models\Conference; use App\Models\User; @@ -10,7 +11,7 @@ class SpeakerPackageTest extends TestCase { - /** @test */ + #[Test] public function speaker_package_can_be_saved_when_conference_is_created(): void { $user = User::factory()->create(); @@ -38,7 +39,7 @@ public function speaker_package_can_be_saved_when_conference_is_created(): void ]); } - /** @test */ + #[Test] public function speaker_package_can_be_saved_when_conference_is_edited(): void { $user = User::factory()->create(); @@ -69,7 +70,7 @@ public function speaker_package_can_be_saved_when_conference_is_edited(): void ]); } - /** @test */ + #[Test] public function speaker_package_can_be_updated(): void { $user = User::factory()->create(); @@ -94,7 +95,7 @@ public function speaker_package_can_be_updated(): void $this->assertDatabaseHasSpeakerPackage($updatedPackage); } - /** @test */ + #[Test] public function speaker_package_can_be_removed(): void { $user = User::factory()->create(); @@ -114,7 +115,7 @@ public function speaker_package_can_be_removed(): void }); } - /** @test */ + #[Test] public function decimal_values_are_stored_as_whole_numbers(): void { $user = User::factory()->create(); @@ -140,7 +141,7 @@ public function decimal_values_are_stored_as_whole_numbers(): void $this->assertEquals(525, $conferencePackage->hotel); } - /** @test */ + #[Test] public function values_must_be_valid_currency(): void { $user = User::factory()->create(); @@ -164,7 +165,7 @@ public function values_must_be_valid_currency(): void ]); } - /** @test */ + #[Test] public function non_us_formats_are_stored_correctly_for_non_us_locale(): void { App::setLocale('de'); @@ -192,7 +193,7 @@ public function non_us_formats_are_stored_correctly_for_non_us_locale(): void ]); } - /** @test */ + #[Test] public function non_us_formats_fail_validation_in_us_locale(): void { App::setLocale('en'); @@ -222,7 +223,7 @@ public function non_us_formats_fail_validation_in_us_locale(): void ]); } - /** @test */ + #[Test] public function only_number_values_are_permissible(): void { $user = User::factory()->create(); diff --git a/tests/Feature/SubmissionTest.php b/tests/Feature/SubmissionTest.php index 530aa2d5..25454a5d 100644 --- a/tests/Feature/SubmissionTest.php +++ b/tests/Feature/SubmissionTest.php @@ -2,6 +2,7 @@ namespace Tests\Feature; +use PHPUnit\Framework\Attributes\Test; use App\Models\Conference; use App\Models\Rejection; use App\Models\Submission; @@ -12,7 +13,7 @@ class SubmissionTest extends TestCase { - /** @test */ + #[Test] public function user_can_submit_talks_via_http(): void { $user = User::factory()->create(); @@ -31,7 +32,7 @@ public function user_can_submit_talks_via_http(): void $this->assertTrue($conference->submissions->count() === 1); } - /** @test */ + #[Test] public function user_can_unsubmit_talks_via_http(): void { $user = User::factory()->create(); @@ -53,7 +54,7 @@ public function user_can_unsubmit_talks_via_http(): void $this->assertTrue($conference->submissions->isEmpty()); } - /** @test */ + #[Test] public function user_cannot_submit_other_users_talk(): void { $user = User::factory()->create(); @@ -75,7 +76,7 @@ public function user_cannot_submit_other_users_talk(): void $this->assertEquals(0, $conference->submissions->count()); } - /** @test */ + #[Test] public function user_cannot_unsubmit_other_users_talk(): void { $user = User::factory()->create(); @@ -102,7 +103,7 @@ public function user_cannot_unsubmit_other_users_talk(): void $this->assertTrue($conference->submissions->contains($submission)); } - /** @test */ + #[Test] public function user_can_add_a_reason_for_acceptance(): void { $user = User::factory()->create(); @@ -128,7 +129,7 @@ public function user_can_add_a_reason_for_acceptance(): void ); } - /** @test */ + #[Test] public function user_can_add_a_reason_for_rejection(): void { $user = User::factory()->create(); @@ -154,7 +155,7 @@ public function user_can_add_a_reason_for_rejection(): void ); } - /** @test */ + #[Test] public function it_can_validate_the_response_type(): void { $user = User::factory()->create(); @@ -174,7 +175,7 @@ public function it_can_validate_the_response_type(): void ])->assertSessionHasErrors(); } - /** @test */ + #[Test] public function it_can_store_an_acceptance_without_a_reason(): void { $user = User::factory()->create(); @@ -197,7 +198,7 @@ public function it_can_store_an_acceptance_without_a_reason(): void $this->assertSame($submission->talk_revision_id, $rejection->talk_revision_id); } - /** @test */ + #[Test] function acceptance_reasons_can_be_updated(): void { $submission = Submission::factory()->accepted([ @@ -217,7 +218,7 @@ function acceptance_reasons_can_be_updated(): void }); } - /** @test */ + #[Test] function rejection_reasons_can_be_updated(): void { $submission = Submission::factory()->rejected([ @@ -237,7 +238,7 @@ function rejection_reasons_can_be_updated(): void }); } - /** @test */ + #[Test] function toggling_submission_responses_from_accepted_to_rejected(): void { $submission = Submission::factory()->accepted()->create(); @@ -257,7 +258,7 @@ function toggling_submission_responses_from_accepted_to_rejected(): void ]); } - /** @test */ + #[Test] function toggling_submission_responses_from_rejected_to_accepted(): void { $submission = Submission::factory()->rejected()->create(); @@ -277,7 +278,7 @@ function toggling_submission_responses_from_rejected_to_accepted(): void ]); } - /** @test */ + #[Test] function submissions_with_an_acceptance_have_an_acceptance_response_and_reason(): void { $submission = Submission::factory()->accepted([ @@ -288,7 +289,7 @@ function submissions_with_an_acceptance_have_an_acceptance_response_and_reason() $this->assertEquals('it was a good talk', $submission->response_reason); } - /** @test */ + #[Test] function submissions_with_a_rejection_have_a_rejection_response(): void { $submission = Submission::factory()->rejected([ @@ -299,7 +300,7 @@ function submissions_with_a_rejection_have_a_rejection_response(): void $this->assertEquals('it was a bad talk', $submission->response_reason); } - /** @test */ + #[Test] function scoping_submissions_where_not_rejected(): void { $submissionA = Submission::factory()->pending()->create(); @@ -313,7 +314,7 @@ function scoping_submissions_where_not_rejected(): void $this->assertNotContains($submissionC->id, $submissionIds); } - /** @test */ + #[Test] function scoping_sumissions_where_future(): void { $submissionA = Submission::factory() diff --git a/tests/Feature/SyncCallingAllPapersEventsTest.php b/tests/Feature/SyncCallingAllPapersEventsTest.php index 45b542c3..c7da72cd 100644 --- a/tests/Feature/SyncCallingAllPapersEventsTest.php +++ b/tests/Feature/SyncCallingAllPapersEventsTest.php @@ -2,6 +2,7 @@ namespace Tests\Feature; +use PHPUnit\Framework\Attributes\Test; use App\Notifications\ConferenceImporterError; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Support\Carbon; @@ -17,7 +18,7 @@ class SyncCallingAllPapersEventsTest extends TestCase protected $eventStub; - /** @test */ + #[Test] function caching_timestamp_when_command_ends(): void { Notification::fake(); @@ -33,7 +34,7 @@ function caching_timestamp_when_command_ends(): void ); } - /** @test */ + #[Test] function notifying_slack_when_command_errors(): void { Notification::fake(); diff --git a/tests/Feature/TalkReactionsTest.php b/tests/Feature/TalkReactionsTest.php index e242411f..dad182a7 100644 --- a/tests/Feature/TalkReactionsTest.php +++ b/tests/Feature/TalkReactionsTest.php @@ -2,6 +2,7 @@ namespace Tests\Feature; +use PHPUnit\Framework\Attributes\Test; use App\Models\Talk; use Illuminate\Foundation\Testing\RefreshDatabase; use Tests\TestCase; @@ -10,7 +11,7 @@ class TalkReactionsTest extends TestCase { use RefreshDatabase; - /** @test */ + #[Test] function creating_a_talk_reaction(): void { $talk = Talk::factory()->submitted()->create(); @@ -26,7 +27,7 @@ function creating_a_talk_reaction(): void $this->assertEquals('https://example.com', $submission->reactions->first()->url); } - /** @test */ + #[Test] function a_url_is_required_when_creating_a_talk_reaction(): void { $talk = Talk::factory()->submitted()->create(); @@ -40,7 +41,7 @@ function a_url_is_required_when_creating_a_talk_reaction(): void $this->assertEquals(0, $submission->reactions()->count()); } - /** @test */ + #[Test] function a_valid_url_is_required_when_creating_a_talk_reaction(): void { $talk = Talk::factory()->submitted()->create(); diff --git a/tests/Feature/TalkTest.php b/tests/Feature/TalkTest.php index 5d319134..cc27bbd8 100644 --- a/tests/Feature/TalkTest.php +++ b/tests/Feature/TalkTest.php @@ -2,6 +2,7 @@ namespace Tests\Feature; +use PHPUnit\Framework\Attributes\Test; use App\Models\Acceptance; use App\Models\Conference; use App\Models\Submission; @@ -13,7 +14,7 @@ class TalkTest extends TestCase { - /** @test */ + #[Test] function archived_talks_are_not_included_on_the_index_page(): void { $user = User::factory()->create(); @@ -35,7 +36,7 @@ function archived_talks_are_not_included_on_the_index_page(): void $response->assertDontSee('my archived talk'); } - /** @test */ + #[Test] function active_talks_are_not_included_on_the_archived_index_page(): void { $user = User::factory()->create(); @@ -57,7 +58,7 @@ function active_talks_are_not_included_on_the_archived_index_page(): void $response->assertDontSee('my active talk'); } - /** @test */ + #[Test] public function it_shows_the_talk_title_on_its_page(): void { $user = User::factory()->create(); @@ -72,7 +73,7 @@ public function it_shows_the_talk_title_on_its_page(): void $response->assertSee($revision->title); } - /** @test */ + #[Test] public function user_talks_are_sorted_alphabetically(): void { $user = User::factory()->create(); @@ -85,7 +86,7 @@ public function user_talks_are_sorted_alphabetically(): void $this->assertEquals('zyxwv', $talks->sortByTitle()->last()->currentRevision->title); } - /** @test */ + #[Test] public function user_talks_json_encode_without_keys(): void { $user = User::factory()->create(); @@ -103,7 +104,7 @@ public function user_talks_json_encode_without_keys(): void $this->assertTrue(is_array(json_decode($json))); } - /** @test */ + #[Test] public function user_can_create_a_talk(): void { $user = User::factory()->create(); @@ -139,7 +140,7 @@ public function user_can_create_a_talk(): void ->assertSee('No, really.'); } - /** @test */ + #[Test] function new_talks_must_include_required_fields(): void { $user = User::factory()->create(); @@ -157,7 +158,7 @@ function new_talks_must_include_required_fields(): void ]); } - /** @test */ + #[Test] function new_talks_must_include_a_valid_length(): void { $user = User::factory()->create(); @@ -175,7 +176,7 @@ function new_talks_must_include_a_valid_length(): void $response->assertInvalid(['length']); } - /** @test */ + #[Test] function new_talks_with_slides_must_include_a_valid_slides_url(): void { $user = User::factory()->create(); @@ -194,7 +195,7 @@ function new_talks_with_slides_must_include_a_valid_slides_url(): void $response->assertInvalid(['slides']); } - /** @test */ + #[Test] public function user_can_delete_a_talk(): void { $user = User::factory()->create(); @@ -212,7 +213,7 @@ public function user_can_delete_a_talk(): void $this->assertModelMissing($talkRevision); } - /** @test */ + #[Test] public function user_can_save_a_new_revision_of_a_talk(): void { $user = User::factory()->create(); @@ -238,7 +239,7 @@ public function user_can_save_a_new_revision_of_a_talk(): void $this->assertEquals('old title', $talk->revisions->last()->title); } - /** @test */ + #[Test] function revised_talks_must_include_required_fields(): void { $user = User::factory()->create(); @@ -257,7 +258,7 @@ function revised_talks_must_include_required_fields(): void ]); } - /** @test */ + #[Test] function revised_talks_must_include_a_valid_length(): void { $user = User::factory()->create(); @@ -271,7 +272,7 @@ function revised_talks_must_include_a_valid_length(): void $response->assertInvalid(['length']); } - /** @test */ + #[Test] function revised_talks_with_slides_must_include_a_valid_slides_url(): void { $user = User::factory()->create(); @@ -285,7 +286,7 @@ function revised_talks_with_slides_must_include_a_valid_slides_url(): void $response->assertInvalid(['slides']); } - /** @test */ + #[Test] public function scoping_talks_where_submitted(): void { [$talkRevisionA, $talkRevisionB] = TalkRevision::factory()->count(2)->create(); @@ -301,7 +302,7 @@ public function scoping_talks_where_submitted(): void $this->assertNotContains($talkRevisionB->talk_id, $submittedTalkIds); } - /** @test */ + #[Test] public function scoping_talks_where_accepted(): void { [$talkRevisionA, $talkRevisionB] = TalkRevision::factory()->count(2)->create(); @@ -324,7 +325,7 @@ public function scoping_talks_where_accepted(): void $this->assertNotContains($talkRevisionB->talk_id, $acceptedTalkIds); } - /** @test */ + #[Test] function archived_talks_are_not_included_in_queries_by_default(): void { $talk = Talk::factory()->archived()->create(); @@ -337,7 +338,7 @@ function archived_talks_are_not_included_in_queries_by_default(): void $this->assertContains($talk->id, $allTalks->pluck('id')); } - /** @test */ + #[Test] function archived_talks_can_be_restored(): void { $talk = Talk::factory()->archived()->create(); @@ -349,7 +350,7 @@ function archived_talks_can_be_restored(): void $this->assertFalse($talk->fresh()->isArchived()); } - /** @test */ + #[Test] function archived_talks_can_be_deleted(): void { $talk = Talk::factory()->archived()->create(); @@ -361,7 +362,7 @@ function archived_talks_can_be_deleted(): void $this->assertDatabaseMissing('talks', ['id' => $talk->id]); } - /** @test */ + #[Test] public function editing_a_talk(): void { $talk = Talk::factory()->create(); diff --git a/tests/Feature/UserTest.php b/tests/Feature/UserTest.php index d4b4f11d..38fb2def 100644 --- a/tests/Feature/UserTest.php +++ b/tests/Feature/UserTest.php @@ -2,6 +2,7 @@ namespace Tests\Feature; +use PHPUnit\Framework\Attributes\Test; use App\Models\Conference; use App\Models\Talk; use App\Models\User; @@ -9,7 +10,7 @@ class UserTest extends TestCase { - /** @test */ + #[Test] public function it_checks_if_user_is_admin(): void { $user = User::factory()->create(); @@ -21,7 +22,7 @@ public function it_checks_if_user_is_admin(): void $this->assertTrue($admin->isAdmin()); } - /** @test */ + #[Test] public function it_returns_all_users_subscribed_to_notifications(): void { User::factory()->create(); @@ -30,7 +31,7 @@ public function it_returns_all_users_subscribed_to_notifications(): void $this->assertEquals(1, User::wantsNotifications()->count()); } - /** @test */ + #[Test] function archived_talks_are_not_included_in_the_talks_relationship(): void { $user = User::factory()->create(); @@ -52,7 +53,7 @@ function only_admins_can_access_filament() $this->assertTrue($admin->canAccessFilament()); } - /** @test */ + #[Test] function getting_conference_submissions(): void { $user = User::factory()->create(); diff --git a/tests/Feature/VerifyConferenceImporterHeartbeatTest.php b/tests/Feature/VerifyConferenceImporterHeartbeatTest.php index e0d5e8af..b39ee35c 100644 --- a/tests/Feature/VerifyConferenceImporterHeartbeatTest.php +++ b/tests/Feature/VerifyConferenceImporterHeartbeatTest.php @@ -2,13 +2,14 @@ namespace Tests\Feature; +use PHPUnit\Framework\Attributes\Test; use App\Notifications\ConferenceImporterInactive; use Illuminate\Support\Facades\Notification; use Tests\TestCase; class VerifyConferenceImporterHeartbeatTest extends TestCase { - /** @test */ + #[Test] function slack_is_notified_when_the_importer_has_not_run_in_24_hours(): void { Notification::fake(); @@ -19,7 +20,7 @@ function slack_is_notified_when_the_importer_has_not_run_in_24_hours(): void Notification::assertSentToTightenSlack(ConferenceImporterInactive::class); } - /** @test */ + #[Test] function slack_is_not_notified_when_the_importer_has_run_within_24_hours(): void { Notification::fake(); diff --git a/tests/Integration/GeocoderTest.php b/tests/Integration/GeocoderTest.php index 0ba0a55a..52496fee 100644 --- a/tests/Integration/GeocoderTest.php +++ b/tests/Integration/GeocoderTest.php @@ -2,6 +2,7 @@ namespace Tests\Feature; +use PHPUnit\Framework\Attributes\Test; use App\Exceptions\InvalidAddressGeocodingException; use App\Services\Geocoder; use Illuminate\Support\Facades\Http; @@ -9,7 +10,7 @@ class GeocoderTest extends TestCase { - /** @test */ + #[Test] function geocoding_an_address(): void { $this->markTestSkipped('This test fails intermittently.'); @@ -22,7 +23,7 @@ function geocoding_an_address(): void $this->assertEquals('-77.0363304', $coordinates->getLongitude()); } - /** @test */ + #[Test] function catching_invalid_addresses(): void { $this->expectNotToPerformAssertions(); @@ -37,7 +38,7 @@ function catching_invalid_addresses(): void $this->fail('An exception was expected but not thrown'); } - /** @test */ + #[Test] function invalid_addresses_are_only_attempted_once(): void { $geocoder = app(Geocoder::class); From fbedeae048c6e4c5412612f6ccb201cd27e63df6 Mon Sep 17 00:00:00 2001 From: Shift Date: Wed, 3 Jul 2024 13:31:56 +0000 Subject: [PATCH 4/4] Define test classes as `final` --- tests/Api/ApiTestCase.php | 2 +- tests/Api/BioApiTest.php | 2 +- tests/Api/ConferenceApiTest.php | 2 +- tests/Api/JsonApiTest.php | 2 +- tests/Api/MeApiTest.php | 2 +- tests/Api/TalkApiTest.php | 2 +- tests/Console/Commands/TweetImportantCFPDatesTest.php | 2 +- tests/Feature/AcceptanceTest.php | 2 +- tests/Feature/AccountTest.php | 2 +- tests/Feature/AdminTest.php | 2 +- tests/Feature/BiosTest.php | 2 +- tests/Feature/CallingAllPapersConferenceImporterTest.php | 2 +- tests/Feature/ConferenceIssuesTest.php | 2 +- tests/Feature/ConferenceTest.php | 2 +- tests/Feature/NotificationTest.php | 2 +- tests/Feature/PublicSpeakerProfileTest.php | 2 +- tests/Feature/RejectionTest.php | 2 +- tests/Feature/SpeakerPackageTest.php | 2 +- tests/Feature/SubmissionTest.php | 2 +- tests/Feature/SyncCallingAllPapersEventsTest.php | 2 +- tests/Feature/TalkReactionsTest.php | 2 +- tests/Feature/TalkTest.php | 2 +- tests/Feature/UserTest.php | 2 +- tests/Feature/VerifyConferenceImporterHeartbeatTest.php | 2 +- tests/Integration/GeocoderTest.php | 2 +- tests/Unit/ExampleTest.php | 2 +- 26 files changed, 26 insertions(+), 26 deletions(-) diff --git a/tests/Api/ApiTestCase.php b/tests/Api/ApiTestCase.php index eea531b1..4edb373f 100644 --- a/tests/Api/ApiTestCase.php +++ b/tests/Api/ApiTestCase.php @@ -8,7 +8,7 @@ use Laravel\Passport\Passport; use Tests\TestCase; -class ApiTestCase extends TestCase +final class ApiTestCase extends TestCase { use DatabaseTransactions; diff --git a/tests/Api/BioApiTest.php b/tests/Api/BioApiTest.php index c16c6020..d5562081 100644 --- a/tests/Api/BioApiTest.php +++ b/tests/Api/BioApiTest.php @@ -5,7 +5,7 @@ use PHPUnit\Framework\Attributes\Test; use App\Models\Bio; -class BioApiTest extends ApiTestCase +final class BioApiTest extends ApiTestCase { #[Test] public function can_fetch_all_user_bios(): void diff --git a/tests/Api/ConferenceApiTest.php b/tests/Api/ConferenceApiTest.php index 58710434..bc58b6f5 100644 --- a/tests/Api/ConferenceApiTest.php +++ b/tests/Api/ConferenceApiTest.php @@ -5,7 +5,7 @@ use PHPUnit\Framework\Attributes\Test; use App\Models\Conference; -class ConferenceApiTest extends ApiTestCase +final class ConferenceApiTest extends ApiTestCase { #[Test] public function can_fetch_all_conferences(): void diff --git a/tests/Api/JsonApiTest.php b/tests/Api/JsonApiTest.php index 44d46a1f..de03beef 100644 --- a/tests/Api/JsonApiTest.php +++ b/tests/Api/JsonApiTest.php @@ -4,7 +4,7 @@ use PHPUnit\Framework\Attributes\Test; -class JsonApiTest extends ApiTestCase +final class JsonApiTest extends ApiTestCase { #[Test] public function uses_correct_json_api_header(): void diff --git a/tests/Api/MeApiTest.php b/tests/Api/MeApiTest.php index 2f65c559..ef5c8e63 100644 --- a/tests/Api/MeApiTest.php +++ b/tests/Api/MeApiTest.php @@ -4,7 +4,7 @@ use PHPUnit\Framework\Attributes\Test; -class MeApiTest extends ApiTestCase +final class MeApiTest extends ApiTestCase { #[Test] public function can_fetch_my_info(): void diff --git a/tests/Api/TalkApiTest.php b/tests/Api/TalkApiTest.php index 931ad0be..8a0e28dc 100644 --- a/tests/Api/TalkApiTest.php +++ b/tests/Api/TalkApiTest.php @@ -6,7 +6,7 @@ use App\Models\Talk; use App\Models\TalkRevision; -class TalkApiTest extends ApiTestCase +final class TalkApiTest extends ApiTestCase { #[Test] public function can_fetch_all_talks_for_user(): void diff --git a/tests/Console/Commands/TweetImportantCFPDatesTest.php b/tests/Console/Commands/TweetImportantCFPDatesTest.php index ac1c1ea1..b57e29f6 100644 --- a/tests/Console/Commands/TweetImportantCFPDatesTest.php +++ b/tests/Console/Commands/TweetImportantCFPDatesTest.php @@ -9,7 +9,7 @@ use Carbon\Carbon; use Tests\TestCase; -class TweetImportantCFPDatesTest extends TestCase +final class TweetImportantCFPDatesTest extends TestCase { #[Test] public function cfps_opening_today_should_be_tweeted(): void diff --git a/tests/Feature/AcceptanceTest.php b/tests/Feature/AcceptanceTest.php index 5e9713dd..ebedf365 100644 --- a/tests/Feature/AcceptanceTest.php +++ b/tests/Feature/AcceptanceTest.php @@ -11,7 +11,7 @@ use App\Models\User; use Tests\TestCase; -class AcceptanceTest extends TestCase +final class AcceptanceTest extends TestCase { #[Test] public function can_create_from_submission(): void diff --git a/tests/Feature/AccountTest.php b/tests/Feature/AccountTest.php index b5596358..04203926 100644 --- a/tests/Feature/AccountTest.php +++ b/tests/Feature/AccountTest.php @@ -17,7 +17,7 @@ use Livewire\Livewire; use Tests\TestCase; -class AccountTest extends TestCase +final class AccountTest extends TestCase { #[Test] public function users_can_log_in(): void diff --git a/tests/Feature/AdminTest.php b/tests/Feature/AdminTest.php index 2a49de47..9c5c097e 100644 --- a/tests/Feature/AdminTest.php +++ b/tests/Feature/AdminTest.php @@ -7,7 +7,7 @@ use App\Models\User; use Tests\TestCase; -class AdminTest extends TestCase +final class AdminTest extends TestCase { #[Test] public function admins_can_edit_other_peoples_conferences(): void diff --git a/tests/Feature/BiosTest.php b/tests/Feature/BiosTest.php index 0057b999..dc2a5566 100644 --- a/tests/Feature/BiosTest.php +++ b/tests/Feature/BiosTest.php @@ -7,7 +7,7 @@ use App\Models\User; use Tests\TestCase; -class BiosTest extends TestCase +final class BiosTest extends TestCase { #[Test] public function user_can_create_a_private_bio(): void diff --git a/tests/Feature/CallingAllPapersConferenceImporterTest.php b/tests/Feature/CallingAllPapersConferenceImporterTest.php index 9bbf4f63..090261dd 100644 --- a/tests/Feature/CallingAllPapersConferenceImporterTest.php +++ b/tests/Feature/CallingAllPapersConferenceImporterTest.php @@ -12,7 +12,7 @@ use Tests\MocksCallingAllPapers; use Tests\TestCase; -class CallingAllPapersConferenceImporterTest extends TestCase +final class CallingAllPapersConferenceImporterTest extends TestCase { use MocksCallingAllPapers; diff --git a/tests/Feature/ConferenceIssuesTest.php b/tests/Feature/ConferenceIssuesTest.php index 3dfa9c8d..e2e33299 100644 --- a/tests/Feature/ConferenceIssuesTest.php +++ b/tests/Feature/ConferenceIssuesTest.php @@ -11,7 +11,7 @@ use Illuminate\Support\Facades\Notification; use Tests\TestCase; -class ConferenceIssuesTest extends TestCase +final class ConferenceIssuesTest extends TestCase { use RefreshDatabase; diff --git a/tests/Feature/ConferenceTest.php b/tests/Feature/ConferenceTest.php index bffeb72c..3d30d4c4 100644 --- a/tests/Feature/ConferenceTest.php +++ b/tests/Feature/ConferenceTest.php @@ -11,7 +11,7 @@ use Livewire\Livewire; use Tests\TestCase; -class ConferenceTest extends TestCase +final class ConferenceTest extends TestCase { #[Test] public function user_can_create_conference(): void diff --git a/tests/Feature/NotificationTest.php b/tests/Feature/NotificationTest.php index 1ebe7544..824f5e84 100644 --- a/tests/Feature/NotificationTest.php +++ b/tests/Feature/NotificationTest.php @@ -10,7 +10,7 @@ use Illuminate\Support\Facades\Notification; use Tests\TestCase; -class NotificationTest extends TestCase +final class NotificationTest extends TestCase { #[Test] public function command_will_trigger_notification_for_approved_and_not_shared_conference(): void diff --git a/tests/Feature/PublicSpeakerProfileTest.php b/tests/Feature/PublicSpeakerProfileTest.php index dd971a44..e8d3eafb 100644 --- a/tests/Feature/PublicSpeakerProfileTest.php +++ b/tests/Feature/PublicSpeakerProfileTest.php @@ -13,7 +13,7 @@ use Illuminate\Support\Facades\Mail; use Tests\TestCase; -class PublicSpeakerProfileTest extends TestCase +final class PublicSpeakerProfileTest extends TestCase { #[Test] public function non_public_speakers_are_not_listed_on_the_public_speaker_page(): void diff --git a/tests/Feature/RejectionTest.php b/tests/Feature/RejectionTest.php index 345bf6c3..91742a42 100644 --- a/tests/Feature/RejectionTest.php +++ b/tests/Feature/RejectionTest.php @@ -11,7 +11,7 @@ use App\Models\User; use Tests\TestCase; -class RejectionTest extends TestCase +final class RejectionTest extends TestCase { #[Test] public function can_create_from_submission(): void diff --git a/tests/Feature/SpeakerPackageTest.php b/tests/Feature/SpeakerPackageTest.php index 49140fe3..05f670fb 100644 --- a/tests/Feature/SpeakerPackageTest.php +++ b/tests/Feature/SpeakerPackageTest.php @@ -9,7 +9,7 @@ use Illuminate\Support\Facades\App; use Tests\TestCase; -class SpeakerPackageTest extends TestCase +final class SpeakerPackageTest extends TestCase { #[Test] public function speaker_package_can_be_saved_when_conference_is_created(): void diff --git a/tests/Feature/SubmissionTest.php b/tests/Feature/SubmissionTest.php index 25454a5d..39a0706d 100644 --- a/tests/Feature/SubmissionTest.php +++ b/tests/Feature/SubmissionTest.php @@ -11,7 +11,7 @@ use App\Models\User; use Tests\TestCase; -class SubmissionTest extends TestCase +final class SubmissionTest extends TestCase { #[Test] public function user_can_submit_talks_via_http(): void diff --git a/tests/Feature/SyncCallingAllPapersEventsTest.php b/tests/Feature/SyncCallingAllPapersEventsTest.php index c7da72cd..03c8e47a 100644 --- a/tests/Feature/SyncCallingAllPapersEventsTest.php +++ b/tests/Feature/SyncCallingAllPapersEventsTest.php @@ -11,7 +11,7 @@ use Tests\MocksCallingAllPapers; use Tests\TestCase; -class SyncCallingAllPapersEventsTest extends TestCase +final class SyncCallingAllPapersEventsTest extends TestCase { use RefreshDatabase; use MocksCallingAllPapers; diff --git a/tests/Feature/TalkReactionsTest.php b/tests/Feature/TalkReactionsTest.php index dad182a7..0e000569 100644 --- a/tests/Feature/TalkReactionsTest.php +++ b/tests/Feature/TalkReactionsTest.php @@ -7,7 +7,7 @@ use Illuminate\Foundation\Testing\RefreshDatabase; use Tests\TestCase; -class TalkReactionsTest extends TestCase +final class TalkReactionsTest extends TestCase { use RefreshDatabase; diff --git a/tests/Feature/TalkTest.php b/tests/Feature/TalkTest.php index cc27bbd8..ca761636 100644 --- a/tests/Feature/TalkTest.php +++ b/tests/Feature/TalkTest.php @@ -12,7 +12,7 @@ use Carbon\Carbon; use Tests\TestCase; -class TalkTest extends TestCase +final class TalkTest extends TestCase { #[Test] function archived_talks_are_not_included_on_the_index_page(): void diff --git a/tests/Feature/UserTest.php b/tests/Feature/UserTest.php index 38fb2def..d9fb0595 100644 --- a/tests/Feature/UserTest.php +++ b/tests/Feature/UserTest.php @@ -8,7 +8,7 @@ use App\Models\User; use Tests\TestCase; -class UserTest extends TestCase +final class UserTest extends TestCase { #[Test] public function it_checks_if_user_is_admin(): void diff --git a/tests/Feature/VerifyConferenceImporterHeartbeatTest.php b/tests/Feature/VerifyConferenceImporterHeartbeatTest.php index b39ee35c..c6078efa 100644 --- a/tests/Feature/VerifyConferenceImporterHeartbeatTest.php +++ b/tests/Feature/VerifyConferenceImporterHeartbeatTest.php @@ -7,7 +7,7 @@ use Illuminate\Support\Facades\Notification; use Tests\TestCase; -class VerifyConferenceImporterHeartbeatTest extends TestCase +final class VerifyConferenceImporterHeartbeatTest extends TestCase { #[Test] function slack_is_notified_when_the_importer_has_not_run_in_24_hours(): void diff --git a/tests/Integration/GeocoderTest.php b/tests/Integration/GeocoderTest.php index 52496fee..e608feab 100644 --- a/tests/Integration/GeocoderTest.php +++ b/tests/Integration/GeocoderTest.php @@ -8,7 +8,7 @@ use Illuminate\Support\Facades\Http; use Tests\TestCase; -class GeocoderTest extends TestCase +final class GeocoderTest extends TestCase { #[Test] function geocoding_an_address(): void diff --git a/tests/Unit/ExampleTest.php b/tests/Unit/ExampleTest.php index a6bf216d..9b78c7b4 100644 --- a/tests/Unit/ExampleTest.php +++ b/tests/Unit/ExampleTest.php @@ -4,7 +4,7 @@ use PHPUnit\Framework\TestCase; -class ExampleTest extends TestCase +final class ExampleTest extends TestCase { /** * A basic test example.