function BlockDependenciesTest::testViewsBlock

Same name in other branches
  1. 9 core/modules/views/tests/src/Kernel/Plugin/BlockDependenciesTest.php \Drupal\Tests\views\Kernel\Plugin\BlockDependenciesTest::testViewsBlock()
  2. 8.9.x core/modules/views/tests/src/Kernel/Plugin/BlockDependenciesTest.php \Drupal\Tests\views\Kernel\Plugin\BlockDependenciesTest::testViewsBlock()
  3. 10 core/modules/views/tests/src/Kernel/Plugin/BlockDependenciesTest.php \Drupal\Tests\views\Kernel\Plugin\BlockDependenciesTest::testViewsBlock()

Tests that exposed filter blocks have the correct dependencies.

See also

\Drupal\views\Plugin\Derivative\ViewsBlock::getDerivativeDefinitions()

File

core/modules/views/tests/src/Kernel/Plugin/BlockDependenciesTest.php, line 58

Class

BlockDependenciesTest
Tests views block config dependencies functionality.

Namespace

Drupal\Tests\views\Kernel\Plugin

Code

public function testViewsBlock() : void {
    $block = $this->createBlock('views_block:content_recent-block_1');
    $dependencies = $block->calculateDependencies()
        ->getDependencies();
    $expected = [
        'config' => [
            'views.view.content_recent',
        ],
        'module' => [
            'views',
        ],
        'theme' => [
            'stark',
        ],
    ];
    $this->assertSame($expected, $dependencies);
}

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