function QuickEditLoadingTest::setUp

Same name in this branch
  1. 8.9.x core/modules/quickedit/tests/src/Kernel/QuickEditLoadingTest.php \Drupal\Tests\quickedit\Kernel\QuickEditLoadingTest::setUp()
Same name in other branches
  1. 9 core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php \Drupal\Tests\quickedit\FunctionalJavascript\QuickEditLoadingTest::setUp()
  2. 9 core/modules/quickedit/tests/src/Kernel/QuickEditLoadingTest.php \Drupal\Tests\quickedit\Kernel\QuickEditLoadingTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php, line 73

Class

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

Namespace

Drupal\Tests\quickedit\FunctionalJavascript

Code

protected function setUp() {
    parent::setUp();
    // Create a text format.
    $filtered_html_format = FilterFormat::create([
        'format' => 'filtered_html',
        'name' => 'Filtered HTML',
        'weight' => 0,
        'filters' => [],
    ]);
    $filtered_html_format->save();
    // Create a node type.
    $this->drupalCreateContentType([
        'type' => 'article',
        'name' => 'Article',
    ]);
    // Set the node type to initially not have revisions.
    // Testing with revisions will be done later.
    $node_type = NodeType::load('article');
    $node_type->setNewRevision(FALSE);
    $node_type->save();
    // Create one node of the above node type using the above text format.
    $this->testNode = $this->drupalCreateNode([
        'type' => 'article',
        'body' => [
            0 => [
                '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 = [
        '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, [
        'access in-place editing',
    ]));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.