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

171 lines
6.2 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.');
$categories = \App\Models\Category::factory()->times(3)->create();
$types = \App\Models\Type::factory()->times(3)->create();
$resolutions = \App\Models\Resolution::factory()->times(3)->create();
$genres = \App\Models\Genre::factory()->times(3)->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->get(route('staff.rss.create'));
$response->assertOk();
$response->assertViewIs('Staff.rss.create');
$response->assertViewHas('categories', $categories);
$response->assertViewHas('types', $types);
$response->assertViewHas('resolutions', $resolutions);
$response->assertViewHas('genres', $genres);
$response->assertViewHas('user', $user);
// TODO: perform additional assertions
});
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.');
$rss = \App\Models\Rss::factory()->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->delete(route('staff.rss.destroy', [$rss]));
$response->assertOk();
$this->assertModelMissing($rss);
// 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.');
$rss = \App\Models\Rss::factory()->create();
$user = \App\Models\User::factory()->create();
// TODO: perform additional setup to trigger `abort_if(403)`...
$response = $this->actingAs($user)->delete(route('staff.rss.destroy', [$rss]));
$response->assertForbidden();
});
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.');
$rss = \App\Models\Rss::factory()->create();
$categories = \App\Models\Category::factory()->times(3)->create();
$types = \App\Models\Type::factory()->times(3)->create();
$resolutions = \App\Models\Resolution::factory()->times(3)->create();
$genres = \App\Models\Genre::factory()->times(3)->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->get(route('staff.rss.edit', [$rss]));
$response->assertOk();
$response->assertViewIs('Staff.rss.edit');
$response->assertViewHas('categories', $categories);
$response->assertViewHas('types', $types);
$response->assertViewHas('resolutions', $resolutions);
$response->assertViewHas('genres', $genres);
$response->assertViewHas('user', $user);
$response->assertViewHas('rss', $rss);
// TODO: perform additional assertions
});
test('edit 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.');
$rss = \App\Models\Rss::factory()->create();
$categories = \App\Models\Category::factory()->times(3)->create();
$types = \App\Models\Type::factory()->times(3)->create();
$resolutions = \App\Models\Resolution::factory()->times(3)->create();
$genres = \App\Models\Genre::factory()->times(3)->create();
$user = \App\Models\User::factory()->create();
// TODO: perform additional setup to trigger `abort_if(403)`...
$response = $this->actingAs($user)->get(route('staff.rss.edit', [$rss]));
$response->assertForbidden();
});
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.');
$rsses = \App\Models\Rss::factory()->times(3)->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->get(route('staff.rss.index'));
$response->assertOk();
$response->assertViewIs('Staff.rss.index');
$response->assertViewHas('public_rss');
// TODO: perform additional assertions
});
test('store validates with a form request', function (): void {
$this->assertActionUsesFormRequest(
\App\Http\Controllers\Staff\RssController::class,
'store',
\App\Http\Requests\Staff\StoreRssRequest::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.rss.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\RssController::class,
'update',
\App\Http\Requests\Staff\UpdateRssRequest::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.');
$rss = \App\Models\Rss::factory()->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->patch(route('staff.rss.update', [$rss]), [
// TODO: send request data
]);
$response->assertOk();
// TODO: perform additional assertions
});
test('update 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.');
$rss = \App\Models\Rss::factory()->create();
$user = \App\Models\User::factory()->create();
// TODO: perform additional setup to trigger `abort_if(403)`...
$response = $this->actingAs($user)->patch(route('staff.rss.update', [$rss]), [
// TODO: send request data
]);
$response->assertForbidden();
});
// test cases...