2
0
Fork 0
mirror of https://github.com/koel/koel synced 2024-12-26 04:23:05 +00:00
koel/tests/Unit/Jobs/ScrobbleJobTest.php

31 lines
621 B
PHP
Raw Normal View History

<?php
namespace Tests\Unit\Jobs;
use App\Jobs\ScrobbleJob;
use App\Models\Song;
use App\Services\LastfmService;
use Mockery;
use Tests\TestCase;
2024-01-11 12:41:33 +00:00
use function Tests\create_user;
class ScrobbleJobTest extends TestCase
{
2021-06-04 16:31:45 +00:00
public function testHandle(): void
{
2024-01-11 12:41:33 +00:00
$user = create_user();
2021-06-04 16:31:45 +00:00
/** @var Song $song */
$song = Song::factory()->make();
$job = new ScrobbleJob($user, $song, 100);
$lastfm = Mockery::mock(LastfmService::class);
$lastfm->shouldReceive('scrobble')
->once()
2022-08-08 16:00:59 +00:00
->with($song, $user, 100);
2021-06-04 16:31:45 +00:00
$job->handle($lastfm);
}
}