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

133 lines
4.7 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.distributors.create'));
$response->assertOk();
$response->assertViewIs('Staff.distributor.create');
// TODO: perform additional assertions
});
test('delete 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.');
$distributor = \App\Models\Distributor::factory()->create();
$distributors = \App\Models\Distributor::factory()->times(3)->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->get(route('staff.distributors.delete', [$distributor]));
$response->assertOk();
$response->assertViewIs('Staff.distributor.delete');
$response->assertViewHas('distributors', $distributors);
$response->assertViewHas('distributor', $distributor);
// TODO: perform additional assertions
});
test('destroy validates with a form request', function (): void {
$this->assertActionUsesFormRequest(
\App\Http\Controllers\Staff\DistributorController::class,
'destroy',
\App\Http\Requests\Staff\DestroyDistributorRequest::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.');
$distributor = \App\Models\Distributor::factory()->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->delete(route('staff.distributors.destroy', [$distributor]));
$response->assertOk();
$this->assertModelMissing($distributor);
// 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.');
$distributor = \App\Models\Distributor::factory()->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->get(route('staff.distributors.edit', [$distributor]));
$response->assertOk();
$response->assertViewIs('Staff.distributor.edit');
$response->assertViewHas('distributor', $distributor);
// 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.');
$distributors = \App\Models\Distributor::factory()->times(3)->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->get(route('staff.distributors.index'));
$response->assertOk();
$response->assertViewIs('Staff.distributor.index');
$response->assertViewHas('distributors', $distributors);
// TODO: perform additional assertions
});
test('store validates with a form request', function (): void {
$this->assertActionUsesFormRequest(
\App\Http\Controllers\Staff\DistributorController::class,
'store',
\App\Http\Requests\Staff\StoreDistributorRequest::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.distributors.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\DistributorController::class,
'update',
\App\Http\Requests\Staff\UpdateDistributorRequest::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.');
$distributor = \App\Models\Distributor::factory()->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->patch(route('staff.distributors.update', [$distributor]), [
// TODO: send request data
]);
$response->assertOk();
// TODO: perform additional assertions
});
// test cases...