Requirement, Call, ConstantRequirement, Mirror, Problem, FeatureStatus, CompatibilityMatrix, Manifest, ManifestCheck sowie Fingerprints und LineDiff liegen jetzt im divi-freien Kern. Neu: GlobalRequirement, CompatibilityMatrix::fromProblems(), ManifestCheck-Option signatures, DiviManifestCheck::create() und DiviAreas. Divi-Verhalten unverändert. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
37 lines
1.4 KiB
PHP
37 lines
1.4 KiB
PHP
<?php
|
||
|
||
declare(strict_types=1);
|
||
|
||
namespace LIT\MCP\Tests\Unit\Integrations\Divi\Release;
|
||
|
||
use LIT\MCP\Abilities\ToolRefusal;
|
||
use LIT\MCP\Compatibility\ReleaseState;
|
||
use LIT\MCP\Integrations\Divi\Release\DiviFeature;
|
||
use LIT\MCP\Integrations\Divi\Release\DiviLocked;
|
||
use LIT\MCP\Tests\Support\ReleaseMatrices;
|
||
use LIT\MCP\Tests\Unit\TestCase;
|
||
use LogicException;
|
||
|
||
final class DiviLockedTest extends TestCase
|
||
{
|
||
public function testWithFeaturesTheErrorIsTheRefusalOfThoseFeatures(): void
|
||
{
|
||
$status = ReleaseMatrices::status([DiviFeature::PresetWrite], ReleaseState::Incompatible);
|
||
$locked = new DiviLocked($status, [DiviFeature::PresetWrite]);
|
||
|
||
self::assertInstanceOf(ToolRefusal::class, $locked);
|
||
self::assertSame('Divi 5.3.0 is incompatible for LIT MCP – preset-write refused', $locked->getMessage());
|
||
self::assertEquals($status->refusalFor([DiviFeature::PresetWrite]), $locked->toError());
|
||
$payload = self::assertToolError($locked->toError(), 'divi_incompatible');
|
||
self::assertSame(['preset-write'], array_column($payload['features'], 'id'));
|
||
}
|
||
|
||
public function testALockWithoutFeaturesIsAProgrammingError(): void
|
||
{
|
||
$this->expectException(LogicException::class);
|
||
$this->expectExceptionMessage('a Divi lock needs the locked features');
|
||
|
||
new DiviLocked(ReleaseMatrices::uniform(ReleaseState::Untested), []);
|
||
}
|
||
}
|