You are here

function sweaverAdministration::testCoreAdminSweaver in Sweaver 7

Same name and namespace in other branches
  1. 6 tests/sweaver.admin.test \sweaverAdministration::testCoreAdminSweaver()

Core administration tests for Sweaver.

File

tests/sweaver.admin.test, line 46
Tests for sweaver backend

Class

sweaverAdministration
@file Tests for sweaver backend

Code

function testCoreAdminSweaver() {
  $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/config/user-interface/sweaver', $edit, t('Save configuration'));
  $this
    ->drupalGet('user');
  $this
    ->assertNoRaw('sweaver-frontend', t('Editor disabled'), $editor_tests);
  $edit['sweaver_enabled'] = TRUE;
  $this
    ->drupalPost('admin/config/user-interface/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/config/user-interface/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/config/user-interface/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/config/user-interface/sweaver/editor/disable/property/background-color');
  $this
    ->drupalGet('user');
  $this
    ->assertNoRaw('id="background-color"', t('Background color disabled'), $editor_tests);
  $this
    ->drupalGet('admin/config/user-interface/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/config/user-interface/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/config/user-interface/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);
}