2024-02-24 15:37:01 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests\Feature\KoelPlus;
|
|
|
|
|
|
|
|
use App\Models\Playlist;
|
|
|
|
use Tests\PlusTestCase;
|
|
|
|
|
|
|
|
use function Tests\create_user;
|
|
|
|
|
|
|
|
class PlaylistCoverTest extends PlusTestCase
|
|
|
|
{
|
2024-07-26 12:28:11 +00:00
|
|
|
public function testCollaboratorCanNotUploadCover(): void
|
2024-02-24 15:37:01 +00:00
|
|
|
{
|
|
|
|
/** @var Playlist $playlist */
|
|
|
|
$playlist = Playlist::factory()->create();
|
|
|
|
$collaborator = create_user();
|
|
|
|
$playlist->addCollaborator($collaborator);
|
|
|
|
|
2024-03-22 20:34:32 +00:00
|
|
|
$this->putAs("api/playlists/$playlist->id/cover", ['cover' => 'data:image/jpeg;base64,Rm9v'], $collaborator)
|
2024-07-26 12:28:11 +00:00
|
|
|
->assertForbidden();
|
2024-02-24 15:37:01 +00:00
|
|
|
}
|
2024-07-26 14:33:14 +00:00
|
|
|
|
|
|
|
public function testCollaboratorCannotDeleteCover(): void
|
|
|
|
{
|
|
|
|
/** @var Playlist $playlist */
|
|
|
|
$playlist = Playlist::factory()->create();
|
|
|
|
$collaborator = create_user();
|
|
|
|
$playlist->addCollaborator($collaborator);
|
|
|
|
|
|
|
|
$this->deleteAs("api/playlists/$playlist->id/cover", [], $collaborator)
|
|
|
|
->assertForbidden();
|
|
|
|
}
|
2024-02-24 15:37:01 +00:00
|
|
|
}
|