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

116 lines
3.8 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.regions.create'));
$response->assertOk();
$response->assertViewIs('Staff.region.create');
// TODO: perform additional assertions
});
test('destroy validates with a form request', function (): void {
$this->assertActionUsesFormRequest(
\App\Http\Controllers\Staff\RegionController::class,
'destroy',
\App\Http\Requests\Staff\DestroyRegionRequest::class
);
});
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.');
$region = \App\Models\Region::factory()->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->delete(route('staff.regions.destroy', [$region]));
$response->assertOk();
$this->assertModelMissing($region);
// 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.');
$region = \App\Models\Region::factory()->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->get(route('staff.regions.edit', [$region]));
$response->assertOk();
$response->assertViewIs('Staff.region.edit');
$response->assertViewHas('region', $region);
// 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.');
$regions = \App\Models\Region::factory()->times(3)->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->get(route('staff.regions.index'));
$response->assertOk();
$response->assertViewIs('Staff.region.index');
$response->assertViewHas('regions', $regions);
// TODO: perform additional assertions
});
test('store validates with a form request', function (): void {
$this->assertActionUsesFormRequest(
\App\Http\Controllers\Staff\RegionController::class,
'store',
\App\Http\Requests\Staff\StoreRegionRequest::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.regions.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\RegionController::class,
'update',
\App\Http\Requests\Staff\UpdateRegionRequest::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.');
$region = \App\Models\Region::factory()->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->patch(route('staff.regions.update', [$region]), [
// TODO: send request data
]);
$response->assertOk();
// TODO: perform additional assertions
});
// test cases...