function ViewsBlockTest::testBuildEmpty
Same name in other branches
- 9 core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php \Drupal\Tests\views\Unit\Plugin\Block\ViewsBlockTest::testBuildEmpty()
- 8.9.x core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php \Drupal\Tests\views\Unit\Plugin\Block\ViewsBlockTest::testBuildEmpty()
- 11.x core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php \Drupal\Tests\views\Unit\Plugin\Block\ViewsBlockTest::testBuildEmpty()
Tests the build method.
@covers ::build
File
-
core/
modules/ views/ tests/ src/ Unit/ Plugin/ Block/ ViewsBlockTest.php, line 163
Class
- ViewsBlockTest
- @coversDefaultClass \Drupal\views\Plugin\block\ViewsBlock @group views
Namespace
Drupal\Tests\views\Unit\Plugin\BlockCode
public function testBuildEmpty() : void {
$build = [
'view_build' => [],
'#view_id' => 'test_view',
'#view_display_plugin_class' => '\\Drupal\\views\\Plugin\\views\\display\\Block',
'#view_display_show_admin_links' => FALSE,
'#view_display_plugin_id' => 'block',
'#pre_rendered' => TRUE,
'#cache' => [
'contexts' => [
'user',
],
],
];
$this->executable
->expects($this->once())
->method('buildRenderable')
->with('block_1', [])
->willReturn($build);
$block_id = 'views_block:test_view-block_1';
$config = [];
$definition = [];
$definition['provider'] = 'views';
$plugin = new ViewsBlock($config, $block_id, $definition, $this->executableFactory, $this->storage, $this->account);
$this->assertEquals(array_intersect_key($build, [
'#cache' => TRUE,
]), $plugin->build());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.