class ComponentPluginManagerTest
Same name in this branch
- 11.x core/modules/sdc/tests/src/Kernel/ComponentPluginManagerTest.php \Drupal\Tests\sdc\Kernel\ComponentPluginManagerTest
- 11.x core/tests/Drupal/Tests/Core/Theme/Component/ComponentPluginManagerTest.php \Drupal\Tests\Core\Theme\Component\ComponentPluginManagerTest
Same name in other branches
- 10 core/modules/sdc/tests/src/Kernel/ComponentPluginManagerTest.php \Drupal\Tests\sdc\Kernel\ComponentPluginManagerTest
- 10 core/tests/Drupal/Tests/Core/Theme/Component/ComponentPluginManagerTest.php \Drupal\Tests\Core\Theme\Component\ComponentPluginManagerTest
Tests the component plugin manager.
@group sdc
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \PHPUnit\Framework\TestCase implements \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\PhpUnitCompatibilityTrait, \Prophecy\PhpUnit\ProphecyTrait, \Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait
- class \Drupal\KernelTests\Components\ComponentKernelTestBase extends \Drupal\KernelTests\KernelTestBase
- class \Drupal\KernelTests\Components\ComponentPluginManagerTest extends \Drupal\KernelTests\Components\ComponentKernelTestBase
- class \Drupal\KernelTests\Components\ComponentKernelTestBase extends \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of ComponentPluginManagerTest
File
-
core/
tests/ Drupal/ KernelTests/ Components/ ComponentPluginManagerTest.php, line 14
Namespace
Drupal\KernelTests\ComponentsView source
class ComponentPluginManagerTest extends ComponentKernelTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'system',
'sdc_test',
'sdc_test_replacements',
];
/**
* {@inheritdoc}
*/
protected static $themes = [
'sdc_theme_test',
];
/**
* Test that components render correctly.
*/
public function testFindEmptyMetadataFile() : void {
// Test that empty component metadata files are valid, since there is no
// required property.
$this->assertNotEmpty($this->manager
->find('sdc_theme_test:bar'));
// Test that if the folder name does not match the machine name, the
// component is still available.
$this->assertNotEmpty($this->manager
->find('sdc_theme_test:foo'));
}
/**
* Test that the machine name is grabbed from the *.component.yml.
*
* And not from the enclosing directory.
*/
public function testMismatchingFolderName() : void {
$this->expectException(ComponentNotFoundException::class);
$this->manager
->find('sdc_theme_test:mismatching-folder-name');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.