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

117 lines
3.9 KiB
PHP

<?php
uses(RefreshDatabase::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.');
$bot = \App\Models\Bot::factory()->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->delete(route('staff.bots.destroy', [$bot]));
$response->assertOk();
$this->assertModelMissing($bot);
// TODO: perform additional assertions
});
test('destroy aborts with a 403', function (): void {
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
$bot = \App\Models\Bot::factory()->create();
$user = \App\Models\User::factory()->create();
// TODO: perform additional setup to trigger `abort_if(403)`...
$response = $this->actingAs($user)->delete(route('staff.bots.destroy', [$bot]));
$response->assertForbidden();
});
test('disable 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.');
$bot = \App\Models\Bot::factory()->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->post(route('staff.bots.disable', [$bot]), [
// TODO: send request data
]);
$response->assertOk();
// 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.');
$bot = \App\Models\Bot::factory()->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->get(route('staff.bots.edit', [$bot]));
$response->assertOk();
$response->assertViewIs('Staff.chat.bot.edit');
$response->assertViewHas('user', $user);
$response->assertViewHas('bot', $bot);
// TODO: perform additional assertions
});
test('enable 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.');
$bot = \App\Models\Bot::factory()->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->post(route('staff.bots.enable', [$bot]), [
// 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.');
$bots = \App\Models\Bot::factory()->times(3)->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->get(route('staff.bots.index'));
$response->assertOk();
$response->assertViewIs('Staff.chat.bot.index');
$response->assertViewHas('bots', $bots);
// TODO: perform additional assertions
});
test('update validates with a form request', function (): void {
$this->assertActionUsesFormRequest(
\App\Http\Controllers\Staff\ChatBotController::class,
'update',
\App\Http\Requests\Staff\UpdateChatBotRequest::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.');
$bot = \App\Models\Bot::factory()->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->patch(route('staff.bots.update', [$bot]), [
// TODO: send request data
]);
$response->assertOk();
// TODO: perform additional assertions
});
// test cases...