2022-08-08 16:00:59 +00:00
|
|
|
<?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;
|
2024-01-04 21:51:32 +00:00
|
|
|
use Illuminate\Support\Facades\File;
|
2022-08-08 16:00:59 +00:00
|
|
|
use Tests\TestCase;
|
|
|
|
|
2024-01-11 12:41:33 +00:00
|
|
|
use function Tests\test_path;
|
|
|
|
|
2022-08-08 16:00:59 +00:00
|
|
|
class LastfmClientTest extends TestCase
|
|
|
|
{
|
|
|
|
public function testGetSessionKey(): void
|
|
|
|
{
|
2024-01-06 11:31:50 +00:00
|
|
|
$mock = new MockHandler([new Response(200, [], File::get(test_path('blobs/lastfm/session-key.json')))]);
|
2022-08-08 16:00:59 +00:00
|
|
|
|
|
|
|
$client = new LastfmClient(new GuzzleHttpClient(['handler' => HandlerStack::create($mock)]));
|
|
|
|
|
2022-10-07 14:25:44 +00:00
|
|
|
self::assertSame('foo', $client->getSessionKey('bar'));
|
2022-08-08 16:00:59 +00:00
|
|
|
}
|
|
|
|
}
|