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

119 lines
4.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.');
$forums = \App\Models\Forum::factory()->times(3)->create();
$groups = \App\Models\Group::factory()->times(3)->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->get(route('staff.forums.create'));
$response->assertOk();
$response->assertViewIs('Staff.forum.create');
$response->assertViewHas('categories');
$response->assertViewHas('groups', $groups);
// TODO: perform additional assertions
});
test('destroy 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.');
$forum = \App\Models\Forum::factory()->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->delete(route('staff.forums.destroy', [$forum]));
$response->assertOk();
$this->assertModelMissing($forum);
// 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.');
$forum = \App\Models\Forum::factory()->create();
$forums = \App\Models\Forum::factory()->times(3)->create();
$groups = \App\Models\Group::factory()->times(3)->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->get(route('staff.forums.edit', [$forum]));
$response->assertOk();
$response->assertViewIs('Staff.forum.edit');
$response->assertViewHas('categories');
$response->assertViewHas('groups', $groups);
$response->assertViewHas('forum', $forum);
// 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.');
$forums = \App\Models\Forum::factory()->times(3)->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->get(route('staff.forums.index'));
$response->assertOk();
$response->assertViewIs('Staff.forum.index');
$response->assertViewHas('categories');
// TODO: perform additional assertions
});
test('store validates with a form request', function (): void {
$this->assertActionUsesFormRequest(
\App\Http\Controllers\Staff\ForumController::class,
'store',
\App\Http\Requests\Staff\StoreForumRequest::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.');
$permission = \App\Models\Permission::factory()->create();
$groups = \App\Models\Group::factory()->times(3)->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->post(route('staff.forums.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\ForumController::class,
'update',
\App\Http\Requests\Staff\UpdateForumRequest::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.');
$forum = \App\Models\Forum::factory()->create();
$groups = \App\Models\Group::factory()->times(3)->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->patch(route('staff.forums.update', [$forum]), [
// TODO: send request data
]);
$response->assertOk();
// TODO: perform additional assertions
});
// test cases...