You are here

public function SkinrContextDisplayTestCase::testSkinrContextDisplayed in Skinr 8.2

Same name and namespace in other branches
  1. 7.2 skinr_context/tests/skinr_context.test \SkinrContextDisplayTestCase::testSkinrContextDisplayed()

File

skinr_context/tests/skinr_context.test, line 325
Tests for the Skinr Context module.

Class

SkinrContextDisplayTestCase
Tests API functionality.

Code

public function testSkinrContextDisplayed() {

  // Save a group.
  $group = (object) array(
    'gid' => 'block:system__main:default',
    'module' => 'block',
    'element' => 'system__main',
    'title' => 'Default',
    'description' => '',
    'conditions' => array(
      'path' => array(
        'values' => array(
          '<front>' => '<front>',
        ),
      ),
    ),
    'condition_mode' => CONTEXT_CONDITION_MODE_OR,
    'weight' => 0,
    'status' => 1,
  );
  $this
    ->assertTrue(skinr_context_group_save($group), 'Skin settings group object saved.');

  // Save a skin configuration object.
  $skin = (object) array(
    'module' => 'block',
    'element' => 'system__main',
    'gid' => $group->gid,
    'theme' => 'bartik',
    'skin' => 'skinr_test_font',
    'options' => array(
      'font_1',
    ),
    'status' => 1,
  );
  $this
    ->assertTrue(skinr_skin_save($skin), 'Skin configuration object was saved.');

  // Go to the front page.
  $this
    ->drupalGet('');
  $this
    ->assertSkinrClass('block-system-main', 'font-1', 'CSS class of configured skin option found.');

  // Check another page to make sure it only appears on the front page.
  $this
    ->drupalGet('user');
  $this
    ->assertNoSkinrClass('block-system-main', 'font-1', 'CSS class of configured skin option not found on other pages.');

  // @todo Check for group B overriding group A.
}