function SkinrApiTestCase::testSkinrImplementsCache in Skinr 8.2
Tests skinr_implements() caching and auto-loading.
File
- src/
Tests/ skinr.test, line 276 - Tests for the Skinr module.
Class
- SkinrApiTestCase
- Tests API functionality.
Namespace
Drupal\tracker\TestsCode
function testSkinrImplementsCache() {
module_enable(array(
'block',
));
$this
->resetAll();
// Enable main system block for content region and the user menu block for
// the first sidebar.
$default_theme = variable_get('theme_default', 'bartik');
db_merge('block')
->key(array(
'theme' => $default_theme,
'module' => 'system',
'delta' => 'main',
))
->fields(array(
'status' => 1,
'region' => 'content',
'pages' => '',
))
->execute();
db_merge('block')
->key(array(
'theme' => $default_theme,
'module' => 'system',
'delta' => 'powered-by',
))
->fields(array(
'status' => 1,
'region' => 'sidebar_first',
'pages' => '',
))
->execute();
// Enable a skin defined in an include file, which applies to a module
// element that is equally registered in an include file (built-in Block
// module integration).
$skin = (object) array(
'theme' => $default_theme,
'module' => 'block',
'element' => 'system__powered-by',
'skin' => 'skinr_test_font',
'options' => array(
'font_1',
),
'status' => 1,
);
skinr_skin_save($skin);
// Verify the skin is contained in the output.
$this
->drupalGet('');
$this
->assertSkinrClass('block-system-powered-by', 'font-1', 'Skin found.');
// Once again, so we hit the cache.
$this
->drupalGet('');
$this
->assertSkinrClass('block-system-powered-by', 'font-1', 'Skin found.');
// Visit skin edit page after to test for groups, after hitting cache.
$this
->drupalGet('skinr-test/hook-dynamic-loading');
$this
->assertText('success!', t('$module.skinr.inc file auto-loaded.'));
}