You are here

public function PluginBaseTest::providerTestSetOptionDefault in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/tests/src/Unit/PluginBaseTest.php \Drupal\Tests\views\Unit\PluginBaseTest::providerTestSetOptionDefault()

Data provider for testSetOptionDefault().

Return value

array

File

core/modules/views/tests/src/Unit/PluginBaseTest.php, line 232
Contains \Drupal\Tests\views\Unit\PluginBaseTest.

Class

PluginBaseTest
@coversDefaultClass \Drupal\views\Plugin\views\PluginBase @group views

Namespace

Drupal\Tests\views\Unit

Code

public function providerTestSetOptionDefault() {
  $test_parameters = array();

  // No definition should change anything on the storage.
  $test_parameters[] = array(
    'storage' => array(),
    'definition' => array(),
    'expected' => array(),
  );

  // Set a single definition, which should be picked up.
  $test_parameters[] = array(
    'storage' => array(),
    'definition' => array(
      'key' => array(
        'default' => 'value',
      ),
    ),
    'expected' => array(
      'key' => 'value',
    ),
  );

  // Set multiple keys, all should be picked up.
  $test_parameters[] = array(
    'storage' => array(),
    'definition' => array(
      'key' => array(
        'default' => 'value',
      ),
      'key2' => array(
        'default' => 'value2',
      ),
      'key3' => array(
        'default' => 'value3',
      ),
    ),
    'expected' => array(
      'key' => 'value',
      'key2' => 'value2',
      'key3' => 'value3',
    ),
  );

  // Setup a definition with multiple levels.
  $test_parameters[] = array(
    'storage' => array(),
    'definition' => array(
      'key' => array(
        'default' => 'value',
      ),
      'key2' => array(
        'contains' => array(
          'key2:1' => array(
            'default' => 'value2:1',
          ),
          'key2:2' => array(
            'default' => 'value2:2',
          ),
        ),
      ),
    ),
    'expected' => array(
      'key' => 'value',
      'key2' => array(
        'key2:1' => 'value2:1',
        'key2:2' => 'value2:2',
      ),
    ),
  );
  return $test_parameters;
}