From 5ae0b73af3dcda1f183a71f36cc86edb69da3337 Mon Sep 17 00:00:00 2001 From: Anna-Sokolowska Date: Tue, 10 May 2022 19:53:53 +0200 Subject: [PATCH] #89 - cs-fix --- tests/Feature/AuthenticationTest.php | 42 ++++++++++---------- tests/Feature/ContactTest.php | 24 ++++++------ tests/Feature/InviteAdminTest.php | 10 ++--- tests/Feature/MeetupTest.php | 24 ++++++------ tests/Feature/NewsTest.php | 22 +++++------ tests/Feature/NewsletterTest.php | 8 ++-- tests/Feature/OrganizationProfileTest.php | 24 ++++++------ tests/Feature/OrganizationTest.php | 48 +++++++++++------------ tests/Feature/SpeakerTest.php | 34 ++++++++-------- tests/Feature/UserProfileTest.php | 22 +++++------ 10 files changed, 129 insertions(+), 129 deletions(-) diff --git a/tests/Feature/AuthenticationTest.php b/tests/Feature/AuthenticationTest.php index f51baeb9..68559726 100644 --- a/tests/Feature/AuthenticationTest.php +++ b/tests/Feature/AuthenticationTest.php @@ -4,8 +4,8 @@ namespace Tests\Feature; -use Illuminate\Foundation\Testing\DatabaseMigrations; use Blumilk\Meetup\Core\Models\User; +use Illuminate\Foundation\Testing\DatabaseMigrations; use Tests\TestCase; class AuthenticationTest extends TestCase @@ -14,44 +14,44 @@ class AuthenticationTest extends TestCase public function testUserCanRegister(): void { - $this->get('/auth/register') + $this->get("/auth/register") ->assertOk(); - $this->post('/auth/register', [ - "name" => 'User', - "email" => 'user@example.com', - "password" => 'password', - "password_confirmation" => 'password', + $this->post("/auth/register", [ + "name" => "User", + "email" => "user@example.com", + "password" => "password", + "password_confirmation" => "password", ]) ->assertSessionHasNoErrors(); $this->assertDatabaseHas("users", [ - "name" => 'User', - "email" => 'user@example.com', + "name" => "User", + "email" => "user@example.com", ]); } public function testRegisterDataIsRequired(): void { - $this->post('/auth/register') + $this->post("/auth/register") ->assertInvalid([ - 'name', - 'email', - 'password', - 'password_confirmation', + "name", + "email", + "password", + "password_confirmation", ]); } public function testUserCanLogIn(): void { User::factory()->create([ - "email" => 'user@example.com', - "password" => 'password', + "email" => "user@example.com", + "password" => "password", ]); - $this->post('/auth/login', [ - "email" => 'user@example.com', - "password" => 'password', + $this->post("/auth/login", [ + "email" => "user@example.com", + "password" => "password", ]) ->assertSessionHasNoErrors(); @@ -63,8 +63,8 @@ public function testUserCanLogOut(): void $user = User::factory()->create(); $this->actingAs($user) - ->get('/auth/logout') - ->assertRedirect('/'); + ->get("/auth/logout") + ->assertRedirect("/"); $this->assertGuest(); } diff --git a/tests/Feature/ContactTest.php b/tests/Feature/ContactTest.php index 4735b293..989ca696 100644 --- a/tests/Feature/ContactTest.php +++ b/tests/Feature/ContactTest.php @@ -16,7 +16,7 @@ class ContactTest extends TestCase public function testUserCanSeeContactPage(): void { - $this->get('/contact') + $this->get("/contact") ->assertOk(); } @@ -24,19 +24,19 @@ public function testUserCanSendContactForm(): void { Notification::fake(); - $this->post('/contact', [ - "name" => 'John', - "email" => 'john.doe@example.com', - "subject" => 'Test subject', - "message" => 'Test message', + $this->post("/contact", [ + "name" => "John", + "email" => "john.doe@example.com", + "subject" => "Test subject", + "message" => "Test message", ]) ->assertSessionHasNoErrors(); - $this->assertDatabaseHas('contacts', [ - "name" => 'John', - "email" => 'john.doe@example.com', - "subject" => 'Test subject', - "message" => 'Test message', + $this->assertDatabaseHas("contacts", [ + "name" => "John", + "email" => "john.doe@example.com", + "subject" => "Test subject", + "message" => "Test message", ]); $contact = Contact::query()->first(); @@ -46,7 +46,7 @@ public function testUserCanSendContactForm(): void public function testContactFormDataIsRequired(): void { - $this->post('/contact') + $this->post("/contact") ->assertInvalid([ "name", "email", diff --git a/tests/Feature/InviteAdminTest.php b/tests/Feature/InviteAdminTest.php index 566dfaca..90f4c5e1 100644 --- a/tests/Feature/InviteAdminTest.php +++ b/tests/Feature/InviteAdminTest.php @@ -19,7 +19,7 @@ public function testAdminCanSeeSendInvitationPage(): void $admin = User::factory()->admin()->create(); $this->actingAs($admin) - ->get('/invitation') + ->get("/invitation") ->assertOk(); } @@ -30,12 +30,12 @@ public function testAdminCanSendInvitation(): void $admin = User::factory()->admin()->create(); $invitedUser = User::factory([ - 'email' => 'invited@example.com', + "email" => "invited@example.com", ])->make(); $this->actingAs($admin) - ->post('/invitation', [ - 'email' => $invitedUser->email, + ->post("/invitation", [ + "email" => $invitedUser->email, ]) ->assertSessionHasNoErrors(); @@ -47,7 +47,7 @@ public function testUserCannotSendInvitation(): void $user = User::factory()->create(); $this->actingAs($user) - ->get('/invitation') + ->get("/invitation") ->assertForbidden(); } } diff --git a/tests/Feature/MeetupTest.php b/tests/Feature/MeetupTest.php index 4e69b204..8ef44f49 100644 --- a/tests/Feature/MeetupTest.php +++ b/tests/Feature/MeetupTest.php @@ -22,15 +22,15 @@ public function testUserCanSeeMeetupsList(): void ->for($admin) ->create(); - $this->assertDatabaseCount('meetups', 15); + $this->assertDatabaseCount("meetups", 15); - $response = $this->get(route('meetups')) + $response = $this->get(route("meetups")) ->assertOk(); foreach ($meetups as $meetup) { $response->assertSee($meetup->logo_path) ->assertSee($meetup->title) - ->assertSee($meetup->date->format('Y-m-d h:i')) + ->assertSee($meetup->date->format("Y-m-d h:i")) ->assertSee($meetup->place); } } @@ -48,15 +48,15 @@ public function testMeetupsListIsPaginated(): void ->skip(20) ->take(10); - $this->assertDatabaseCount('meetups', 30); + $this->assertDatabaseCount("meetups", 30); - $response = $this->get(route('meetups') . '?page=2') + $response = $this->get(route("meetups") . "?page=2") ->assertOk(); foreach ($meetups as $meetup) { $response->assertSee($meetup->logo_path) ->assertSee($meetup->title) - ->assertSee($meetup->date->format('Y-m-d h:i')) + ->assertSee($meetup->date->format("Y-m-d h:i")) ->assertSee($meetup->place); } } @@ -66,11 +66,11 @@ public function testUserCanSeeMeetup(): void $admin = User::factory()->admin()->create(); $meetup = Meetup::factory()->for($admin)->create(); - $this->get(route('meetups.show', $meetup)) + $this->get(route("meetups.show", $meetup)) ->assertOk() ->assertSee($meetup->logo_path) ->assertSee($meetup->title) - ->assertSee($meetup->date->format('Y-m-d h:i')) + ->assertSee($meetup->date->format("Y-m-d h:i")) ->assertSee($meetup->place) ->assertSee($meetup->language); } @@ -87,7 +87,7 @@ public function testAdminCanCreateMeetup(): void ->post(route("meetups.store"), [ "title" => "Test Meetup", "description" => "Description", - "date" => Carbon::parse('2022-12-12 12:00:00'), + "date" => Carbon::parse("2022-12-12 12:00:00"), "place" => "Place", "language" => "en", ]) @@ -98,7 +98,7 @@ public function testAdminCanCreateMeetup(): void "user_id" => $admin->id, "title" => "Test Meetup", "description" => "Description", - "date" => Carbon::parse('2022-12-12 12:00:00'), + "date" => Carbon::parse("2022-12-12 12:00:00"), "place" => "Place", "language" => "en", ]); @@ -130,7 +130,7 @@ public function testAdminCanEditMeetup(): void ->put(route("meetups.update", $meetup), [ "title" => "Test Meetup", "description" => "Description", - "date" => Carbon::parse('2022-12-12 12:00:00'), + "date" => Carbon::parse("2022-12-12 12:00:00"), "place" => "Place", "language" => "en", ]) @@ -141,7 +141,7 @@ public function testAdminCanEditMeetup(): void "user_id" => $admin->id, "title" => "Test Meetup", "description" => "Description", - "date" => Carbon::parse('2022-12-12 12:00:00'), + "date" => Carbon::parse("2022-12-12 12:00:00"), "place" => "Place", "language" => "en", ]); diff --git a/tests/Feature/NewsTest.php b/tests/Feature/NewsTest.php index 90255fbc..77516ef3 100644 --- a/tests/Feature/NewsTest.php +++ b/tests/Feature/NewsTest.php @@ -22,9 +22,9 @@ public function testUserCanSeeNewsList(): void ->for($admin) ->create(); - $this->assertDatabaseCount('news', 15); + $this->assertDatabaseCount("news", 15); - $response = $this->get(route('news')) + $response = $this->get(route("news")) ->assertOk(); foreach ($news as $singleNews) { @@ -46,9 +46,9 @@ public function testNewsListIsPaginated(): void ->skip(20) ->take(10); - $this->assertDatabaseCount('meetups', 30); + $this->assertDatabaseCount("meetups", 30); - $response = $this->get(route('news') . '?page=2') + $response = $this->get(route("news") . "?page=2") ->assertOk(); foreach ($news as $singleNews) { @@ -61,7 +61,7 @@ public function testUserCanSeeNews(): void $admin = User::factory()->admin()->create(); $news = News::factory()->for($admin)->create(); - $this->get(route('news.show', $news)) + $this->get(route("news.show", $news)) ->assertOk() ->assertSee($news->title) ->assertSee($news->text); @@ -77,16 +77,16 @@ public function testAdminCanCreateNews(): void $this->actingAs($admin) ->post(route("news.store"), [ - "title" => 'Test news', - "text" => 'Test news content', + "title" => "Test news", + "text" => "Test news content", ]) ->assertSessionHasNoErrors() ->assertRedirect(route("news.create")); $this->assertDatabaseHas("news", [ "user_id" => $admin->id, - "title" => 'Test news', - "text" => 'Test news content', + "title" => "Test news", + "text" => "Test news content", ]); } @@ -115,8 +115,8 @@ public function testAdminCanEditNews(): void $this->actingAs($admin) ->put(route("news.update", $news), [ - 'title' => 'Test News', - 'text' => 'Test News Content', + "title" => "Test News", + "text" => "Test News Content", ]) ->assertSessionHasNoErrors() ->assertRedirect(route("news.edit", $news)); diff --git a/tests/Feature/NewsletterTest.php b/tests/Feature/NewsletterTest.php index 064bc2c6..6a12cb72 100644 --- a/tests/Feature/NewsletterTest.php +++ b/tests/Feature/NewsletterTest.php @@ -16,7 +16,7 @@ class NewsletterTest extends TestCase public function testGuestCanSeeNewsletterPage(): void { - $this->get('/newsletter') + $this->get("/newsletter") ->assertOk(); } @@ -24,14 +24,14 @@ public function testUserCanSubscribeNewsletter(): void { Notification::fake(); - $this->post('/newsletter/subscribe', [ - 'email' => 'subscriber@example.com' + $this->post("/newsletter/subscribe", [ + "email" => "subscriber@example.com", ]) ->assertSessionHasNoErrors() ->assertOk(); $subscriber = NewsletterSubscriber::query() - ->where('email', 'subscriber@example.com') + ->where("email", "subscriber@example.com") ->first(); Notification::assertSentTo($subscriber, NewsletterNotification::class); diff --git a/tests/Feature/OrganizationProfileTest.php b/tests/Feature/OrganizationProfileTest.php index bfb4e5bb..d3eb6c84 100644 --- a/tests/Feature/OrganizationProfileTest.php +++ b/tests/Feature/OrganizationProfileTest.php @@ -21,21 +21,21 @@ public function testAdminCanCreateOrganizationProfile(): void $organization = Organization::factory()->create(); $this->actingAs($admin) - ->get(route('organizations.profiles.create', $organization)) + ->get(route("organizations.profiles.create", $organization)) ->assertOk(); $this->actingAs($admin) - ->post(route('organizations.profiles.store', $organization), [ + ->post(route("organizations.profiles.store", $organization), [ "label" => "Facebook", - "link" => "https://facebook.com" + "link" => "https://facebook.com", ]) ->assertSessionHasNoErrors() ->assertRedirect(); - $this->assertDatabaseHas('organization_profiles', [ + $this->assertDatabaseHas("organization_profiles", [ "organization_id" => $organization->id, "label" => "Facebook", - "link" => "https://facebook.com" + "link" => "https://facebook.com", ]); } @@ -46,11 +46,11 @@ public function testUserCannotCreateOrganizationProfile(): void $organization = Organization::factory()->create(); $this->actingAs($user) - ->get(route('organizations.profiles.create', $organization)) + ->get(route("organizations.profiles.create", $organization)) ->assertForbidden(); $this->actingAs($user) - ->post(route('organizations.profiles.store', $organization)) + ->post(route("organizations.profiles.store", $organization)) ->assertForbidden(); } @@ -76,7 +76,7 @@ public function testAdminCanEditOrganizationProfile(): void ->assertSessionHasNoErrors() ->assertRedirect(); - $this->assertDatabaseHas('organization_profiles', [ + $this->assertDatabaseHas("organization_profiles", [ "organization_id" => $organization->id, "label" => "Twitter", "link" => "https://twitter.com", @@ -94,11 +94,11 @@ public function testUserCannotEditOrganizationProfile(): void ->create(); $this->actingAs($user) - ->get(route('organizations.profiles.edit', [$organization, $organizationProfile])) + ->get(route("organizations.profiles.edit", [$organization, $organizationProfile])) ->assertForbidden(); $this->actingAs($user) - ->put(route('organizations.profiles.update', [$organization, $organizationProfile])) + ->put(route("organizations.profiles.update", [$organization, $organizationProfile])) ->assertForbidden(); } @@ -112,7 +112,7 @@ public function testAdminCanDeleteOrganizationProfile(): void ->for($organization) ->create(); - $this->assertDatabaseCount('organization_profiles', 1); + $this->assertDatabaseCount("organization_profiles", 1); $this->actingAs($admin) ->delete(route("organizations.profiles.destroy", [$organization, $organizationProfile])) @@ -132,7 +132,7 @@ public function testUserCannotDeleteOrganizationProfile(): void ->create(); $this->actingAs($user) - ->delete(route('organizations.profiles.destroy', [$organization, $organizationProfile])) + ->delete(route("organizations.profiles.destroy", [$organization, $organizationProfile])) ->assertForbidden(); } diff --git a/tests/Feature/OrganizationTest.php b/tests/Feature/OrganizationTest.php index 0d506fb5..66c4bf47 100644 --- a/tests/Feature/OrganizationTest.php +++ b/tests/Feature/OrganizationTest.php @@ -19,9 +19,9 @@ public function testUserCanSeeOrganizationsList(): void { $organizations = Organization::factory()->count(10)->create(); - $this->assertDatabaseCount('meetups', 10); + $this->assertDatabaseCount("meetups", 10); - $response = $this->get(route('organizations')) + $response = $this->get(route("organizations")) ->assertOk(); foreach ($organizations as $organization) { @@ -35,14 +35,14 @@ public function testOrganizationsListIsPaginated(): void { Organization::factory()->count(30)->create(); - $this->assertDatabaseCount('meetups', 30); + $this->assertDatabaseCount("meetups", 30); $organizations = Meetup::query() ->latest() ->skip(20) ->take(10); - $response = $this->get(route('organizations') . '?page=2') + $response = $this->get(route("organizations") . "?page=2") ->assertOk(); foreach ($organizations as $organization) { @@ -56,7 +56,7 @@ public function testUserCanSeeOrganization(): void { $organization = Organization::factory()->create(); - $this->get(route('organizations.show', $organization)) + $this->get(route("organizations.show", $organization)) ->assertOk() ->assertSee($organization->name) ->assertSee($organization->logo_path) @@ -72,27 +72,27 @@ public function testAdminCanCreateOrganization(): void $admin = User::factory()->admin()->create(); $this->actingAs($admin) - ->get(route('organizations.create')) + ->get(route("organizations.create")) ->assertOk(); $this->actingAs($admin) - ->post(route('organizations.store'), [ - "name" => 'Test organization', - "description" => 'Test organization description', + ->post(route("organizations.store"), [ + "name" => "Test organization", + "description" => "Test organization description", "location" => "Panama", "organization_type" => "test", - "foundation_date" => Carbon::parse('2022-01-01 10:00:00'), + "foundation_date" => Carbon::parse("2022-01-01 10:00:00"), "number_of_employees" => 1000, "website_url" => "https://testorganization.info", ]) - ->assertRedirect(route('organizations.create')); + ->assertRedirect(route("organizations.create")); - $this->assertDatabaseHas('organizations', [ - "name" => 'Test organization', - "description" => 'Test organization description', + $this->assertDatabaseHas("organizations", [ + "name" => "Test organization", + "description" => "Test organization description", "location" => "Panama", "organization_type" => "test", - "foundation_date" => Carbon::parse('2022-01-01 10:00:00'), + "foundation_date" => Carbon::parse("2022-01-01 10:00:00"), "number_of_employees" => 1000, "website_url" => "https://testorganization.info", ]); @@ -103,11 +103,11 @@ public function testUserCannotCreateOrganization(): void $user = User::factory()->create(); $this->actingAs($user) - ->get(route('organizations.create')) + ->get(route("organizations.create")) ->assertForbidden(); $this->actingAs($user) - ->post(route('organizations.store')) + ->post(route("organizations.store")) ->assertForbidden(); } @@ -117,28 +117,28 @@ public function testAdminCanEditOrganization(): void $organization = Organization::factory()->create(); $this->actingAs($admin) - ->get(route('organizations.edit', $organization)) + ->get(route("organizations.edit", $organization)) ->assertOk(); $this->actingAs($admin) - ->put(route('organizations.update', $organization), [ + ->put(route("organizations.update", $organization), [ "name" => "Test organization", "description" => "Test description", "location" => "Panama", "organization_type" => "test", - "foundation_date" => Carbon::parse('2022-01-01 10:00:00'), + "foundation_date" => Carbon::parse("2022-01-01 10:00:00"), "number_of_employees" => 1000, "website_url" => "https://testorganization.info", ]) ->assertSessionHasNoErrors() - ->assertRedirect(route('organizations.edit', $organization)); + ->assertRedirect(route("organizations.edit", $organization)); - $this->assertDatabaseHas('organizations', [ + $this->assertDatabaseHas("organizations", [ "name" => "Test organization", "description" => "Test description", "location" => "Panama", "organization_type" => "test", - "foundation_date" => Carbon::parse('2022-01-01 10:00:00'), + "foundation_date" => Carbon::parse("2022-01-01 10:00:00"), "number_of_employees" => 1000, "website_url" => "https://testorganization.info", ]); @@ -150,7 +150,7 @@ public function testUserCannotEditOrganization(): void $user = User::factory()->create(); $this->actingAs($user) - ->get(route('organizations.edit', $organization)) + ->get(route("organizations.edit", $organization)) ->assertForbidden(); } diff --git a/tests/Feature/SpeakerTest.php b/tests/Feature/SpeakerTest.php index dd9e41da..2aec4ae3 100644 --- a/tests/Feature/SpeakerTest.php +++ b/tests/Feature/SpeakerTest.php @@ -40,7 +40,7 @@ public function testSpeakersListIsPaginated(): void ->take(10); $response = $this->actingAs($user) - ->get(route("speakers") . '?page=2') + ->get(route("speakers") . "?page=2") ->assertOk(); foreach ($speakers as $speaker) { @@ -75,19 +75,19 @@ public function testAdminCanCreateSpeaker(): void $this->actingAs($admin) ->post(route("speakers.store"), [ - "name" => 'speaker', - "description" => 'speaker description', - "linkedin_url" => 'https://linkedin.com/example', - "github_url" => 'https://github.com/example', + "name" => "speaker", + "description" => "speaker description", + "linkedin_url" => "https://linkedin.com/example", + "github_url" => "https://github.com/example", ]) ->assertSessionHasNoErrors() ->assertRedirect(); $this->assertDatabaseHas("speakers", [ - "name" => 'speaker', - "description" => 'speaker description', - "linkedin_url" => 'https://linkedin.com/example', - "github_url" => 'https://github.com/example', + "name" => "speaker", + "description" => "speaker description", + "linkedin_url" => "https://linkedin.com/example", + "github_url" => "https://github.com/example", ]); } @@ -116,19 +116,19 @@ public function testAdminCanEditSpeaker(): void $this->actingAs($admin) ->put(route("speakers.update", $speaker), [ - "name" => 'speaker', - "description" => 'speaker description', - "linkedin_url" => 'https://linkedin.com/', - "github_url" => 'https://github.com/', + "name" => "speaker", + "description" => "speaker description", + "linkedin_url" => "https://linkedin.com/", + "github_url" => "https://github.com/", ]) ->assertSessionHasNoErrors() ->assertRedirect(); $this->assertDatabaseHas("speakers", [ - "name" => 'speaker', - "description" => 'speaker description', - "linkedin_url" => 'https://linkedin.com/', - "github_url" => 'https://github.com/', + "name" => "speaker", + "description" => "speaker description", + "linkedin_url" => "https://linkedin.com/", + "github_url" => "https://github.com/", ]); } diff --git a/tests/Feature/UserProfileTest.php b/tests/Feature/UserProfileTest.php index 79f85e8c..885c85ee 100644 --- a/tests/Feature/UserProfileTest.php +++ b/tests/Feature/UserProfileTest.php @@ -17,20 +17,20 @@ public function testUserCanEditProfile(): void $user = User::factory()->create(); $this->actingAs($user) - ->get(route('users.edit', $user)) + ->get(route("users.edit", $user)) ->assertOk(); $this->actingAs($user) - ->put(route('users.update', $user), [ - 'name' => 'John Doe', - 'email' => 'john.doe@example.com', + ->put(route("users.update", $user), [ + "name" => "John Doe", + "email" => "john.doe@example.com", ]) ->assertSessionHasNoErrors() ->assertRedirect(); - $this->assertDatabaseHas('users', [ - 'name' => 'John Doe', - 'email' => 'john.doe@example.com', + $this->assertDatabaseHas("users", [ + "name" => "John Doe", + "email" => "john.doe@example.com", ]); } @@ -41,11 +41,11 @@ public function testUserCannotEditAnotherUserProfile(): void $unauthorizedUser = User::factory()->create(); $this->actingAs($user) - ->get(route('users.edit', $unauthorizedUser)) + ->get(route("users.edit", $unauthorizedUser)) ->assertForbidden(); $this->actingAs($user) - ->put(route('users.update', $user)) + ->put(route("users.update", $user)) ->assertForbidden(); } @@ -54,7 +54,7 @@ public function testUserProfileDataIsRequired(): void $user = User::factory()->create(); $this->actingAs($user) - ->put(route('users.update', $user)) + ->put(route("users.update", $user)) ->assertInvalid([ "name", "email", @@ -66,7 +66,7 @@ public function testProfileDataIsRequired(): void $user = User::factory()->create(); $this->actingAs($user) - ->put(route('users.update', $user)) + ->put(route("users.update", $user)) ->assertInvalid([ "name", "email",