refactor: ColorRestorePlanner baut den Diff einmal aus ColorDiff; die Zusammenfassung zählt Entfernungen

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Jan-Niclas Loosen
2026-10-19 14:40:36 +02:00
co-authored by Claude Sonnet 5.5
parent d092c05311
commit 7608be6558
2 changed files with 22 additions and 14 deletions
@@ -77,7 +77,7 @@ final class ColorRestorePlannerTest extends TestCase
array_map(static fn (array $row): array => [$row['id'], $row['action']], $plan->diff)
);
self::assertStringStartsWith('Snapshot ' . self::SNAPSHOT_ID . ' wiederherstellen – Farben: ', $plan->summary);
self::assertStringEndsWith(' Entfernt: 1.', $plan->summary);
self::assertStringEndsWith('Farben: 1 geändert, 1 gelöscht.', $plan->summary);
self::assertSame(
['Farben, die es im Snapshot nicht gibt, entfallen („Akzent“); Seiten und Presets, die sie verwenden, '
. 'behalten den Verweis ohne Wert.'],
@@ -85,6 +85,17 @@ final class ColorRestorePlannerTest extends TestCase
);
}
public function testOnlyRemovalsAreCountedInTheSummary(): void
{
$current = self::snapshot() + ['gcid-akzent0001' => self::current()['gcid-akzent0001']];
$plan = self::planner()->plan($current, self::snapshot(), self::SNAPSHOT_ID);
self::assertInstanceOf(DesignPlan::class, $plan);
self::assertSame(['removed'], array_column($plan->diff, 'action'));
self::assertStringEndsWith('Farben: 1 gelöscht.', $plan->summary);
self::assertStringNotContainsString('keine Änderung', $plan->summary);
}
public function testTheSameColorsAreNoChange(): void
{
$plan = self::planner()->plan(self::snapshot(), self::snapshot(), self::SNAPSHOT_ID);