function StyleSerializerEntityTest::setUp

Same name in other branches
  1. 10 core/modules/rest/tests/src/Functional/Views/StyleSerializerEntityTest.php \Drupal\Tests\rest\Functional\Views\StyleSerializerEntityTest::setUp()

Overrides ViewTestBase::setUp

File

core/modules/rest/tests/src/Functional/Views/StyleSerializerEntityTest.php, line 77

Class

StyleSerializerEntityTest
Tests the serializer style plugin.

Namespace

Drupal\Tests\rest\Functional\Views

Code

protected function setUp($import_test_views = TRUE, $modules = [
    'rest_test_views',
]) : void {
    parent::setUp($import_test_views, $modules);
    $this->adminUser = $this->drupalCreateUser([
        'administer views',
        'administer entity_test content',
        'access user profiles',
        'view test entity',
    ]);
    // Save some entity_test entities.
    for ($i = 1; $i <= 10; $i++) {
        EntityTest::create([
            'name' => 'test_' . $i,
            'user_id' => $this->adminUser
                ->id(),
        ])
            ->save();
    }
    $this->enableViewsTestModule();
    $this->renderer = \Drupal::service('renderer');
}

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