You are here

function SkinrContextUIBasicTestCase::testGroupAdd in Skinr 8.2

Same name and namespace in other branches
  1. 7.2 skinr_context/tests/skinr_context_ui.test \SkinrContextUIBasicTestCase::testGroupAdd()

Tests adding a group to an element.

File

skinr_context/tests/skinr_context_ui.test, line 116
Tests for the Skinr UI module.

Class

SkinrContextUIBasicTestCase
Tests UI functionality.

Code

function testGroupAdd() {
  $this
    ->drupalGet('');
  $this
    ->clickLink(t('Edit skin'), 0);

  // Verify that we end up on the expected URL.
  $front = variable_get('site_frontpage', 'node');
  $this
    ->assertUrl('admin/structure/skinr/edit/block/system__user-menu/configure', array(
    'query' => array(
      'destination' => $front,
    ),
  ));

  // Make sure the add group link is present.
  $this
    ->assertLink('Add group', 0, 'Add group link is present.');

  // Click on the 'Add group' link.
  $this
    ->clickLink(t('Add group'), 0);

  // Verify that we end up on the expected URL to configure skins for our group.
  $this
    ->assertUrl('admin/structure/skinr/edit/block/system__user-menu/add', array(
    'query' => array(
      'destination' => 'admin/structure/skinr/edit/block/system__user-menu/configure?destination=' . $front,
    ),
  ));

  // Post the form.
  $edit = array(
    'title' => 'SkinrContextGroupTest',
    'gid' => 'skinrcontextgrouptest',
  );
  $this
    ->drupalPost(NULL, $edit, t('Add group'));

  // Verify that we were redirected back to the originating page.
  $this
    ->assertUrl('admin/structure/skinr/edit/block/system__user-menu/configure', array(
    'query' => array(
      'destination' => $front,
    ),
  ));

  // Verify that the new group is added.
  $this
    ->assertText('SkinrContextGroupTest', 'Successfully added a skin settings group.');
}