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

82 lines
2.8 KiB
PHP

<?php
uses(RefreshDatabase::class);
test('approve validates with a form request', function (): void {
$this->assertActionUsesFormRequest(
\App\Http\Controllers\Staff\ApplicationController::class,
'approve',
\App\Http\Requests\Staff\ApproveApplicationRequest::class
);
});
test('approve 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.');
$application = \App\Models\Application::factory()->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->post(route('staff.applications.approve', ['id' => $application->id]), [
// TODO: send request data
]);
$response->assertOk();
// 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.');
$applications = \App\Models\Application::factory()->times(3)->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->get(route('staff.applications.index'));
$response->assertOk();
$response->assertViewIs('Staff.application.index');
$response->assertViewHas('applications', $applications);
// TODO: perform additional assertions
});
test('reject validates with a form request', function (): void {
$this->assertActionUsesFormRequest(
\App\Http\Controllers\Staff\ApplicationController::class,
'reject',
\App\Http\Requests\Staff\RejectApplicationRequest::class
);
});
test('reject 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.');
$application = \App\Models\Application::factory()->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->post(route('staff.applications.reject', ['id' => $application->id]), [
// TODO: send request data
]);
$response->assertOk();
// 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.');
$application = \App\Models\Application::factory()->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->get(route('staff.applications.show', ['id' => $application->id]));
$response->assertOk();
$response->assertViewIs('Staff.application.show');
$response->assertViewHas('application', $application);
// TODO: perform additional assertions
});
// test cases...