function ViewsSaveProcessTest::setCallExpectations

Same name and namespace in other branches
  1. 11.x core/modules/views/tests/src/Kernel/ViewsSaveProcessTest.php \Drupal\Tests\views\Kernel\ViewsSaveProcessTest::setCallExpectations()

Sets call expectations for block cache and router rebuilding.

Parameters

int $blockCacheClearCalls: How many times the block cache should be cleared.

int $routerRebuildCalls: How many times the router rebuild should be called.

File

core/modules/views/tests/src/Kernel/ViewsSaveProcessTest.php, line 165

Class

ViewsSaveProcessTest
Tests saving views and clearing.

Namespace

Drupal\Tests\views\Kernel

Code

protected function setCallExpectations(int $blockCacheClearCalls, int $routerRebuildCalls) : void {
  $blockManager = $this->createMock(BlockManager::class);
  $blockManager->expects($this->exactly($blockCacheClearCalls))
    ->method('clearCachedDefinitions');
  $routerRebuilder = $this->createMock(RouteBuilderInterface::class);
  $routerRebuilder->expects($this->exactly($routerRebuildCalls))
    ->method('setRebuildNeeded');
  $this->container
    ->set('plugin.manager.block', $blockManager);
  $this->container
    ->set('router.builder', $routerRebuilder);
}

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