You are here

function FusionApplyUIAdminTestCase::testSkinDefaultStatus in Fusion Accelerator 7

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

Tests default status of skins.

The fusion_apply_test_basetheme skin defined by the fusion_apply_test_basetheme theme specifies a default status for itself. Its subtheme should inherit the status of the basetheme.

@todo Add assertions for 'default status' itself.

File

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

Class

FusionApplyUIAdminTestCase
Tests administrative pages functionality.

Code

function testSkinDefaultStatus() {

  // Verify that the skin appears on the skin overview page.
  $this
    ->drupalGet('admin/appearance/fusion/skins');
  $this
    ->assertLinkByHref('admin/appearance/fusion/skins/settings/fusion_apply_test_basetheme');
  $this
    ->drupalGet('admin/appearance/fusion/skins/settings/fusion_apply_test_basetheme');

  // Verify that it is enabled for the fusion_apply_test_subtheme, and disabled for
  // Bartik and Garland by default.
  // @todo - temporarily disabling these tests.  They apply to the "enabled" checkboxes which are currently not functional.

  //$this->assertFieldChecked('edit-status-fusion_apply-test-subtheme', 'fusion_apply_test_basetheme skin is enabled for fusion_apply_test_subtheme.');

  //$this->assertNoFieldChecked('edit-status-bartik', 'fusion_apply_test_basetheme skin is disabled for Bartik.');

  //$this->assertNoFieldChecked('edit-status-garland', 'fusion_apply_test_basetheme skin is disabled for Garland.');

  // Override the status for fusion_apply_test_subtheme and Bartik, then verify them.
  $skin = (object) array(
    'theme' => 'fusion_apply_test_subtheme',
    'module' => 'block',
    'element' => 'system-user-menu',
    'skin' => 'fusion_apply_test_subtheme',
    'options' => array(
      'option1',
      'option2',
    ),
    'status' => 1,
  );
  fusion_apply_skin_save($skin);
  $skin = fusion_apply_skin_load($skin->sid);

  // Override the default skin.
  $skin->element = 'system-main';
  $this
    ->drupalGet('admin/appearance/fusion');
  $this
    ->clickLink(t('disable'), 0);

  // Unaltered skin configuration object should have been saved with only the status updated.
  // Load an uncached version of the skin configuration object.
  $skin = fusion_apply_skin_load_unchanged($skin->sid);
  $this
    ->assertFalse($skin->status, 'Status was disabled successfully.');
  $this
    ->assertEqual($skin->element, 'system-user-menu', 'Only status was updated, even though the object was modified before updating status.');

  // Enable the skin configuration.
  $this
    ->drupalGet('admin/appearance/fusion');
  $this
    ->clickLink(t('enable'), 0);

  // Load an uncached version of the skin configuration object.
  $skin = fusion_apply_skin_load_unchanged($skin->sid);
  $this
    ->assertTrue($skin->status, 'Status was enabled successfully.');
}