You are here

function SkinrUIBasicTestCase::testSkinAdditionalEdit in Skinr 7.2

Same name and namespace in other branches
  1. 8.2 skinr_ui/src/Tests/skinr_ui.test \SkinrUIBasicTestCase::testSkinAdditionalEdit()

Tests access control for editing additional CSS classes.

File

tests/skinr_ui.test, line 172
Tests for the Skinr UI module.

Class

SkinrUIBasicTestCase
Tests UI functionality.

Code

function testSkinAdditionalEdit() {

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

  // Verify that the skin has been applied.
  $this
    ->drupalGet('');
  $this
    ->assertSkinrClass('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/structure/skinr/edit/block/system__user-menu/configure');
  $this
    ->assertNoFieldByName('skinr_settings[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
    ->assertSkinrClass('block-system-user-menu', 'additional', 'Additional CSS class <em>additional</em> of configured skin option found.');
}