feat: lit/divi-variables-set warnt vor Verwendungen in Presets und beim Archivieren verwendeter Variablen
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
d7a8b85f8d
commit
fef964bb7a
@@ -316,4 +316,47 @@ final class DiviVariablesSetAbilityTest extends TestCase
|
||||
self::assertCount(2, $calls);
|
||||
self::assertSame(VariableBook::fromDivi(VariableAreaTest::stored())->data(), $calls[1], 'the snapshot again');
|
||||
}
|
||||
|
||||
/** Ruling V1a/V8: archiving a used variable is allowed; presets and posts are warnings, the dry run lists posts. */
|
||||
public function testArchivingAUsedVariableWarnsAndListsTheUsages(): void
|
||||
{
|
||||
$dry = self::assertToolError(
|
||||
$this->ability(self::usages(self::used()), null, PresetBookTest::storedWithReferences())
|
||||
->execute(['items' => [['id' => 'Slogan', 'status' => 'archived']]]),
|
||||
'confirm_required'
|
||||
);
|
||||
|
||||
self::assertSame(7, $dry['affected'][0]['post_id']);
|
||||
self::assertSame([
|
||||
'Variable „Slogan“ wird archiviert, aber noch von Presets verwendet: Doppelt.',
|
||||
'Die unter affected genannten Inhalte verweisen auf geänderte oder archivierte Variablen; archivierte '
|
||||
. 'Variablen bleiben dort als Verweis stehen. lit/divi-design-detach mit variable ersetzt die Verweise '
|
||||
. 'vorher durch den Wert.',
|
||||
], $dry['warnings']);
|
||||
}
|
||||
|
||||
public function testChangingAVariableWarnsAboutThePresetsThatUseIt(): void
|
||||
{
|
||||
$dry = self::assertToolError(
|
||||
$this->ability(null, null, PresetBookTest::storedWithReferences())
|
||||
->execute(['items' => [['id' => 'Eckenradius', 'value' => '12px']]]),
|
||||
'confirm_required'
|
||||
);
|
||||
|
||||
self::assertSame(
|
||||
['Die Änderung an Variable „Eckenradius“ wirkt auch auf die Presets Lesetext.'],
|
||||
$dry['warnings']
|
||||
);
|
||||
}
|
||||
|
||||
public function testNewVariablesHaveNoWarnings(): void
|
||||
{
|
||||
$dry = self::assertToolError(
|
||||
$this->ability(null, null, PresetBookTest::storedWithReferences())
|
||||
->execute(['items' => [['type' => 'strings', 'label' => 'Gruß', 'value' => 'Hallo']]]),
|
||||
'confirm_required'
|
||||
);
|
||||
|
||||
self::assertSame([], $dry['warnings']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user