You are here

public function DefaultPluginManagerTest::providerTestProcessDefinition in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php \Drupal\Tests\Core\Plugin\DefaultPluginManagerTest::providerTestProcessDefinition()

File

core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php, line 413

Class

DefaultPluginManagerTest
Tests the DefaultPluginManager.

Namespace

Drupal\Tests\Core\Plugin

Code

public function providerTestProcessDefinition() {
  $data = [];
  $data['merge'][] = [
    'foo' => [
      'bar' => [
        'asdf',
      ],
    ],
  ];
  $data['merge'][] = [
    'foo' => [
      'bar' => [
        'baz',
        'asdf',
      ],
    ],
  ];
  $object_definition = (object) [
    'foo' => [
      'bar' => [
        'asdf',
      ],
    ],
  ];
  $data['object_definition'] = [
    $object_definition,
    clone $object_definition,
  ];
  $data['no_form'][] = [
    'class' => TestPluginForm::class,
  ];
  $data['no_form'][] = [
    'class' => TestPluginForm::class,
    'foo' => [
      'bar' => [
        'baz',
      ],
    ],
  ];
  $data['default_form'][] = [
    'class' => TestPluginForm::class,
    'forms' => [
      'configure' => 'stdClass',
    ],
  ];
  $data['default_form'][] = [
    'class' => TestPluginForm::class,
    'forms' => [
      'configure' => 'stdClass',
    ],
    'foo' => [
      'bar' => [
        'baz',
      ],
    ],
  ];
  $data['class_with_slashes'][] = [
    'class' => '\\Drupal\\Tests\\Core\\Plugin\\TestPluginForm',
  ];
  $data['class_with_slashes'][] = [
    'class' => 'Drupal\\Tests\\Core\\Plugin\\TestPluginForm',
    'foo' => [
      'bar' => [
        'baz',
      ],
    ],
  ];
  $data['object_with_class_with_slashes'][] = (new PluginDefinition())
    ->setClass('\\Drupal\\Tests\\Core\\Plugin\\TestPluginForm');
  $data['object_with_class_with_slashes'][] = (new PluginDefinition())
    ->setClass('Drupal\\Tests\\Core\\Plugin\\TestPluginForm');
  return $data;
}