function NodeCreationTest::testNodeAddPageOrder

Same name in other branches
  1. 9 core/modules/node/tests/src/Functional/NodeCreationTest.php \Drupal\Tests\node\Functional\NodeCreationTest::testNodeAddPageOrder()
  2. 10 core/modules/node/tests/src/Functional/NodeCreationTest.php \Drupal\Tests\node\Functional\NodeCreationTest::testNodeAddPageOrder()

Tests the order of the node types on the add page.

File

core/modules/node/tests/src/Functional/NodeCreationTest.php, line 56

Class

NodeCreationTest
Create a node and test saving it.

Namespace

Drupal\Tests\node\Functional

Code

public function testNodeAddPageOrder() : void {
    $this->createContentType([
        'type' => 'bundle_1',
        'name' => 'Bundle 1',
    ]);
    $this->createContentType([
        'type' => 'bundle_2',
        'name' => 'Aaa Bundle 2',
    ]);
    $admin_content_types = $this->drupalCreateUser([
        'bypass node access',
    ]);
    $this->drupalLogin($admin_content_types);
    $this->drupalGet('node/add');
    $this->assertSession()
        ->pageTextMatches('/Aaa Bundle 2(.*)Bundle 1/');
}

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