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

156 lines
5.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.');
$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('rss.create'));
$response->assertOk();
$response->assertViewIs('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('rss.destroy', ['id' => $rss->id]));
$response->assertOk();
$this->assertModelMissing($rss);
// 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.');
$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('rss.edit', ['id' => $rss->id]));
$response->assertOk();
$response->assertViewIs('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_unless(403)`...
$response = $this->actingAs($user)->get(route('rss.edit', ['id' => $rss->id]));
$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('rss.index'));
$response->assertOk();
$response->assertViewIs('rss.index');
$response->assertViewHas('hash');
$response->assertViewHas('public_rss');
$response->assertViewHas('private_rss');
$response->assertViewHas('user', $user);
// 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.');
$rss = \App\Models\Rss::factory()->create();
$torrents = \App\Models\Torrent::factory()->times(3)->create();
$response = $this->get(route('rss.show.rsskey', ['id' => $rss->id, 'rsskey' => $rss->rsskey]));
$response->assertOk();
// TODO: perform additional assertions
});
test('show aborts with a 404', 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();
$torrents = \App\Models\Torrent::factory()->times(3)->create();
// TODO: perform additional setup to trigger `abort_if(404)`...
$response = $this->get(route('rss.show.rsskey', ['id' => $rss->id, 'rsskey' => $rss->rsskey]));
$response->assertNotFound();
});
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('rss.store'), [
// TODO: send request data
]);
$response->assertOk();
// TODO: perform additional assertions
});
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('rss.update', ['id' => $rss->id]), [
// TODO: send request data
]);
$response->assertOk();
// TODO: perform additional assertions
});
// test cases...