function CKEditorLoadingTest::setUp

Sets up a Drupal site for running functional and integration tests.

Generates a random database prefix and installs Drupal with the specified installation profile in Drupal\simpletest\WebTestBase::$profile into the prefixed database. Afterwards, installs any additional modules specified by the test.

After installation all caches are flushed and several configuration values are reset to the values of the parent site executing the test, since the default values may be incompatible with the environment in which tests are being executed.

Parameters

...: List of modules to enable for the duration of the test. This can be either a single array or a variable number of string arguments.

Overrides WebTestBase::setUp

See also

Drupal\simpletest\WebTestBase::prepareDatabasePrefix()

Drupal\simpletest\WebTestBase::changeDatabasePrefix()

Drupal\simpletest\WebTestBase::prepareEnvironment()

File

drupal/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorLoadingTest.php, line 32
Definition of \Drupal\ckeditor\Tests\CKEditorLoadingTest.

Class

CKEditorLoadingTest
Tests loading of CKEditor.

Namespace

Drupal\ckeditor\Tests

Code

function setUp() {
  parent::setUp();

  // Create text format, associate CKEditor.
  $filtered_html_format = entity_create('filter_format', array(
    'format' => 'filtered_html',
    'name' => 'Filtered HTML',
    'weight' => 0,
    'filters' => array(),
  ));
  $filtered_html_format
    ->save();
  $editor = entity_create('editor', array(
    'format' => 'filtered_html',
    'editor' => 'ckeditor',
  ));
  $editor
    ->save();

  // Create a second format without an associated editor so a drop down select
  // list is created when selecting formats.
  $full_html_format = entity_create('filter_format', array(
    'format' => 'full_html',
    'name' => 'Full HTML',
    'weight' => 1,
    'filters' => array(),
  ));
  $full_html_format
    ->save();

  // Create node type.
  $this
    ->drupalCreateContentType(array(
    'type' => 'article',
    'name' => 'Article',
  ));

  // Create 2 users, each with access to different text formats:
  //   - "untrusted": plain_text
  //   - "normal": plain_text, filtered_html
  $this->untrusted_user = $this
    ->drupalCreateUser(array(
    'create article content',
    'edit any article content',
  ));
  $this->normal_user = $this
    ->drupalCreateUser(array(
    'create article content',
    'edit any article content',
    'use text format filtered_html',
    'use text format full_html',
  ));
}