function GroupUITestCase::setUp in Field Group 7.2
Same name and namespace in other branches
- 7 tests/field_group.ui.test \GroupUITestCase::setUp()
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()
File
- ./
field_group.test, line 35 - Unit test file for groups.
Class
- GroupUITestCase
- Group UI tests.
Code
function setUp() {
parent::setUp('field_test', 'field_group');
// Create test user.
$admin_user = $this
->drupalCreateUser(array(
'administer content types',
'administer nodes',
'access administration pages',
'bypass node access',
));
$this
->drupalLogin($admin_user);
// Create random group name.
$this->group_label = $this
->randomName(8);
$this->group_name_input = drupal_strtolower($this
->randomName(8));
$this->group_name = 'group_' . $this->group_name_input;
// Create a fieldgroup.
$field_group = new stdClass();
$field_group->disabled = FALSE;
/* Edit this to true to make a default field_group disabled initially */
$field_group->api_version = 1;
$field_group->identifier = 'wrapper|node|article|form';
$field_group->group_name = 'wrapper';
$field_group->entity_type = 'node';
$field_group->bundle = 'article';
$field_group->mode = 'form';
$field_group->parent_name = '';
$field_group->data = array(
'label' => 'Wrapper',
'weight' => '1',
'children' => array(
0 => 'field_image',
),
'format_type' => 'div',
'format_settings' => array(
'label' => 'Link',
'instance_settings' => array(
'required_fields' => 0,
'id' => 'wrapper-id',
'classes' => '',
'description' => '',
'show_label' => '0',
'label_element' => 'h3',
'effect' => 'none',
'speed' => 'fast',
),
'formatter' => 'open',
),
);
drupal_write_record('field_group', $field_group);
ctools_export_crud_enable('field_group', $field_group->identifier);
}