function SkinrUIAdminTestCase::testSkinImportExport in Skinr 7.2
Same name and namespace in other branches
- 8.2 skinr_ui/src/Tests/skinr_ui.test \SkinrUIAdminTestCase::testSkinImportExport()
Tests skin configuration import and export forms.
File
- tests/
skinr_ui.test, line 462 - Tests for the Skinr UI module.
Class
- SkinrUIAdminTestCase
- Tests administrative pages functionality.
Code
function testSkinImportExport() {
$this
->drupalGet('admin/structure/skinr/import');
$uuid1 = '16daa322-5ac0-49e4-cda2-809a13bb965b';
$uuid2 = '7384adb8-50a8-67d4-2dcd-5acda9b5c76e';
$edit = array(
'skinr_skins' => "\$skin = new stdClass();\n\$skin->status = TRUE; /* Edit this to false to make a default skin disabled initially */\n\$skin->api_version = " . SKINR_VERSION . ";\n\$skin->uuid = '" . $uuid1 . "';\n\$skin->theme = 'bartik';\n\$skin->module = 'block';\n\$skin->element = 'system__main';\n\$skin->skin = 'skinr_test_example';\n\$skin->options = array(\n 'option1' => 'option1',\n);\n\$skins['" . $uuid1 . "'] = \$skin;\n\n\$skin = new stdClass();\n\$skin->status = TRUE; /* Edit this to false to make a default skin disabled initially */\n\$skin->api_version = " . SKINR_VERSION . ";\n\$skin->uuid = '" . $uuid2 . "';\n\$skin->theme = 'bartik';\n\$skin->module = 'block';\n\$skin->element = 'system__user-menu';\n\$skin->skin = 'skinr_test_subtheme';\n\$skin->options = array(\n 'option1' => 'option1',\n 'option2' => 'option2',\n);\n\$skins['" . $uuid2 . "'] = \$skin;\n",
);
$this
->drupalPost(NULL, $edit, t('Import'));
// Now check if the imported skin configurations exist.
$skin1 = skinr_skin_load_by_uuid($uuid1);
$skin2 = skinr_skin_load_by_uuid($uuid2);
$this
->assertTrue(isset($skin1->uuid) && $skin1->uuid == $uuid1 && isset($skin2->uuid) && $skin2->uuid == $uuid2, 'Successfully imported skin configurations.');
// Test export.
$this
->drupalGet('admin/structure/skinr/export');
$this
->drupalPost(NULL, array(
'theme' => 'bartik',
), t('Export'));
$this
->assertFieldByName('skinr_skins', $edit['skinr_skins'], 'Export value is correct.');
}