InspectionTest.php in Drupal 10
File
core/tests/Drupal/KernelTests/Core/Plugin/InspectionTest.php
View source
<?php
namespace Drupal\KernelTests\Core\Plugin;
class InspectionTest extends PluginTestBase {
protected static $modules = [
'node',
'user',
];
public function testInspection() {
foreach ([
'user_login',
] as $id) {
$plugin = $this->testPluginManager
->createInstance($id);
$expected_definition = $this->testPluginExpectedDefinitions[$id];
$this
->assertSame($id, $plugin
->getPluginId());
$this
->assertSame($expected_definition, $this->testPluginManager
->getDefinition($id));
$this
->assertSame($expected_definition, $plugin
->getPluginDefinition());
}
foreach ([
'user_login',
'layout',
] as $id) {
$plugin = $this->mockBlockManager
->createInstance($id);
$expected_definition = $this->mockBlockExpectedDefinitions[$id];
$this
->assertSame($id, $plugin
->getPluginId());
$this
->assertEquals($expected_definition, $this->mockBlockManager
->getDefinition($id));
$this
->assertEquals($expected_definition, $plugin
->getPluginDefinition());
}
foreach ([
'test_block1',
'test_block2',
] as $id) {
$plugin = $this->defaultsTestPluginManager
->createInstance($id);
$expected_definition = $this->defaultsTestPluginExpectedDefinitions[$id];
$this
->assertSame($id, $plugin
->getPluginId());
$this
->assertSame($expected_definition, $this->defaultsTestPluginManager
->getDefinition($id));
$this
->assertEquals($expected_definition, $plugin
->getPluginDefinition());
}
}
}
Classes
Name |
Description |
InspectionTest |
Tests that plugins implementing PluginInspectionInterface are inspectable. |