You are here

protected function QuickEditLoadingTest::setUp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/quickedit/src/Tests/QuickEditLoadingTest.php \Drupal\quickedit\Tests\QuickEditLoadingTest::setUp()

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

Installs Drupal with the installation profile specified in \Drupal\simpletest\WebTestBase::$profile into the prefixed database.

Afterwards, installs any additional modules specified in the static \Drupal\simpletest\WebTestBase::$modules property of each class in the class hierarchy.

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.

Overrides WebTestBase::setUp

File

core/modules/quickedit/src/Tests/QuickEditLoadingTest.php, line 56
Contains \Drupal\quickedit\Tests\QuickEditLoadingTest.

Class

QuickEditLoadingTest
Tests loading of in-place editing functionality and lazy loading of its in-place editors.

Namespace

Drupal\quickedit\Tests

Code

protected 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',
      ),
    ),
    'revision_log' => $this
      ->randomString(),
  ));

  // 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->authorUser = $this
    ->drupalCreateUser($basic_permissions);
  $this->editorUser = $this
    ->drupalCreateUser(array_merge($basic_permissions, array(
    'access in-place editing',
  )));
}