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

183 lines
6.3 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('playlists.create'));
$response->assertOk();
$response->assertViewIs('playlist.create');
// 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.');
$playlist = \App\Models\Playlist::factory()->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->delete(route('playlists.destroy', [$playlist]));
$response->assertOk();
$this->assertModelMissing($playlist);
// 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.');
$playlist = \App\Models\Playlist::factory()->create();
$user = \App\Models\User::factory()->create();
// TODO: perform additional setup to trigger `abort_unless(403)`...
$response = $this->actingAs($user)->delete(route('playlists.destroy', [$playlist]));
$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.');
$playlist = \App\Models\Playlist::factory()->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->get(route('playlists.edit', [$playlist]));
$response->assertOk();
$response->assertViewIs('playlist.edit');
$response->assertViewHas('playlist', $playlist);
// 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.');
$playlist = \App\Models\Playlist::factory()->create();
$user = \App\Models\User::factory()->create();
// TODO: perform additional setup to trigger `abort_unless(403)`...
$response = $this->actingAs($user)->get(route('playlists.edit', [$playlist]));
$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.');
$playlists = \App\Models\Playlist::factory()->times(3)->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->get(route('playlists.index'));
$response->assertOk();
$response->assertViewIs('playlist.index');
$response->assertViewHas('playlists', $playlists);
// 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.');
$playlist = \App\Models\Playlist::factory()->create();
$tv = \App\Models\Tv::factory()->create();
$movie = \App\Models\Movie::factory()->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->get(route('playlists.show', [$playlist]));
$response->assertOk();
$response->assertViewIs('playlist.show');
$response->assertViewHas('playlist', $playlist);
$response->assertViewHas('meta');
$response->assertViewHas('torrents');
// TODO: perform additional assertions
});
test('show 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.');
$playlist = \App\Models\Playlist::factory()->create();
$tv = \App\Models\Tv::factory()->create();
$movie = \App\Models\Movie::factory()->create();
$user = \App\Models\User::factory()->create();
// TODO: perform additional setup to trigger `abort_if(403)`...
$response = $this->actingAs($user)->get(route('playlists.show', [$playlist]));
$response->assertForbidden();
});
test('store validates with a form request', function (): void {
$this->assertActionUsesFormRequest(
\App\Http\Controllers\PlaylistController::class,
'store',
\App\Http\Requests\StorePlaylistRequest::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('playlists.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\PlaylistController::class,
'update',
\App\Http\Requests\UpdatePlaylistRequest::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.');
$playlist = \App\Models\Playlist::factory()->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->patch(route('playlists.update', [$playlist]), [
// 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.');
$playlist = \App\Models\Playlist::factory()->create();
$user = \App\Models\User::factory()->create();
// TODO: perform additional setup to trigger `abort_unless(403)`...
$response = $this->actingAs($user)->patch(route('playlists.update', [$playlist]), [
// TODO: send request data
]);
$response->assertForbidden();
});
// test cases...