function SkinrUIBasicTestCase::testSkinEditWidgets in Skinr 7.2
Same name and namespace in other branches
- 8.2 skinr_ui/src/Tests/skinr_ui.test \SkinrUIBasicTestCase::testSkinEditWidgets()
Tests output of widgets on the skin configuration form.
File
- tests/
skinr_ui.test, line 203 - Tests for the Skinr UI module.
Class
- SkinrUIBasicTestCase
- Tests UI functionality.
Code
function testSkinEditWidgets() {
// Go to the edit page for system__user_menu block.
$this
->drupalGet('admin/structure/skinr/library');
$this
->drupalGet('admin/structure/skinr/edit/block/system__user-menu/configure');
// Check for output from empty groups.
$this
->assertNoRaw('id="edit-skinr-settings-block-group-bartik-box"', 'Resulting empty group is not displayed.');
// Check the widgets.
$this
->assertFieldByName('skinr_settings[bartik][groups][general][skinr_ui_test_bgcolor]', NULL, 'Widget with valid type is displayed.');
$this
->assertNoFieldByName('skinr_settings[bartik][groups][box][skinr_ui_test_border]', NULL, 'Widget with invalid type is not displayed.');
// Custom widget with form callback.
$this
->assertFieldByName('skinr_settings[bartik][groups][general][skinr_ui_test_custom][custom]', NULL, 'Widget with form callback is displayed.');
$this
->assertNoFieldChecked('edit-skinr-settings-bartik-groups-general-skinr-ui-test-custom-custom', 'Value for custom widget empty.');
// Now make sure default values work for custom widgets.
$skin = (object) array(
'theme' => 'bartik',
'module' => 'block',
'element' => 'system__user-menu',
'skin' => 'skinr_ui_test_custom',
'options' => array(
'custom',
),
'status' => 1,
);
skinr_skin_save($skin);
$this
->drupalGet('admin/structure/skinr/edit/block/system__user-menu/configure');
$this
->assertFieldChecked('edit-skinr-settings-bartik-groups-general-skinr-ui-test-custom-custom', 'Value for custom widget set.');
}