function WhosOnlineBlockTest::setUp
Same name in other branches
- 8.9.x core/modules/user/tests/src/Kernel/WhosOnlineBlockTest.php \Drupal\Tests\user\Kernel\WhosOnlineBlockTest::setUp()
Overrides KernelTestBase::setUp
File
-
core/
modules/ user/ tests/ src/ Kernel/ WhosOnlineBlockTest.php, line 45
Class
- WhosOnlineBlockTest
- Tests the Who's Online Block.
Namespace
Drupal\Tests\user\KernelCode
protected function setUp() : void {
parent::setUp();
$this->installConfig([
'system',
'block',
'views',
'user',
]);
$this->installSchema('system', [
'sequences',
]);
$this->installEntitySchema('user');
$this->controller = $this->container
->get('entity_type.manager')
->getStorage('block');
// Create a block with only required values.
$this->block = $this->controller
->create([
'plugin' => 'views_block:who_s_online-who_s_online_block',
'region' => 'sidebar_first',
'id' => 'views_block__who_s_online_who_s_online_block',
'theme' => \Drupal::configFactory()->get('system.theme')
->get('default'),
'label' => "Who's online",
'visibility' => [],
'weight' => 0,
]);
$this->block
->save();
$this->container
->get('cache.render')
->deleteAll();
$this->renderer = $this->container
->get('renderer');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.