function EditLoadingTest::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/edit/lib/Drupal/edit/Tests/EditLoadingTest.php, line 35
Contains \Drupal\edit\Tests\EditLoadingTest.

Class

EditLoadingTest
Tests loading of Edit and lazy-loading of in-place editors.

Namespace

Drupal\edit\Tests

Code

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

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

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

  // Create one node of the above node type using the above text format.
  $this
    ->drupalCreateNode(array(
    'type' => 'article',
    'body' => array(
      0 => array(
        'value' => '<p>How are you?</p>',
        'format' => 'filtered_html',
      ),
    ),
  ));

  // Create 2 users, the only difference being the ability to use in-place
  // editing
  $basic_permissions = array(
    'access content',
    'create article content',
    'edit any article content',
    'use text format filtered_html',
    'access contextual links',
  );
  $this->author_user = $this
    ->drupalCreateUser($basic_permissions);
  $this->editor_user = $this
    ->drupalCreateUser(array_merge($basic_permissions, array(
    'access in-place editing',
  )));
}