function sweaverAdministration::testCoreAdminSweaver in Sweaver 6
Same name and namespace in other branches
- 7 tests/sweaver.admin.test \sweaverAdministration::testCoreAdminSweaver()
Core administration tests for Sweaver.
File
- tests/
sweaver.admin.test, line 67 - Tests for sweaver backend Note: run this patch on D6 to allow posts to hidden fields: http://drupal.org/node/488810#comment-1693662.
Class
- sweaverAdministration
- @file Tests for sweaver backend Note: run this patch on D6 to allow posts to hidden fields: http://drupal.org/node/488810#comment-1693662.
Code
function testCoreAdminSweaver() {
$admin_user = $this
->drupalCreateUser(array(
'use editor',
'configure sweaver',
'administer nodes',
));
$this
->drupalLogin($admin_user);
$editor_tests = t('Basic admin testing');
// Setting screen: test that editor is enabled or disabled with checkbox and path settings.
$edit['sweaver_enabled'] = FALSE;
$this
->drupalPost('admin/settings/sweaver', $edit, t('Save configuration'));
$this
->drupalGet('user');
$this
->assertNoRaw('sweaver-frontend', t('Editor disabled'), $editor_tests);
$edit['sweaver_enabled'] = TRUE;
$this
->drupalPost('admin/settings/sweaver', $edit, t('Save configuration'));
$this
->drupalGet('user');
$this
->assertRaw('sweaver-frontend', t('Editor enabled'), $editor_tests);
$this
->drupalGet('node/add');
$this
->assertNoRaw('sweaver-frontend', t('Editor not set'), $editor_tests);
// Selectors enabled/disabled.
$this
->drupalGet('admin/settings/sweaver/editor/disable/selector/body');
$this
->drupalGet('user');
$status = strpos($this->content, '"description": "Body"') && strpos($this->content, '"description":"Body"');
$this
->assertFalse($status, t('Body selector disabled'), $editor_tests);
$this
->drupalGet('admin/settings/sweaver/editor/enable/selector/body');
$this
->drupalGet('user');
$status = strpos($this->content, '"description": "Body"') || strpos($this->content, '"description":"Body"');
$this
->assertTrue($status, t('Body selector enabled'), $editor_tests);
// Properties enabled/disabled.
$this
->drupalGet('admin/settings/sweaver/editor/disable/property/background-color');
$this
->drupalGet('user');
$this
->assertNoRaw('id="background-color"', t('Background color disabled'), $editor_tests);
$this
->drupalGet('admin/settings/sweaver/editor/enable/property/background-color');
$this
->drupalGet('user');
$this
->assertRaw('id="background-color"', t('Background color enabled'), $editor_tests);
// Types enabled/disabled.
$this
->drupalGet('admin/settings/sweaver/editor/disable/type/block');
$this
->drupalGet('user');
$status = strpos($this->content, '"types":{"block":') && strpos($this->content, '"types": { "block":');
$this
->assertFalse($status, t('Type block disabled'), $editor_tests);
$this
->drupalGet('admin/settings/sweaver/editor/enable/type/block');
$this
->drupalGet('user');
$status = strpos($this->content, '"types":{"block":') || strpos($this->content, '"types": { "block":');
$this
->assertTrue($status, t('Type block enabled'), $editor_tests);
}