You are here

protected function StyleSerializerTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php \Drupal\Tests\rest\Functional\Views\StyleSerializerTest::setUp()

Overrides ViewTestBase::setUp

File

core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php, line 75

Class

StyleSerializerTest
Tests the serializer style plugin.

Namespace

Drupal\Tests\rest\Functional\Views

Code

protected function setUp($import_test_views = TRUE) : void {
  parent::setUp($import_test_views);
  ViewTestData::createTestViews(static::class, [
    'rest_test_views',
  ]);
  $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');
}