Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { AllPHPVersions, type AllPHPVersion } from '@php-wasm/universal';
import {
AllPHPVersions,
LatestSupportedPHPVersion,
type AllPHPVersion,
} from '@php-wasm/universal';
import { RecommendedPHPVersion } from '@wp-playground/common';
import { BlueprintReflection } from './reflection';
import type {
Expand Down Expand Up @@ -83,6 +87,9 @@ function resolveV2PHPVersion(
}

function resolveV2PHPVersionString(phpVersion: string): AllPHPVersion {
if (phpVersion === 'latest') {
return LatestSupportedPHPVersion;
}
if ((AllPHPVersions as readonly string[]).includes(phpVersion)) {
return phpVersion as AllPHPVersion;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { StreamedFile } from '@php-wasm/stream-compression';
import { LatestSupportedPHPVersion } from '@php-wasm/universal';
import { RecommendedPHPVersion } from '@wp-playground/common';
import { resolveRuntimeConfiguration } from '../../lib/resolve-runtime-configuration';
import type { BlueprintBundle } from '../../lib/types';
Expand Down Expand Up @@ -112,6 +113,17 @@ describe('Blueprint v2 runtime configuration', () => {
});
});

it('resolves the latest PHP version label', async () => {
await expect(
resolveRuntimeConfiguration({
version: 2,
phpVersion: 'latest',
})
).resolves.toMatchObject({
phpVersion: LatestSupportedPHPVersion,
});
});

it('resolves recommended PHP versions from constraint objects', async () => {
await expect(
resolveRuntimeConfiguration({
Expand Down
Loading