protected function BlockTestBase::setUp in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/block/src/Tests/BlockTestBase.php \Drupal\block\Tests\BlockTestBase::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
1 call to BlockTestBase::setUp()
- BlockSystemBrandingTest::setUp in core/
modules/ block/ src/ Tests/ BlockSystemBrandingTest.php - Sets up a Drupal site for running functional and integration tests.
1 method overrides BlockTestBase::setUp()
- BlockSystemBrandingTest::setUp in core/
modules/ block/ src/ Tests/ BlockSystemBrandingTest.php - Sets up a Drupal site for running functional and integration tests.
File
- core/
modules/ block/ src/ Tests/ BlockTestBase.php, line 38 - Contains \Drupal\block\Tests\BlockTestBase.
Class
- BlockTestBase
- Provides setup and helper methods for block module tests.
Namespace
Drupal\block\TestsCode
protected function setUp() {
parent::setUp();
// Use the test page as the front page.
$this
->config('system.site')
->set('page.front', '/test-page')
->save();
// Create Full HTML text format.
$full_html_format = entity_create('filter_format', array(
'format' => 'full_html',
'name' => 'Full HTML',
));
$full_html_format
->save();
// Create and log in an administrative user having access to the Full HTML
// text format.
$this->adminUser = $this
->drupalCreateUser(array(
'administer blocks',
$full_html_format
->getPermissionName(),
'access administration pages',
));
$this
->drupalLogin($this->adminUser);
// Define the existing regions.
$this->regions = array(
'header',
'sidebar_first',
'content',
'sidebar_second',
'footer',
);
$block_storage = $this->container
->get('entity.manager')
->getStorage('block');
$blocks = $block_storage
->loadByProperties(array(
'theme' => $this
->config('system.theme')
->get('default'),
));
foreach ($blocks as $block) {
$block
->delete();
}
}