service = app(SmartPlaylistService::class); } public function testOwnSongsOnlyOption(): void { $owner = create_user(); $matches = Song::factory()->count(3)->for($owner, 'owner')->create(['title' => 'Foo Something']); Song::factory()->count(2)->create(['title' => 'Foo Something']); Song::factory()->count(3)->create(['title' => 'Bar Something']); /** @var Playlist $playlist */ $playlist = Playlist::factory() ->for($owner) ->create([ 'rules' => [ [ 'id' => Str::uuid()->toString(), 'rules' => [ [ 'id' => Str::uuid()->toString(), 'model' => 'title', 'operator' => 'is', 'value' => ['Foo Something'], ], ], ], ], 'own_songs_only' => true, ]); self::assertEqualsCanonicalizing( $matches->pluck('id')->all(), $this->service->getSongs($playlist, $owner)->pluck('id')->all() ); } }