function BlockPageVariantTest::setUpDisplayVariant
Same name in other branches
- 9 core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php \Drupal\Tests\block\Unit\Plugin\DisplayVariant\BlockPageVariantTest::setUpDisplayVariant()
- 8.9.x core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php \Drupal\Tests\block\Unit\Plugin\DisplayVariant\BlockPageVariantTest::setUpDisplayVariant()
- 10 core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php \Drupal\Tests\block\Unit\Plugin\DisplayVariant\BlockPageVariantTest::setUpDisplayVariant()
Sets up a display variant plugin for testing.
Parameters
array $configuration: An array of plugin configuration.
array $definition: The plugin definition array.
Return value
\Drupal\block\Plugin\DisplayVariant\BlockPageVariant A test display variant plugin.
2 calls to BlockPageVariantTest::setUpDisplayVariant()
- BlockPageVariantTest::testBuild in core/
modules/ block/ tests/ src/ Unit/ Plugin/ DisplayVariant/ BlockPageVariantTest.php - Tests the building of a full page variant.
- BlockPageVariantTest::testBuildWithoutMainContent in core/
modules/ block/ tests/ src/ Unit/ Plugin/ DisplayVariant/ BlockPageVariantTest.php - Tests the building of a full page variant with no main content set.
File
-
core/
modules/ block/ tests/ src/ Unit/ Plugin/ DisplayVariant/ BlockPageVariantTest.php, line 50
Class
- BlockPageVariantTest
- @coversDefaultClass \Drupal\block\Plugin\DisplayVariant\BlockPageVariant @group block
Namespace
Drupal\Tests\block\Unit\Plugin\DisplayVariantCode
public function setUpDisplayVariant($configuration = [], $definition = []) {
$container = new Container();
$cache_context_manager = $this->getMockBuilder('Drupal\\Core\\Cache\\Context\\CacheContextsManager')
->disableOriginalConstructor()
->onlyMethods([
'assertValidTokens',
])
->getMock();
$container->set('cache_contexts_manager', $cache_context_manager);
$cache_context_manager->expects($this->any())
->method('assertValidTokens')
->willReturn(TRUE);
\Drupal::setContainer($container);
$this->blockRepository = $this->createMock('Drupal\\block\\BlockRepositoryInterface');
$this->blockViewBuilder = $this->createMock('Drupal\\Core\\Entity\\EntityViewBuilderInterface');
return new BlockPageVariant($configuration, 'test', $definition, $this->blockRepository, $this->blockViewBuilder, [
'config:block_list',
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.