mirror of
https://github.com/koel/koel
synced 2024-12-19 00:53:05 +00:00
30 lines
877 B
PHP
30 lines
877 B
PHP
|
<?php
|
||
|
|
||
|
namespace Tests\Integration\Services;
|
||
|
|
||
|
use App\Services\ApplicationInformationService;
|
||
|
use GuzzleHttp\Client;
|
||
|
use GuzzleHttp\Handler\MockHandler;
|
||
|
use GuzzleHttp\HandlerStack;
|
||
|
use GuzzleHttp\Psr7\Response;
|
||
|
use Illuminate\Log\Logger;
|
||
|
use Tests\TestCase;
|
||
|
use Illuminate\Contracts\Cache\Repository as Cache;
|
||
|
|
||
|
class ApplicationInformationServiceTest extends TestCase
|
||
|
{
|
||
|
public function testGetLatestVersionNumber(): void
|
||
|
{
|
||
|
$latestVersion = 'v1.1.2';
|
||
|
|
||
|
$mock = new MockHandler([
|
||
|
new Response(200, [], file_get_contents(__DIR__.'../../../blobs/github-tags.json')),
|
||
|
]);
|
||
|
|
||
|
$client = new Client(['handler' => HandlerStack::create($mock)]);
|
||
|
$service = new ApplicationInformationService($client, app(Cache::class), app(Logger::class));
|
||
|
|
||
|
self::assertEquals($latestVersion, $service->getLatestVersionNumber());
|
||
|
}
|
||
|
}
|