Use composer metadata as primary source for version and ping build
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Setting;
|
||||
|
||||
it('returns version and build info', function (): void {
|
||||
Setting::updateOrCreate(['key' => 'version'], ['value' => '1.2.3']);
|
||||
Setting::updateOrCreate(['key' => 'build'], ['value' => '42']);
|
||||
it('returns version and build info from composer metadata', function (): void {
|
||||
$composer = json_decode((string) file_get_contents(base_path('composer.json')), true);
|
||||
$expectedVersion = (string) ($composer['version'] ?? '');
|
||||
$expectedBuild = isset($composer['build']) ? (int) $composer['build'] : null;
|
||||
|
||||
$response = $this->getJson('/api/version');
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertJsonFragment([
|
||||
'version' => '1.2.3',
|
||||
'build' => 42,
|
||||
'version' => $expectedVersion,
|
||||
'build' => $expectedBuild,
|
||||
]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user