koel/tests/Integration/Services/ApplicationInformationServiceTest.php

32 lines
888 B
PHP
Raw Normal View History

<?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\Support\Facades\File;
use Tests\TestCase;
2024-01-11 12:41:33 +00:00
use function Tests\test_path;
class ApplicationInformationServiceTest extends TestCase
{
public function testGetLatestVersionNumber(): void
{
$latestVersion = 'v1.1.2';
$mock = new MockHandler([
new Response(200, [], File::get(test_path('blobs/github-tags.json'))),
]);
$client = new Client(['handler' => HandlerStack::create($mock)]);
2024-06-04 13:35:00 +00:00
$service = new ApplicationInformationService($client);
2022-10-07 14:25:44 +00:00
self::assertSame($latestVersion, $service->getLatestVersionNumber());
2020-12-22 23:01:49 +00:00
self::assertSame($latestVersion, cache()->get('latestKoelVersion'));
}
}