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

60 lines
2.0 KiB
PHP

<?php
uses(RefreshDatabase::class);
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.');
$reports = \App\Models\Report::factory()->times(3)->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->get(route('staff.reports.index'));
$response->assertOk();
$response->assertViewIs('Staff.report.index');
$response->assertViewHas('reports', $reports);
// 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.');
$report = \App\Models\Report::factory()->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->get(route('staff.reports.show', [$report]));
$response->assertOk();
$response->assertViewIs('Staff.report.show');
$response->assertViewHas('report', $report);
$response->assertViewHas('urls');
// TODO: perform additional assertions
});
test('update validates with a form request', function (): void {
$this->assertActionUsesFormRequest(
\App\Http\Controllers\Staff\ReportController::class,
'update',
\App\Http\Requests\Staff\UpdateReportRequest::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.');
$report = \App\Models\Report::factory()->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->patch(route('staff.reports.update', [$report]), [
// TODO: send request data
]);
$response->assertOk();
// TODO: perform additional assertions
});
// test cases...