fix(audit L5): unter der Sperre Divis Laufzeit-Caches verwerfen (Options-Cache-Gruppe, GlobalData-/GlobalPreset-Static, et_theme_options) vor raw() und design_rev
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
6e84138979
commit
99c7aab238
@@ -42,6 +42,7 @@ final class DiviDesignRestoreAbilityTest extends TestCase
|
||||
$older = PresetBookTest::stored();
|
||||
unset($older['module']['divi/button']['items']['bbbbbbbbbb']);
|
||||
$writer = Mockery::mock(DesignSystemWriter::class);
|
||||
$writer->allows('refresh');
|
||||
$writer->allows('presets')->andReturn(PresetBookTest::stored());
|
||||
$writer->allows('canUseVisualBuilder')->andReturn(true);
|
||||
$writer->expects('savePresets')->with(Mockery::type('array'), true)->andReturn($older);
|
||||
@@ -73,6 +74,7 @@ final class DiviDesignRestoreAbilityTest extends TestCase
|
||||
{
|
||||
Functions\when('current_user_can')->justReturn(true);
|
||||
$writer = Mockery::mock(DesignSystemWriter::class);
|
||||
$writer->allows('refresh');
|
||||
$writer->allows('presets')->andReturn($current);
|
||||
$writer->allows('canUseVisualBuilder')->andReturn(true);
|
||||
$snapshots = Mockery::mock(SnapshotStore::class);
|
||||
@@ -108,6 +110,7 @@ final class DiviDesignRestoreAbilityTest extends TestCase
|
||||
{
|
||||
Functions\when('current_user_can')->justReturn(false);
|
||||
$writer = Mockery::mock(DesignSystemWriter::class);
|
||||
$writer->allows('refresh');
|
||||
$writer->allows('canUseVisualBuilder')->andReturn(true);
|
||||
$writer->shouldNotReceive('savePresets');
|
||||
$snapshots = Mockery::mock(SnapshotStore::class);
|
||||
@@ -144,6 +147,7 @@ final class DiviDesignRestoreAbilityTest extends TestCase
|
||||
{
|
||||
Functions\when('current_user_can')->justReturn(true);
|
||||
$writer = Mockery::mock(DesignSystemWriter::class);
|
||||
$writer->allows('refresh');
|
||||
$writer->allows('canUseVisualBuilder')->andReturn(true);
|
||||
$snapshots = Mockery::mock(SnapshotStore::class);
|
||||
$snapshots->shouldNotReceive('get');
|
||||
@@ -171,6 +175,7 @@ final class DiviDesignRestoreAbilityTest extends TestCase
|
||||
): DiviDesignRestoreAbility {
|
||||
Functions\when('current_user_can')->justReturn(true);
|
||||
$writer = Mockery::mock(DesignSystemWriter::class);
|
||||
$writer->allows('refresh');
|
||||
$writer->allows('canUseVisualBuilder')->andReturn(true);
|
||||
$writer->allows('presets')->andReturn(PresetBookTest::stored());
|
||||
$writer->shouldNotReceive('savePresets');
|
||||
@@ -206,6 +211,7 @@ final class DiviDesignRestoreAbilityTest extends TestCase
|
||||
private static function colorStore(array $stored): GlobalColorsAdapter&MockInterface
|
||||
{
|
||||
$colors = Mockery::mock(GlobalColorsAdapter::class);
|
||||
$colors->allows('refresh');
|
||||
$colors->allows('read')->andReturnUsing(static function () use (&$stored): array {
|
||||
return $stored;
|
||||
});
|
||||
@@ -225,6 +231,7 @@ final class DiviDesignRestoreAbilityTest extends TestCase
|
||||
private static function variableStore(array $stored, bool $manage = true): GlobalVariablesAdapter&MockInterface
|
||||
{
|
||||
$variables = Mockery::mock(GlobalVariablesAdapter::class);
|
||||
$variables->allows('refresh');
|
||||
$variables->allows('canManage')->andReturn($manage);
|
||||
$variables->allows('read')->andReturnUsing(static function () use (&$stored): array {
|
||||
return $stored;
|
||||
|
||||
Reference in New Issue
Block a user