function EditorTestBase::setUp in Editor 7
Sets up a Drupal site for running functional and integration tests.
Generates a random database prefix and installs Drupal with the specified installation profile in DrupalWebTestCase::$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.
Overrides DrupalWebTestCase::setUp
See also
DrupalWebTestCase::prepareDatabasePrefix()
DrupalWebTestCase::changeDatabasePrefix()
DrupalWebTestCase::prepareEnvironment()
2 calls to EditorTestBase::setUp()
- EditorFileUsageTest::setUp in ./
editor.test - Sets up a Drupal site for running functional and integration tests.
- EditorTestCase::setUp in ./
editor.test - Sets up a Drupal site for running functional and integration tests.
2 methods override EditorTestBase::setUp()
- EditorFileUsageTest::setUp in ./
editor.test - Sets up a Drupal site for running functional and integration tests.
- EditorTestCase::setUp in ./
editor.test - Sets up a Drupal site for running functional and integration tests.
File
- ./
editor.test, line 904 - Tests for Editor module.
Class
- EditorTestBase
- Base test class for editors.
Code
function setUp() {
$modules = func_get_args();
if (isset($modules[0]) && is_array($modules[0])) {
$modules = $modules[0];
}
$modules[] = 'editor';
$modules[] = 'node';
parent::setUp($modules);
// Create a page content type.
$content_type = $this
->drupalCreateContentType(array(
'type' => 'page',
'name' => 'Basic page',
));
node_add_body_field($content_type);
// Create an article content type.
$content_type = $this
->drupalCreateContentType(array(
'type' => 'article',
'name' => 'Article',
));
node_add_body_field($content_type);
// Create Filtered HTML text format.
$format = new stdClass();
$format->format = 'custom_format';
$format->name = 'Custom format';
filter_format_save($format);
// Reset permissions so that permissions for the filter are available.
$this
->checkPermissions(array(), TRUE);
// Create a user with required permissions.
$this->webUser = $this
->drupalCreateUser(array(
'access content',
'create page content',
'use text format custom_format',
));
// Create and log in as the admin user.
$this->admin_user = $this
->drupalCreateUser(array(
'administer filters',
'access administration pages',
'access content',
'administer nodes',
'create article content',
));
}