feat: Presets als Stapel, Gruppen-Presets und clear_overrides im Composer
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
fafa140546
commit
be6ca5bee0
@@ -261,5 +261,51 @@ final class DiviUpdateAbilityTest extends DiviWriteAbilityTestCase
|
||||
self::assertStringNotContainsString('1058', (string) json_encode($hidden));
|
||||
self::assertStringContainsString('[global 1059]', (string) $shown['outline']);
|
||||
}
|
||||
}
|
||||
|
||||
public function testUpdateOffersPresetStacksGroupPresetsAndClearOverrides(): void
|
||||
{
|
||||
$change = $this->update()->inputSchema()['properties']['changes']['items']['properties'];
|
||||
|
||||
self::assertSame(['string', 'array', 'null'], $change['preset']['type']);
|
||||
self::assertSame(['type' => 'string'], $change['preset']['items']);
|
||||
self::assertSame([1, 10], [$change['preset']['minItems'], $change['preset']['maxItems']]);
|
||||
self::assertSame('object', $change['group_presets']['type']);
|
||||
self::assertSame(['string', 'array', 'null'], $change['group_presets']['additionalProperties']['type']);
|
||||
self::assertSame([1, 10], [
|
||||
$change['group_presets']['additionalProperties']['minItems'],
|
||||
$change['group_presets']['additionalProperties']['maxItems'],
|
||||
]);
|
||||
self::assertSame('boolean', $change['clear_overrides']['type']);
|
||||
|
||||
$description = $this->update()->description();
|
||||
foreach (['group_presets', 'clear_overrides', 'das letzte Preset'] as $text) {
|
||||
self::assertStringContainsString($text, $description);
|
||||
}
|
||||
self::assertStringContainsString('group_presets', $this->insert()->description());
|
||||
}
|
||||
|
||||
public function testClearOverridesMustBeABoolean(): void
|
||||
{
|
||||
$result = $this->update()->execute(['post_id' => 7, 'tree_rev' => $this->treeRev(), 'changes' => [
|
||||
['id' => 's0.r0.c1.m2', 'clear_overrides' => 'ja'],
|
||||
]]);
|
||||
|
||||
self::assertToolError($result, 'validation_failed');
|
||||
self::assertSame(
|
||||
'true oder false erwartet',
|
||||
self::clientError($result)['fields']['changes[0].clear_overrides']
|
||||
);
|
||||
self::assertSame([], $this->saved);
|
||||
}
|
||||
|
||||
/** A pure clear_overrides that finds no covering value changes nothing and saves nothing. */
|
||||
public function testClearOverridesWithoutAHitIsNoChange(): void
|
||||
{
|
||||
$result = $this->update()->execute(['post_id' => 7, 'tree_rev' => $this->treeRev(), 'changes' => [
|
||||
['id' => 's0.r0.c1.m2', 'clear_overrides' => true],
|
||||
]]);
|
||||
|
||||
self::assertStringStartsWith('Keine Änderung', $result['summary']);
|
||||
self::assertSame([], $this->saved);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user