protected function BlockCacheTest::setUp in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/block/src/Tests/BlockCacheTest.php \Drupal\block\Tests\BlockCacheTest::setUp()
Sets up a Drupal site for running functional and integration tests.
Installs Drupal with the installation profile specified in \Drupal\simpletest\WebTestBase::$profile into the prefixed database.
Afterwards, installs any additional modules specified in the static \Drupal\simpletest\WebTestBase::$modules property of each class in the class hierarchy.
After installation all caches are flushed and several configuration values are reset to the values of the parent site executing the test, since the default values may be incompatible with the environment in which tests are being executed.
Overrides WebTestBase::setUp
File
- core/
modules/ block/ src/ Tests/ BlockCacheTest.php, line 55 - Contains \Drupal\block\Tests\BlockCacheTest.
Class
- BlockCacheTest
- Tests block caching.
Namespace
Drupal\block\TestsCode
protected function setUp() {
parent::setUp();
// Create an admin user, log in and enable test blocks.
$this->adminUser = $this
->drupalCreateUser(array(
'administer blocks',
'access administration pages',
));
$this
->drupalLogin($this->adminUser);
// Create additional users to test caching modes.
$this->normalUser = $this
->drupalCreateUser();
$this->normalUserAlt = $this
->drupalCreateUser();
// Sync the roles, since drupalCreateUser() creates separate roles for
// the same permission sets.
$this->normalUserAlt->roles = $this->normalUser
->getRoles();
$this->normalUserAlt
->save();
// Enable our test block.
$this->block = $this
->drupalPlaceBlock('test_cache');
}