function ReflectionFactoryTest::providerGetInstanceArguments

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php \Drupal\Tests\Component\Plugin\Factory\ReflectionFactoryTest::providerGetInstanceArguments()
  2. 8.9.x core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php \Drupal\Tests\Component\Plugin\Factory\ReflectionFactoryTest::providerGetInstanceArguments()
  3. 11.x 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 28

Class

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

Namespace

Drupal\Tests\Component\Plugin\Factory

Code

public static 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',
                ],
            ],
            [],
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.