public function SkinrDisplayTestCase::testSkinrDisplayed in Skinr 7.2
File
- tests/
skinr.test, line 796 - Tests for the Skinr module.
Class
- SkinrDisplayTestCase
- Tests API functionality.
Code
public function testSkinrDisplayed() {
// Save a skin configuration object.
$skin = (object) array(
'theme' => 'bartik',
'module' => 'block',
'element' => 'system__user-menu',
'skin' => 'skinr_test_font',
'options' => array(
'font_1',
),
'status' => 1,
);
$this
->assertTrue(skinr_skin_save($skin), 'Skin configuration object was saved.');
$this
->verbose(print_r($skin, TRUE));
// Go to the front page.
variable_set('preprocess_css', 0);
$this
->drupalGet('');
$this
->assertSkinrClass('block-system-user-menu', 'font-1', 'CSS class of configured skin option found.');
$content = $this
->drupalGetContent();
$css = drupal_get_path('module', 'skinr_test') . '/skinr_test.css';
$this
->assertRaw($css, t('Stylesheet was included on page.'));
$js = drupal_get_path('module', 'skinr_test') . '/skinr_test.js';
$this
->assertRaw($js, t('Javascript was included on page.'));
$js = drupal_get_path('module', 'skinr_test') . '/skinr_test_advanced.css';
$this
->assertRaw($js, t('Javascript with advanced settings was included on page.'));
$js = drupal_get_path('module', 'skinr_test') . '/skinr_test_data.css';
$this
->assertRaw($js, t('Javascript with filename set in settings array was included on page.'));
// Now test with CSS aggregation on.
variable_set('preprocess_css', 1);
$this
->drupalGet('');
$css = drupal_get_path('module', 'skinr_test') . '/skinr_test.css';
$this
->assertRaw($css, t('Stylesheet was included on page while CSS aggregation is enabled.'));
// Reset state to default.
variable_set('preprocess_css', 0);
// Now test with JS aggregation on.
variable_set('preprocess_js', 1);
$this
->drupalGet('');
$js = drupal_get_path('module', 'skinr_test') . '/skinr_test.js';
$this
->assertRaw($js, t('Javascript was included on page JS aggregation is enabled.'));
// Reset state to default.
variable_set('preprocess_js', 0);
}