This repository has been archived by the owner on Feb 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d7edd2
commit 5ae0b73
Showing
10 changed files
with
129 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" => '[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(); | ||
|
||
|
@@ -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(); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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(); | ||
|
@@ -46,7 +46,7 @@ public function testUserCanSendContactForm(): void | |
|
||
public function testContactFormDataIsRequired(): void | ||
{ | ||
$this->post('/contact') | ||
$this->post("/contact") | ||
->assertInvalid([ | ||
"name", | ||
"email", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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' => '[email protected]', | ||
"email" => "[email protected]", | ||
])->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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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); | ||
|
Oops, something went wrong.