function AutowireBlockTest::testAutowireBlock

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/KernelTests/Core/Block/AutowireBlockTest.php \Drupal\KernelTests\Core\Block\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\Block

Code

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.