mirror of
https://github.com/Vateron-Media/XC_VM.git
synced 2026-11-04 11:03:20 +01:00
A fix reached panels only with the next release, and a release is a ceremony: a version bump, a changelog, a translation pass, a release PR. A patch build is the release with the fixes made since, published as X.Y.Z-pN by one run of the new Build Patch workflow from any ref: it picks the release the ref contains, numbers the patch, runs the unit tests, stamps the version into the build (as a nightly's is), builds the files a release has and publishes them on the channel of the release it patches. Nothing is prepared by hand. The panel takes it as it takes a release, on MAIN and on load balancers: - version_compare() already orders 2.6.5 < 2.6.5-p1 < 2.6.6. The release list is now ordered by version on every channel, not by publication: a patch of an older release is published after the release that follows it and must not hide it. - An update, a pin and a rollback accept a patch version. - A patch's changelog is read from its own asset. - A module that asks for core X.Y.Z keeps loading on X.Y.Z-pN. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AneTzAHPPkYWPQjwyZ2td9
50 lines
2.2 KiB
PHP
50 lines
2.2 KiB
PHP
<?php
|
|
|
|
use XcVm\Core\Module\ModuleLoader;
|
|
use PHPUnit\Framework\Attributes\DataProvider;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
/**
|
|
* ModuleLoader::coreRequirementError(): which `requires_core` values let a
|
|
* given core run a module, and that an unreadable one rules it out.
|
|
*/
|
|
final class ModuleCoreRequirementTest extends TestCase {
|
|
|
|
/** @return array<string, array{string, string, bool}> requires_core, core version, compatible */
|
|
public static function constraints(): array {
|
|
return [
|
|
'minimum met' => ['>=2.0', '2.6.0', true],
|
|
'minimum not met' => ['>=2.7.0', '2.6.0', false],
|
|
'range, inside' => ['>=2.6 <3.0', '2.6.0', true],
|
|
'range, comma separated' => ['>=2.6,<3.0', '3.0.0', false],
|
|
'exact, single equals' => ['=2.6.0', '2.6.0', true],
|
|
'exact, double equals' => ['==2.6.0', '2.6.1', false],
|
|
'not equal' => ['!=2.6.0', '2.6.0', false],
|
|
'bare version means >=' => ['2.6.1', '2.6.0', false],
|
|
'empty means any core' => ['', '1.0.0', true],
|
|
'caret is unreadable' => ['^2.6', '2.6.0', false],
|
|
'nightly counts as release' => ['>=2.6.1', '2.6.1-dev.3', true],
|
|
'nightly is not the next' => ['>=2.6.2', '2.6.1-dev.3', false],
|
|
'patch build counts as release' => ['=2.6.1', '2.6.1-p2', true],
|
|
'patch build within a bound' => ['>=2.6.0 <=2.6.1', '2.6.1-p14', true],
|
|
'patch build is not the next' => ['>=2.6.2', '2.6.1-p2', false],
|
|
];
|
|
}
|
|
|
|
#[DataProvider('constraints')]
|
|
public function testConstraint(string $rRequires, string $rCore, bool $rCompatible): void {
|
|
$this->assertSame($rCompatible, ModuleLoader::coreRequirementError($rRequires, $rCore) === null);
|
|
}
|
|
|
|
public function testTheReasonNamesTheConstraintAndTheCore(): void {
|
|
$this->assertSame('needs core >=2.7.0; this panel runs 2.6.0', ModuleLoader::coreRequirementError('>=2.7.0', '2.6.0'));
|
|
$this->assertSame("has an unreadable requires_core '~2.6'", ModuleLoader::coreRequirementError('~2.6', '2.6.0'));
|
|
}
|
|
|
|
public function testDefaultsToTheRunningCore(): void {
|
|
class_exists(\XcVm\Core\Config\ConstantsInitializer::class);
|
|
$this->assertNull(ModuleLoader::coreRequirementError('>=' . preg_replace('/-dev\.\d+$/', '', XC_VM_VERSION)));
|
|
$this->assertNotNull(ModuleLoader::coreRequirementError('>=99.0'));
|
|
}
|
|
}
|