You are here

function GroupUITestCase::createGroup in Field Group 7.2

Same name and namespace in other branches
  1. 7 tests/field_group.ui.test \GroupUITestCase::createGroup()

Creates a group on the article content type.

1 call to GroupUITestCase::createGroup()
GroupUITestCase::testCRUDGroup in ./field_group.test
General CRUD.

File

./field_group.test, line 86
Unit test file for groups.

Class

GroupUITestCase
Group UI tests.

Code

function createGroup() {

  // Setup new group.
  $group = array(
    'fields[_add_new_group][label]' => $this->group_label,
    'fields[_add_new_group][group_name]' => $this->group_name_input,
  );

  // Add new group on the 'Manage fields' page.
  $this
    ->drupalPost('admin/structure/types/manage/article/fields', $group, t('Save'));
  $this
    ->assertRaw(t('New group %label successfully created.', array(
    '%label' => $this->group_label,
  )), t('Group message displayed on screen.'));

  // Test if group is in the $groups array.
  $groups = field_group_info_groups('node', 'article', 'form', TRUE);
  $this
    ->assertTrue(array_key_exists($this->group_name, $groups), t('Group found in groups array'));

  // Add new group on the 'Manage display' page.
  $this
    ->drupalPost('admin/structure/types/manage/article/display', $group, t('Save'));
  $this
    ->assertRaw(t('New group %label successfully created.', array(
    '%label' => $this->group_label,
  )), t('Group message displayed on screen.'));

  // Test if group is in the $groups array.
  $groups = field_group_info_groups('node', 'article', 'default', TRUE);
  $this
    ->assertTrue(array_key_exists($this->group_name, $groups), t('Group found in groups array'));
}