refactor: Übergangs-API der Gesamtsperre entfernt (assertWritable, writable, refusal, writeFeatures, released); DiviLocked verlangt die gesperrten Fähigkeiten, Tests bauen Zustände über ReleaseMatrices
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
c036a92b60
commit
d0d3488df8
@@ -15,52 +15,6 @@ use LogicException;
|
||||
|
||||
final class ReleaseStatusTest extends TestCase
|
||||
{
|
||||
public function testOnlyAReleasedVersionIsWritable(): void
|
||||
{
|
||||
self::assertTrue(ReleaseStatus::released('5.2.1')->writable());
|
||||
self::assertFalse((new ReleaseStatus(ReleaseState::Untested, '5.3.0'))->writable());
|
||||
self::assertFalse((new ReleaseStatus(ReleaseState::Incompatible, '5.3.0', null, ['x']))->writable());
|
||||
}
|
||||
|
||||
public function testUntestedRefusalNamesTheVersionAndTheWayOut(): void
|
||||
{
|
||||
$payload = self::assertToolError(
|
||||
(new ReleaseStatus(ReleaseState::Untested, '5.3.0'))->refusal(),
|
||||
'divi_untested'
|
||||
);
|
||||
|
||||
self::assertSame(
|
||||
'Achtung: Divi 5.3.0 ist auf dieser Website noch nicht für LIT MCP freigegeben. Dieses Werkzeug braucht '
|
||||
. 'Divi-Fähigkeiten, die noch nicht geprüft sind; andere Divi-Werkzeuge laufen weiter. Ein '
|
||||
. 'Administrator kann unter Einstellungen → LIT MCP → Divi die Prüfung ausführen und die Version '
|
||||
. 'freigeben. Es wurde nichts geändert.',
|
||||
$payload['message']
|
||||
);
|
||||
self::assertStringContainsString('ein Werkzeug ohne die betroffene Fähigkeit nutzen', $payload['hint']);
|
||||
self::assertStringContainsString('components → divi → features', $payload['hint']);
|
||||
}
|
||||
|
||||
public function testIncompatibleRefusalListsTheProblems(): void
|
||||
{
|
||||
$status = new ReleaseStatus(ReleaseState::Incompatible, '5.3.0', null, ['Theme Builder: Nachbau von x()']);
|
||||
$payload = self::assertToolError($status->refusal(), 'divi_incompatible');
|
||||
|
||||
self::assertSame(
|
||||
'Divi 5.3.0 hat Stellen geändert, die LIT MCP für dieses Werkzeug nutzt; andere Divi-Werkzeuge laufen '
|
||||
. 'weiter. Die betroffenen Werkzeuge bleiben gesperrt, bis LIT MCP aktualisiert wurde. Es wurde '
|
||||
. 'nichts geändert.',
|
||||
$payload['message']
|
||||
);
|
||||
self::assertSame(['Theme Builder: Nachbau von x()'], $payload['problems']);
|
||||
}
|
||||
|
||||
public function testAReleasedStatusHasNoRefusal(): void
|
||||
{
|
||||
$this->expectException(LogicException::class);
|
||||
|
||||
ReleaseStatus::released('5.2.1')->refusal();
|
||||
}
|
||||
|
||||
public function testToArrayForSiteStatus(): void
|
||||
{
|
||||
$status = new ReleaseStatus(
|
||||
@@ -82,7 +36,7 @@ final class ReleaseStatusTest extends TestCase
|
||||
{
|
||||
$untested = new ReleaseStatus(ReleaseState::Untested, '5.3.0');
|
||||
$broken = new ReleaseStatus(ReleaseState::Incompatible, '5.3.0', null, ['x']);
|
||||
$released = ReleaseStatus::released('5.2.1', ReleaseStatus::SOURCE_DATABASE);
|
||||
$released = ReleaseMatrices::released('5.2.1', ReleaseStatus::SOURCE_DATABASE);
|
||||
|
||||
foreach (DiviFeature::cases() as $feature) {
|
||||
self::assertSame(ReleaseState::Untested, $untested->matrix->of($feature)->state);
|
||||
@@ -106,17 +60,6 @@ final class ReleaseStatusTest extends TestCase
|
||||
self::assertSame('auto', ReleaseStatus::of('5.99.0', CompatibilityMatrix::allReleased('auto'))->source);
|
||||
}
|
||||
|
||||
public function testWritableAsksOnlyTheWritingFeatures(): void
|
||||
{
|
||||
$readLocked = ReleaseMatrices::status([DiviFeature::Catalog, DiviFeature::PageRead]);
|
||||
self::assertSame(ReleaseState::Untested, $readLocked->state);
|
||||
self::assertTrue($readLocked->writable());
|
||||
|
||||
foreach (CompatibilityMatrix::writeFeatures() as $feature) {
|
||||
self::assertFalse(ReleaseMatrices::status([$feature])->writable(), $feature->value);
|
||||
}
|
||||
}
|
||||
|
||||
public function testAMatrixInAnotherStateThanTheStatusIsRefused(): void
|
||||
{
|
||||
$this->expectException(LogicException::class);
|
||||
|
||||
Reference in New Issue
Block a user