1 dashboard.test | DashboardTest::setUp() |
Sets up a Backdrop site for running functional and integration tests.
Generates a random database prefix and installs Backdrop with the specified installation profile in BackdropWebTestCase::$profile into the prefixed database. Afterwards, installs any additional modules specified by the test.
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.
Parameters
...: List of modules to enable for the duration of the test. This can be either a single array or a variable number of string arguments.
Return value
bool: TRUE if set up completes, FALSE if an error occurred.
Overrides BackdropWebTestCase::setUp
See also
BackdropWebTestCase::prepareDatabasePrefix()
BackdropWebTestCase::changeDatabasePrefix()
BackdropWebTestCase::prepareEnvironment()
File
- core/
modules/ dashboard/ tests/ dashboard.test, line 14 - Tests for dashboard.module.
Class
- DashboardTest
- Tests that the dashboard functions correctly.
Code
function setUp() {
parent::setUp(array('layout', 'layout_test', 'taxonomy', 'comment', 'node', 'dashboard', 'menu'));
$this->backdropCreateContentType(array(
'type' => 'test_content_type_1',
'name' => '<XSS>Test Content Type 1</XSS>',
));
$this->backdropCreateContentType(array(
'type' => 'test_content_type_2',
'name' => 'Test Content Type 2',
));
user_role_save((object) array(
'name' => 'test_user_role_1',
'label' => '<XSS>Test User Role 1</XSS>',
));
user_role_save((object) array(
'name' => 'test_user_role_2',
'label' => 'Test User Role 2',
));
$vocabulary1 = new TaxonomyVocabulary(array(
'machine_name' => 'test_vocabulary_1',
'name' => '<XSS>Test Vocabulary 1</XSS>',
));
$vocabulary1->save();
$vocabulary2 = new TaxonomyVocabulary(array(
'machine_name' => 'test_vocabulary_2',
'name' => 'Test Vocabulary 2',
));
$vocabulary2->save();
// Create some sample content.
$this->backdropCreateNode(array(
'type' => 'test_content_type_1',
));
$this->backdropCreateNode(array(
'type' => 'test_content_type_1',
));
$this->backdropCreateNode(array(
'type' => 'test_content_type_2',
));
// Create and login admin user.
$this->admin_user = $this->backdropCreateUser(array(
'access content',
'access dashboard',
'access administration pages',
'create test_content_type_1 content',
'create test_content_type_2 content',
'administer layouts',
'administer menu',
'administer content types',
'administer nodes',
'administer taxonomy',
'administer users',
'administer dashboard',
));
$this->backdropLogin($this->admin_user);
}