mirror of
https://github.com/koel/koel
synced 2024-12-19 00:53:05 +00:00
aae444a9b4
Co-authored-by: Allen Taylor <allen.taylor@check24.de> Co-authored-by: Phan An <me@phanan.net>
46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Tests\Integration\Services;
|
|
|
|
use App\Models\User;
|
|
use App\Services\PlaylistService;
|
|
use Tests\TestCase;
|
|
|
|
class PlaylistServiceTest extends TestCase
|
|
{
|
|
private PlaylistService $service;
|
|
|
|
public function setUp(): void
|
|
{
|
|
parent::setUp();
|
|
|
|
$this->service = app(PlaylistService::class);
|
|
}
|
|
|
|
public function testCreatePlaylist(): void
|
|
{
|
|
/** @var User $user */
|
|
$user = User::factory()->create();
|
|
|
|
$playlist = $this->service->createPlaylist('foo', $user, []);
|
|
self::assertFalse($playlist->getIsSmartAttribute());
|
|
}
|
|
|
|
public function testCreateSmartPlaylist(): void
|
|
{
|
|
$rules = [
|
|
[
|
|
'id' => 1634756491129,
|
|
'model' => 'title',
|
|
'operator' => 'is',
|
|
'value' => ['foobar'],
|
|
],
|
|
];
|
|
|
|
/** @var User $user */
|
|
$user = User::factory()->create();
|
|
|
|
$playlist = $this->service->createPlaylist('foo', $user, [], $rules);
|
|
self::assertTrue($playlist->getIsSmartAttribute());
|
|
}
|
|
}
|