function ExampleFunctionalTest::setUp

Same name in other branches
  1. 4.0.x modules/testing_example/tests/src/Functional/ExampleFunctionalTest.php \Drupal\Tests\testing_example\Functional\ExampleFunctionalTest::setUp()

The setUp() method is run before every other test method, so commonalities should go here.

Overrides ExamplesBrowserTestBase::setUp

File

modules/testing_example/tests/src/Functional/ExampleFunctionalTest.php, line 52

Class

ExampleFunctionalTest
Class ExampleFunctionalTest.

Namespace

Drupal\Tests\testing_example\Functional

Code

protected function setUp() : void {
    parent::setUp();
    // We have to create a content type because testing uses the 'testing'
    // profile, which has no content types by default.
    // Although we could have visited admin pages and pushed buttons to create
    // the content type, there happens to be function we can use in this case.
    $this->createContentType([
        'type' => 'test_content_type',
    ]);
    // Create users.
    $this->adminUser = $this->drupalCreateUser([
        'access administration pages',
        'view the administration theme',
        'administer permissions',
        'administer nodes',
        'administer content types',
        'create test_content_type content',
    ]);
    $this->authUser = $this->drupalCreateUser([], 'authuser');
}