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

123 lines
4.0 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.polls.create'));
$response->assertOk();
$response->assertViewIs('Staff.poll.create');
// 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.');
$poll = \App\Models\Poll::factory()->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->delete(route('staff.polls.destroy', [$poll]));
$response->assertOk();
$this->assertModelMissing($poll);
// 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.');
$poll = \App\Models\Poll::factory()->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->get(route('staff.polls.edit', [$poll]));
$response->assertOk();
$response->assertViewIs('Staff.poll.edit');
$response->assertViewHas('poll', $poll);
// 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.');
$polls = \App\Models\Poll::factory()->times(3)->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->get(route('staff.polls.index'));
$response->assertOk();
$response->assertViewIs('Staff.poll.index');
$response->assertViewHas('polls', $polls);
// TODO: perform additional assertions
});
test('show 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.');
$poll = \App\Models\Poll::factory()->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->get(route('staff.polls.show', [$poll]));
$response->assertOk();
$response->assertViewIs('Staff.poll.show');
$response->assertViewHas('poll', $poll);
// TODO: perform additional assertions
});
test('store validates with a form request', function (): void {
$this->assertActionUsesFormRequest(
\App\Http\Controllers\Staff\PollController::class,
'store',
\App\Http\Requests\StorePoll::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.polls.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\PollController::class,
'update',
\App\Http\Requests\UpdatePollRequest::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.');
$poll = \App\Models\Poll::factory()->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->patch(route('staff.polls.update', [$poll]), [
// TODO: send request data
]);
$response->assertOk();
// TODO: perform additional assertions
});
// test cases...