mirror of
https://github.com/koel/koel
synced 2024-12-22 02:23:14 +00:00
25 lines
676 B
PHP
25 lines
676 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 Tests\TestCase;
|
||
|
|
||
|
class LastfmClientTest extends TestCase
|
||
|
{
|
||
|
public function testGetSessionKey(): void
|
||
|
{
|
||
|
$mock = new MockHandler([
|
||
|
new Response(200, [], file_get_contents(__DIR__ . '/../../../blobs/lastfm/session-key.json')),
|
||
|
]);
|
||
|
|
||
|
$client = new LastfmClient(new GuzzleHttpClient(['handler' => HandlerStack::create($mock)]));
|
||
|
|
||
|
self::assertEquals('foo', $client->getSessionKey('bar'));
|
||
|
}
|
||
|
}
|