You are here

function FieldsetHelperTestCase::testFieldsetHelperAlterForm in Fieldset helper 6

Test fieldset helper alter form implementation.

File

./fieldset_helper.test, line 40

Class

FieldsetHelperTestCase

Code

function testFieldsetHelperAlterForm() {

  // Test $user is logged with the correct permissions.
  $this
    ->drupalGet('admin/settings/fieldset_helper/test');
  $this
    ->assertResponse(200);

  // Test generated fieldset ids
  $this
    ->assertRaw('id="fieldset-collapsible"', t('Find collapsible fieldset by id.'));
  $this
    ->assertRaw('id="fieldset-nested"', t('Find collapsible fieldset by id.'));
  $this
    ->assertRaw('id="fieldset-nested-collapsed"', t('Find collapsible fieldset by id.'));

  // Test auto exclude list by loading a few page with forms that do not contain fieldsets.
  $this
    ->drupalGet('admin/build/modules');
  $this
    ->drupalGet('admin/settings/site-maintenance');
  $this
    ->drupalGet('admin/user/settings');
  $auto_exclude = variable_get('fieldset_helper_auto_exclude', array());
  $this
    ->assertTrue(isset($auto_exclude['system-modules']), t('Check auto exclude list.'));
  $this
    ->assertTrue(isset($auto_exclude['system-site-maintenance-settings']), t('Check auto exclude list.'));
  $this
    ->assertFalse(isset($auto_exclude['user-admin-settings']), t('Check auto exclude list.'));
}