function SkinrApiTest::testSkinrImplementsCache in Skinr 8.2
Tests skinr_implements() caching and auto-loading.
File
- src/
Tests/ SkinrApiTest.php, line 138 - Contains \Drupal\skinr\Tests\SkinrApiTest.
Class
- SkinrApiTest
- Tests Skinr API functionality.
Namespace
Drupal\skinr\TestsCode
function testSkinrImplementsCache() {
\Drupal::service('module_installer')
->install(array(
'block',
));
$this
->resetAll();
// Enable main system block for content region and the user menu block for
// the first sidebar.
$default_theme = \Drupal::config('system.theme')
->get('default');
$this
->drupalPlaceBlock('system_main_block', array(
'region' => 'content',
));
$this
->drupalPlaceBlock('system_powered_by_block', array(
'region' => 'sidebar_first',
));
// 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 = Skin::create(array(
'theme' => $default_theme,
'element_type' => 'block',
'element' => 'bartik_powered',
'skin' => 'skinr_test_font',
'options' => array(
'font_1' => 'font_1',
),
'status' => 1,
));
$skin
->save();
// Verify the skin is contained in the output.
$this
->drupalGet('');
$this
->assertSkinrClass('block-system-powered-by-block', 'font-1', 'Skin found.');
// Once again, so we hit the cache.
$this
->drupalGet('');
$this
->assertSkinrClass('block-system-powered-by-block', '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.'));
}