You are here

public function FormOverridesTest::providerConfigEntityOverrides in Configuration Override Warn 8

Data provider for testing config entity overrides.

Return value

array An array of test cases.

File

tests/src/Kernel/FormOverridesTest.php, line 199

Class

FormOverridesTest
Tests module overrides of configuration using event subscribers.

Namespace

Drupal\Tests\config_override_warn\Kernel

Code

public function providerConfigEntityOverrides() {
  return [
    // Test with show_values turned on.
    [
      [
        'config_override_warn.settings' => [
          'show_values' => TRUE,
        ],
      ],
      BlockForm::class,
      'block',
      'call_to_action',
      [
        'block.block.call_to_action' => [
          'settings' => [
            'original' => var_export([
              'label' => 'Shop for cheap now!',
            ], TRUE),
            'override' => var_export([
              'label' => 'Draw yer cutlasses!',
            ], TRUE),
          ],
        ],
      ],
      TRUE,
    ],
    // Test the same as above but with a value that is not overridden.
    [
      [
        'block.block.call_to_action' => [
          'settings.label' => 'Draw yer cutlasses!',
        ],
        'config_override_warn.settings' => [
          'show_values' => TRUE,
        ],
      ],
      BlockForm::class,
      'block',
      'call_to_action',
      [],
      TRUE,
    ],
    // Test with show_values turned off (default).
    [
      [],
      BlockForm::class,
      'block',
      'call_to_action',
      [
        'block.block.call_to_action' => [
          'settings' => NULL,
        ],
      ],
      TRUE,
    ],
    // Test with no overrides.
    [
      [],
      BlockForm::class,
      'block',
      'call_to_action',
      [],
      FALSE,
    ],
  ];
}