function AutowireBlockTest::testAutowireBlock
Tests blocks with autowiring are created successfully.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Block/ AutowireBlockTest.php, line 29
Class
- AutowireBlockTest
- Tests that blocks can be autowired.
Namespace
Drupal\KernelTests\Core\BlockCode
public function testAutowireBlock() : void {
$block = \Drupal::service('plugin.manager.block')->createInstance('autowire');
$this->assertInstanceOf(AutowireBlock::class, $block);
$this->assertInstanceOf(LockBackendInterface::class, $block->getLock());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.