1 filter_js_settings.test | public FilterSettingsAttachedTestCase::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/ filter/ tests/ filter_js_settings.test, line 17 - Functional tests for the Filter module.
Class
- FilterSettingsAttachedTestCase
- Test functionality specific to Filter module's attach behavior.
Code
public function setUp() {
parent::setUp(array(
'filter',
'ckeditor5',
));
// Create additional format with an editor.
$basic_format = array(
'format' => 'basic',
'name' => 'Basic',
'weight' => 0,
'editor' => 'ckeditor5',
'editor_settings' => array(
'toolbar' => array('bold'),
'image_upload' => array('status' => 0),
),
'filters' => array(
'filter_html' => array('weight' => 1, 'status' => 1),
),
'roles' => array(
'authenticated' => 'authenticated',
),
);
$basic_format = (object) $basic_format;
filter_format_save($basic_format);
// Create custom content type.
$this->backdropCreateContentType(array('type' => 'page', 'name' => 'Page'));
// Attach additional text field, which uses filter formats, but only
// text_plain (which has no settings).
$field_name = 'field_content';
$field = array(
'type' => 'text_long',
'field_name' => $field_name,
'cardinality' => 1,
);
field_create_field($field);
$instance = array(
'field_name' => $field_name,
'entity_type' => 'node',
'label' => 'Content',
'bundle' => 'page',
'settings' => array(
'text_processing' => 1,
'allowed_formats' => array('text_plain'),
),
);
field_create_instance($instance);
// Create account and log in.
$basic_permission_name = filter_permission_name($basic_format);
$web_user = $this->backdropCreateUser(array(
'access content',
'create page content',
$basic_permission_name,
));
$this->backdropLogin($web_user);
return TRUE;
}