koel/tests/Unit/Services/ApiClients/LastfmClientTest.php
2024-07-06 17:44:40 +02:00

23 lines
671 B
PHP

<?php
namespace Tests\Unit\Services\ApiClients;
use App\Services\ApiClients\LastfmClient;
use GuzzleHttp\Client as GuzzleHttpClient;
use GuzzleHttp\Handler\MockHandler;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Psr7\Response;
use Illuminate\Support\Facades\File;
use Tests\TestCase;
class LastfmClientTest extends TestCase
{
public function testGetSessionKey(): void
{
$mock = new MockHandler([new Response(200, [], File::get(test_path('blobs/lastfm/session-key.json')))]);
$client = new LastfmClient(new GuzzleHttpClient(['handler' => HandlerStack::create($mock)]));
self::assertSame('foo', $client->getSessionKey('bar'));
}
}