You are here

function FusionApplyUIBasicTestCase::testSkinAdditionalEdit in Fusion Accelerator 7

Same name and namespace in other branches
  1. 7.2 fusion_apply/tests/fusion_apply_ui.test \FusionApplyUIBasicTestCase::testSkinAdditionalEdit()

Tests access control for editing additional CSS classes.

File

fusion_apply/tests/fusion_apply_ui.test, line 164
Tests for the Fusion Apply UI module.

Class

FusionApplyUIBasicTestCase
Tests UI functionality.

Code

function testSkinAdditionalEdit() {

  // Verify that we can apply additional CSS classes.
  $edit = array(
    'fusion_apply_settings[block_group][bartik][groups][_additional][_additional]' => 'additional',
  );
  $this
    ->drupalPost('admin/appearance/fusion/edit/nojs/block/system__user-menu/configure', $edit, t('Save'));

  // Verify that the skin has been applied.
  $this
    ->drupalGet('');
  $this
    ->assertFusionApplyClass('block-system-user-menu', 'additional', 'Additional CSS class <em>additional</em> of configured skin option found.');

  // Now let's check the same for a user that has no access to alter this.
  $user = $this
    ->drupalCreateUser(array(
    'edit skin settings',
  ));
  $this
    ->drupalLogin($user);

  // Verify that the additional CSS classes field is not enabled.
  $this
    ->drupalGet('admin/appearance/fusion/edit/nojs/block/system__user-menu/configure');
  $this
    ->assertNoFieldByName('fusion_apply_settings[block_group][bartik][groups][_additional][_additional]', NULL, 'Additional CSS classes field is not enabled for this user.');

  // Save form when additional CSS classes is not set.
  $edit = array();
  $this
    ->drupalPost(NULL, $edit, t('Save'));

  // Verify that the old class is still applied.
  $this
    ->drupalGet('');
  $this
    ->assertFusionApplyClass('block-system-user-menu', 'additional', 'Additional CSS class <em>additional</em> of configured skin option found.');
}