Files
UNIT3D-Community-Edition/tests/Feature/Http/Controllers/Staff/GroupControllerTest.shift.php
2023-07-11 18:27:15 +00:00

95 lines
3.1 KiB
PHP

<?php
uses(RefreshDatabase::class);
test('create returns an ok response', function (): void {
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->get(route('staff.groups.create'));
$response->assertOk();
$response->assertViewIs('Staff.group.create');
// TODO: perform additional assertions
});
test('edit returns an ok response', function (): void {
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
$group = \App\Models\Group::factory()->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->get(route('staff.groups.edit', [$group]));
$response->assertOk();
$response->assertViewIs('Staff.group.edit');
$response->assertViewHas('group', $group);
// TODO: perform additional assertions
});
test('index returns an ok response', function (): void {
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
$groups = \App\Models\Group::factory()->times(3)->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->get(route('staff.groups.index'));
$response->assertOk();
$response->assertViewIs('Staff.group.index');
$response->assertViewHas('groups', $groups);
// TODO: perform additional assertions
});
test('store validates with a form request', function (): void {
$this->assertActionUsesFormRequest(
\App\Http\Controllers\Staff\GroupController::class,
'store',
\App\Http\Requests\Staff\StoreGroupRequest::class
);
});
test('store returns an ok response', function (): void {
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->post(route('staff.groups.store'), [
// TODO: send request data
]);
$response->assertOk();
// TODO: perform additional assertions
});
test('update validates with a form request', function (): void {
$this->assertActionUsesFormRequest(
\App\Http\Controllers\Staff\GroupController::class,
'update',
\App\Http\Requests\Staff\UpdateGroupRequest::class
);
});
test('update returns an ok response', function (): void {
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
$group = \App\Models\Group::factory()->create();
$users = \App\Models\User::factory()->times(3)->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->patch(route('staff.groups.update', [$group]), [
// TODO: send request data
]);
$response->assertOk();
// TODO: perform additional assertions
});
// test cases...