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
a851f81
commit 202c4d7
Showing
26 changed files
with
1,010 additions
and
1,027 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -6,19 +6,28 @@ | |
|
||
use Blumilk\Meetup\Core\Models\User; | ||
use Blumilk\Meetup\Core\Notifications\InvitationEmailNotification; | ||
use Illuminate\Foundation\Testing\DatabaseMigrations; | ||
use Illuminate\Foundation\Testing\RefreshDatabase; | ||
use Illuminate\Support\Facades\Notification; | ||
use Spatie\Permission\Models\Role; | ||
use Tests\TestCase; | ||
|
||
class InviteAdminTest extends TestCase | ||
{ | ||
use DatabaseMigrations; | ||
use RefreshDatabase; | ||
|
||
public function testAdminCanSeeSendInvitationPage(): void | ||
public User $admin; | ||
|
||
protected function setUp(): void | ||
{ | ||
$admin = User::factory()->admin()->create(); | ||
parent::setUp(); | ||
|
||
Role::create(["name" => "admin"]); | ||
$this->admin = User::factory()->create()->assignRole("admin"); | ||
} | ||
|
||
$this->actingAs($admin) | ||
public function testAdminCanSeeSendInvitationPage(): void | ||
{ | ||
$this->actingAs($this->admin) | ||
->get("/invitation") | ||
->assertOk(); | ||
} | ||
|
@@ -27,13 +36,11 @@ public function testAdminCanSendInvitation(): void | |
{ | ||
Notification::fake(); | ||
|
||
$admin = User::factory()->admin()->create(); | ||
|
||
$invitedUser = User::factory([ | ||
"email" => "[email protected]", | ||
])->make(); | ||
|
||
$this->actingAs($admin) | ||
$this->actingAs($this->admin) | ||
->post("/invitation", [ | ||
"email" => $invitedUser->email, | ||
]) | ||
|
@@ -48,6 +55,6 @@ public function testUserCannotSendInvitation(): void | |
|
||
$this->actingAs($user) | ||
->get("/invitation") | ||
->assertForbidden(); | ||
->assertLocation("/"); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.