public function BlockPageVariantTest::setUpDisplayVariant in Zircon Profile 8
Same name and namespace in other branches
- 8.0 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|\PHPUnit_Framework_MockObject_MockObject A mocked 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 52 - Contains \Drupal\Tests\block\Unit\Plugin\DisplayVariant\BlockPageVariantTest.
Class
- BlockPageVariantTest
- @coversDefaultClass \Drupal\block\Plugin\DisplayVariant\BlockPageVariant @group block
Namespace
Drupal\Tests\block\Unit\Plugin\DisplayVariantCode
public function setUpDisplayVariant($configuration = array(), $definition = array()) {
$container = new Container();
$cache_context_manager = $this
->getMockBuilder('Drupal\\Core\\Cache\\CacheContextsManager')
->disableOriginalConstructor()
->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
->getMock('Drupal\\block\\BlockRepositoryInterface');
$this->blockViewBuilder = $this
->getMock('Drupal\\Core\\Entity\\EntityViewBuilderInterface');
return $this
->getMockBuilder('Drupal\\block\\Plugin\\DisplayVariant\\BlockPageVariant')
->setConstructorArgs(array(
$configuration,
'test',
$definition,
$this->blockRepository,
$this->blockViewBuilder,
[
'config:block_list',
],
))
->setMethods(array(
'getRegionNames',
))
->getMock();
}