feat: Änderungs-Pipeline des Designsystems (Probelauf, design_rev, Snapshot, Rollback) und Bereich presets
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
bfd3840eb1
commit
bb4d9b3baf
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace LIT\MCP\Tests\Unit\Integrations\Divi\Design;
|
||||
|
||||
use LIT\MCP\Integrations\Divi\Design\DesignSystemWriter;
|
||||
use LIT\MCP\Integrations\Divi\Design\PresetArea;
|
||||
use LIT\MCP\Integrations\Divi\Design\PresetBook;
|
||||
use LIT\MCP\Tests\Unit\TestCase;
|
||||
use Mockery;
|
||||
|
||||
final class PresetAreaTest extends TestCase
|
||||
{
|
||||
public function testWritesTheRestFormatAndReadsBack(): void
|
||||
{
|
||||
$writer = Mockery::mock(DesignSystemWriter::class);
|
||||
$stored = PresetBookTest::stored();
|
||||
$writer->allows('presets')->andReturn($stored);
|
||||
$writer->expects('savePresets')
|
||||
->with(PresetBook::fromDivi($stored)->toRest(), true)
|
||||
->andReturn($stored);
|
||||
$area = new PresetArea($writer);
|
||||
|
||||
self::assertSame(['presets', 'Presets'], [$area->name(), $area->label()]);
|
||||
self::assertSame(PresetBook::fromDivi($stored)->data(), $area->raw());
|
||||
self::assertSame(PresetBook::fromDivi($stored)->rev(), $area->rev($stored));
|
||||
self::assertSame(PresetBook::fromDivi($stored)->data(), $area->write($stored, true));
|
||||
}
|
||||
|
||||
public function testVerifyIgnoresSanitizedValuesButNotMissingPresets(): void
|
||||
{
|
||||
$area = new PresetArea(Mockery::mock(DesignSystemWriter::class));
|
||||
$expected = PresetBookTest::stored();
|
||||
$sanitized = $expected;
|
||||
$sanitized['module']['divi/button']['items']['aaaaaaaaaa']['attrs'] = ['button' => ['x' => 'bereinigt']];
|
||||
$missing = $expected;
|
||||
unset($missing['module']['divi/button']['items']['bbbbbbbbbb']);
|
||||
$otherDefault = $expected;
|
||||
$otherDefault['module']['divi/text']['default'] = '';
|
||||
|
||||
self::assertTrue($area->verify($expected, $sanitized));
|
||||
self::assertFalse($area->verify($expected, $missing));
|
||||
self::assertFalse($area->verify($expected, $otherDefault));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user