You are here

public function ReflectionFactoryTest::providerGetInstanceArguments in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php \Drupal\Tests\Component\Plugin\Factory\ReflectionFactoryTest::providerGetInstanceArguments()

Data provider for testGetInstanceArguments.

The classes used here are defined at the bottom of this file.

Return value

array

  • Expected output.
  • Class to reflect for input to getInstanceArguments().
  • $plugin_id parameter to getInstanceArguments().
  • $plugin_definition parameter to getInstanceArguments().
  • $configuration parameter to getInstanceArguments().

File

core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php, line 33
Contains \Drupal\Tests\Component\Plugin\Factory\ReflectionFactoryTest.

Class

ReflectionFactoryTest
@group Plugin @coversDefaultClass \Drupal\Component\Plugin\Factory\ReflectionFactory

Namespace

Drupal\Tests\Component\Plugin\Factory

Code

public function providerGetInstanceArguments() {
  return [
    [
      [
        'arguments_plugin_id',
      ],
      'Drupal\\Tests\\Component\\Plugin\\Factory\\ArgumentsPluginId',
      'arguments_plugin_id',
      [
        'arguments_plugin_id' => [
          'class' => 'Drupal\\Tests\\Component\\Plugin\\Factory\\ArgumentsPluginId',
        ],
      ],
      [],
    ],
    [
      [
        [],
        [
          'arguments_many' => [
            'class' => 'Drupal\\Tests\\Component\\Plugin\\Factory\\ArgumentsMany',
          ],
        ],
        'arguments_many',
        'default_value',
        'what_default',
      ],
      'Drupal\\Tests\\Component\\Plugin\\Factory\\ArgumentsMany',
      'arguments_many',
      [
        'arguments_many' => [
          'class' => 'Drupal\\Tests\\Component\\Plugin\\Factory\\ArgumentsMany',
        ],
      ],
      [],
    ],
    [
      // Config array key exists and is set.
      [
        'thing',
      ],
      'Drupal\\Tests\\Component\\Plugin\\Factory\\ArgumentsConfigArrayKey',
      'arguments_config_array_key',
      [
        'arguments_config_array_key' => [
          'class' => 'Drupal\\Tests\\Component\\Plugin\\Factory\\ArgumentsConfigArrayKey',
        ],
      ],
      [
        'config_name' => 'thing',
      ],
    ],
    [
      // Config array key exists and is not set.
      [
        NULL,
      ],
      'Drupal\\Tests\\Component\\Plugin\\Factory\\ArgumentsConfigArrayKey',
      'arguments_config_array_key',
      [
        'arguments_config_array_key' => [
          'class' => 'Drupal\\Tests\\Component\\Plugin\\Factory\\ArgumentsConfigArrayKey',
        ],
      ],
      [
        'config_name' => NULL,
      ],
    ],
    [
      // Touch the else clause at the end of the method.
      [
        NULL,
        NULL,
        NULL,
        NULL,
      ],
      'Drupal\\Tests\\Component\\Plugin\\Factory\\ArgumentsAllNull',
      'arguments_all_null',
      [
        'arguments_all_null' => [
          'class' => 'Drupal\\Tests\\Component\\Plugin\\Factory\\ArgumentsAllNull',
        ],
      ],
      [],
    ],
    [
      // A plugin with no constructor.
      [
        NULL,
        NULL,
        NULL,
        NULL,
      ],
      'Drupal\\Tests\\Component\\Plugin\\Factory\\ArgumentsNoConstructor',
      'arguments_no_constructor',
      [
        'arguments_no_constructor' => [
          'class' => 'Drupal\\Tests\\Component\\Plugin\\Factory\\ArgumentsNoConstructor',
        ],
      ],
      [],
    ],
  ];
}