mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-02-06 11:38:52 -06:00
47 lines
1.1 KiB
PHP
47 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature\Http\Controllers\Staff;
|
|
|
|
use App\Models\Group;
|
|
use App\Models\User;
|
|
use Database\Seeders\GroupsTableSeeder;
|
|
use Tests\TestCase;
|
|
|
|
/**
|
|
* @see \App\Http\Controllers\Staff\CheaterController
|
|
*/
|
|
class CheaterControllerTest extends TestCase
|
|
{
|
|
protected function setUp(): void
|
|
{
|
|
parent::setUp();
|
|
}
|
|
|
|
protected function createStaffUser(): \Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Eloquent\Model
|
|
{
|
|
return User::factory()->create([
|
|
'group_id' => fn () => Group::factory()->create([
|
|
'is_owner' => true,
|
|
'is_admin' => true,
|
|
'is_modo' => true,
|
|
])->id,
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* @test
|
|
*/
|
|
public function index_returns_an_ok_response(): void
|
|
{
|
|
$this->seed(GroupsTableSeeder::class);
|
|
|
|
$user = $this->createStaffUser();
|
|
|
|
$response = $this->actingAs($user)->get(route('staff.cheaters.index'));
|
|
|
|
$response->assertOk();
|
|
$response->assertViewIs('Staff.cheater.index');
|
|
$response->assertViewHas('cheaters');
|
|
}
|
|
}
|