function StaticDiscoveryDecoratorTest::providerGetDefinition

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

Class

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

Namespace

Drupal\Tests\Component\Plugin\Discovery

Code

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

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