Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

Commit

Permalink
#89 - cs-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Anna-Sokolowska committed May 10, 2022
1 parent 7d7edd2 commit 5ae0b73
Show file tree
Hide file tree
Showing 10 changed files with 129 additions and 129 deletions.
42 changes: 21 additions & 21 deletions tests/Feature/AuthenticationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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" => '[email protected]',
"password" => 'password',
"password_confirmation" => 'password',
$this->post("/auth/register", [
"name" => "User",
"email" => "[email protected]",
"password" => "password",
"password_confirmation" => "password",
])
->assertSessionHasNoErrors();

$this->assertDatabaseHas("users", [
"name" => 'User',
"email" => '[email protected]',
"name" => "User",
"email" => "[email protected]",
]);
}

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" => '[email protected]',
"password" => 'password',
"email" => "[email protected]",
"password" => "password",
]);

$this->post('/auth/login', [
"email" => '[email protected]',
"password" => 'password',
$this->post("/auth/login", [
"email" => "[email protected]",
"password" => "password",
])
->assertSessionHasNoErrors();

Expand All @@ -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();
}
Expand Down
24 changes: 12 additions & 12 deletions tests/Feature/ContactTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,27 @@ class ContactTest extends TestCase

public function testUserCanSeeContactPage(): void
{
$this->get('/contact')
$this->get("/contact")
->assertOk();
}

public function testUserCanSendContactForm(): void
{
Notification::fake();

$this->post('/contact', [
"name" => 'John',
"email" => '[email protected]',
"subject" => 'Test subject',
"message" => 'Test message',
$this->post("/contact", [
"name" => "John",
"email" => "[email protected]",
"subject" => "Test subject",
"message" => "Test message",
])
->assertSessionHasNoErrors();

$this->assertDatabaseHas('contacts', [
"name" => 'John',
"email" => '[email protected]',
"subject" => 'Test subject',
"message" => 'Test message',
$this->assertDatabaseHas("contacts", [
"name" => "John",
"email" => "[email protected]",
"subject" => "Test subject",
"message" => "Test message",
]);

$contact = Contact::query()->first();
Expand All @@ -46,7 +46,7 @@ public function testUserCanSendContactForm(): void

public function testContactFormDataIsRequired(): void
{
$this->post('/contact')
$this->post("/contact")
->assertInvalid([
"name",
"email",
Expand Down
10 changes: 5 additions & 5 deletions tests/Feature/InviteAdminTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function testAdminCanSeeSendInvitationPage(): void
$admin = User::factory()->admin()->create();

$this->actingAs($admin)
->get('/invitation')
->get("/invitation")
->assertOk();
}

Expand All @@ -30,12 +30,12 @@ public function testAdminCanSendInvitation(): void
$admin = User::factory()->admin()->create();

$invitedUser = User::factory([
'email' => '[email protected]',
"email" => "[email protected]",
])->make();

$this->actingAs($admin)
->post('/invitation', [
'email' => $invitedUser->email,
->post("/invitation", [
"email" => $invitedUser->email,
])
->assertSessionHasNoErrors();

Expand All @@ -47,7 +47,7 @@ public function testUserCannotSendInvitation(): void
$user = User::factory()->create();

$this->actingAs($user)
->get('/invitation')
->get("/invitation")
->assertForbidden();
}
}
24 changes: 12 additions & 12 deletions tests/Feature/MeetupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand All @@ -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);
}
}
Expand All @@ -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);
}
Expand All @@ -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",
])
Expand All @@ -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",
]);
Expand Down Expand Up @@ -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",
])
Expand All @@ -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",
]);
Expand Down
22 changes: 11 additions & 11 deletions tests/Feature/NewsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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);
Expand All @@ -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",
]);
}

Expand Down Expand Up @@ -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));
Expand Down
8 changes: 4 additions & 4 deletions tests/Feature/NewsletterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ class NewsletterTest extends TestCase

public function testGuestCanSeeNewsletterPage(): void
{
$this->get('/newsletter')
$this->get("/newsletter")
->assertOk();
}

public function testUserCanSubscribeNewsletter(): void
{
Notification::fake();

$this->post('/newsletter/subscribe', [
'email' => '[email protected]'
$this->post("/newsletter/subscribe", [
"email" => "[email protected]",
])
->assertSessionHasNoErrors()
->assertOk();

$subscriber = NewsletterSubscriber::query()
->where('email', '[email protected]')
->where("email", "[email protected]")
->first();

Notification::assertSentTo($subscriber, NewsletterNotification::class);
Expand Down
Loading

0 comments on commit 5ae0b73

Please sign in to comment.