function ViewsBlockTest::testBuildFailed

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php \Drupal\Tests\views\Unit\Plugin\Block\ViewsBlockTest::testBuildFailed()
  2. 8.9.x core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php \Drupal\Tests\views\Unit\Plugin\Block\ViewsBlockTest::testBuildFailed()
  3. 10 core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php \Drupal\Tests\views\Unit\Plugin\Block\ViewsBlockTest::testBuildFailed()

Tests the build method with a failed execution.

See also

\Drupal\views\Plugin\block\ViewsBlock::build()

File

core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php, line 185

Class

ViewsBlockTest
@coversDefaultClass \Drupal\views\Plugin\block\ViewsBlock @group views

Namespace

Drupal\Tests\views\Unit\Plugin\Block

Code

public function testBuildFailed() : void {
    $output = FALSE;
    $this->executable
        ->expects($this->once())
        ->method('buildRenderable')
        ->with('block_1', [])
        ->willReturn($output);
    $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([], $plugin->build());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.