You are here

public function StaticDiscoveryDecoratorTest::providerGetDefinition in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php \Drupal\Tests\Component\Plugin\Discovery\StaticDiscoveryDecoratorTest::providerGetDefinition()

Data provider for testGetDefinitions().

Return value

array

  • Expected plugin definition.
  • Whether we require the method to register definitions through a callback.
  • Whether to throw an exception if the definition is invalid.
  • A plugin definition.
  • Base plugin ID.

File

core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php, line 50
Contains \Drupal\Tests\Component\Plugin\Discovery\StaticDiscoveryDecoratorTest.

Class

StaticDiscoveryDecoratorTest
@group Plugin @coversDefaultClass Drupal\Component\Plugin\Discovery\StaticDiscoveryDecorator

Namespace

Drupal\Tests\Component\Plugin\Discovery

Code

public function providerGetDefinition() {
  return [
    [
      'is_defined',
      TRUE,
      FALSE,
      [
        'plugin-definition' => 'is_defined',
      ],
      'plugin-definition',
    ],
    // Make sure we don't call the decorated method if we shouldn't.
    [
      'is_defined',
      FALSE,
      FALSE,
      [
        'plugin-definition' => 'is_defined',
      ],
      'plugin-definition',
    ],
    // Return NULL for bad plugin id.
    [
      NULL,
      FALSE,
      FALSE,
      [
        'plugin-definition' => 'is_defined',
      ],
      'BAD-plugin-definition',
    ],
    // Generate an exception.
    [
      NULL,
      FALSE,
      TRUE,
      [
        'plugin-definition' => 'is_defined',
      ],
      'BAD-plugin-definition',
    ],
  ];
}