function CategorizingPluginManagerTraitTest::testProcessDefinitionCategory
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Plugin/CategorizingPluginManagerTraitTest.php \Drupal\Tests\Core\Plugin\CategorizingPluginManagerTraitTest::testProcessDefinitionCategory()
- 8.9.x core/tests/Drupal/Tests/Core/Plugin/CategorizingPluginManagerTraitTest.php \Drupal\Tests\Core\Plugin\CategorizingPluginManagerTraitTest::testProcessDefinitionCategory()
- 11.x core/tests/Drupal/Tests/Core/Plugin/CategorizingPluginManagerTraitTest.php \Drupal\Tests\Core\Plugin\CategorizingPluginManagerTraitTest::testProcessDefinitionCategory()
@covers ::processDefinitionCategory
File
-
core/
tests/ Drupal/ Tests/ Core/ Plugin/ CategorizingPluginManagerTraitTest.php, line 83
Class
- CategorizingPluginManagerTraitTest
- @coversDefaultClass \Drupal\Core\Plugin\CategorizingPluginManagerTrait @group Plugin @runTestsInSeparateProcesses
Namespace
Drupal\Tests\Core\PluginCode
public function testProcessDefinitionCategory() : void {
// Existing category.
$definition = [
'label' => 'some',
'provider' => 'core',
'category' => 'bag',
];
$this->pluginManager
->processDefinition($definition, 'some');
$this->assertSame('bag', $definition['category']);
// No category, provider without label.
$definition = [
'label' => 'some',
'provider' => 'core',
];
$this->pluginManager
->processDefinition($definition, 'some');
$this->assertSame('core', $definition['category']);
// No category, provider is module with label.
$definition = [
'label' => 'some',
'provider' => 'node',
];
$this->pluginManager
->processDefinition($definition, 'some');
$this->assertSame('Node', $definition['category']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.