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

Commit

Permalink
#89 - refactor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Anna-Sokolowska committed May 11, 2022
1 parent a851f81 commit 202c4d7
Show file tree
Hide file tree
Showing 26 changed files with 1,010 additions and 1,027 deletions.
71 changes: 0 additions & 71 deletions tests/Feature/AuthenticationTest.php

This file was deleted.

4 changes: 2 additions & 2 deletions tests/Feature/ContactTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

use Blumilk\Meetup\Core\Models\Contact;
use Blumilk\Meetup\Core\Notifications\ContactEmailNotification;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Notification;
use Tests\TestCase;

class ContactTest extends TestCase
{
use DatabaseMigrations;
use RefreshDatabase;

public function testUserCanSeeContactPage(): void
{
Expand Down
25 changes: 16 additions & 9 deletions tests/Feature/InviteAdminTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -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,
])
Expand All @@ -48,6 +55,6 @@ public function testUserCannotSendInvitation(): void

$this->actingAs($user)
->get("/invitation")
->assertForbidden();
->assertLocation("/");
}
}
190 changes: 0 additions & 190 deletions tests/Feature/MeetupTest.php

This file was deleted.

Loading

0 comments on commit 202c4d7

Please sign in to comment.