fix(audit L4): Restore prüft die Fundstellen aller Diff-Zeilen (auch aktivierte und wieder angelegte IDs, Standard-Preset-Wechsel)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
c4ee195392
commit
bb5487082e
@@ -139,4 +139,23 @@ final class ColorRestorePlannerTest extends TestCase
|
||||
self::assertInstanceOf(DesignPlan::class, $plan);
|
||||
self::assertNull($plan->usages);
|
||||
}
|
||||
|
||||
/** Audit L4 (re-review): a color the snapshot brings back (old ID, pages may still reference it) is looked up too. */
|
||||
public function testReportsThePagesUsingAColorTheSnapshotRecreates(): void
|
||||
{
|
||||
$usages = Mockery::mock(GlobalUsages::class);
|
||||
$usages->expects('reportFor')->once()->with(Mockery::on(
|
||||
static fn (mixed $query): bool => $query instanceof ReferenceUsageQuery && $query->matches('gcid-alt000001')
|
||||
))->andReturn(UsageFixture::blockedReport());
|
||||
|
||||
$plan = self::planner(true, $usages)->plan(
|
||||
self::snapshot(),
|
||||
self::snapshot() + ['gcid-alt000001' => self::color('Alt', '#123456')],
|
||||
self::SNAPSHOT_ID
|
||||
);
|
||||
|
||||
self::assertInstanceOf(DesignPlan::class, $plan);
|
||||
self::assertSame(['added'], array_column($plan->diff, 'action'));
|
||||
self::assertTrue($plan->usages?->blocks());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,4 +89,21 @@ final class PresetRestorePlannerTest extends TestCase
|
||||
self::assertInstanceOf(DesignPlan::class, $plan);
|
||||
self::assertNull($plan->usages);
|
||||
}
|
||||
|
||||
/** Audit L4 (re-review): a preset becoming the default reaches modules without an own preset – looked up as default. */
|
||||
public function testALookupCoversPresetsTheSnapshotMakesDefault(): void
|
||||
{
|
||||
$older = PresetBookTest::stored();
|
||||
$older['module']['divi/button']['default'] = 'aaaaaaaaaa';
|
||||
$usages = Mockery::mock(GlobalUsages::class);
|
||||
$usages->expects('reportFor')->once()->with(Mockery::on(
|
||||
static fn (mixed $query): bool => $query instanceof PresetUsageQuery
|
||||
&& $query->matches('<!-- wp:divi/button {} /-->')
|
||||
))->andReturn(UsageFixture::blockedReport());
|
||||
|
||||
$plan = self::planner(true, $usages)->plan(PresetBookTest::stored(), $older, 'presets-1');
|
||||
|
||||
self::assertInstanceOf(DesignPlan::class, $plan);
|
||||
self::assertTrue($plan->usages?->blocks());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user