You are here

function GroupUITestCase::deleteGroup in Field Group 7

Same name and namespace in other branches
  1. 7.2 field_group.test \GroupUITestCase::deleteGroup()

Delete a group.

1 call to GroupUITestCase::deleteGroup()
GroupUITestCase::testCRUDGroup in tests/field_group.ui.test
General CRUD.

File

tests/field_group.ui.test, line 66
Test file for fieldgroup UI.

Class

GroupUITestCase
Group UI tests.

Code

function deleteGroup() {
  $this
    ->drupalPost('admin/structure/types/manage/article/groups/' . $this->group_name . '/delete/form', array(), t('Delete'));
  $this
    ->assertRaw(t('The group %label has been deleted from the %article content type.', array(
    '%label' => $this->group_label,
    '%article' => 'Article',
  )), t('Group removal message displayed on screen.'));

  // Test that group is not in the $groups array.
  $groups = field_group_info_groups('node', 'article', 'form', TRUE);
  $this
    ->assertFalse(array_key_exists($this->group_name, $groups), t('Group not found in groups array while deleting'));
  $this
    ->drupalPost('admin/structure/types/manage/article/groups/' . $this->group_name . '/delete/default', array(), t('Delete'));
  $this
    ->assertRaw(t('The group %label has been deleted from the %article content type.', array(
    '%label' => $this->group_label,
    '%article' => 'Article',
  )), t('Group removal message displayed on screen.'));

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