function StyleSerializerTest::setUp

Same name in this branch
  1. 9 core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php \Drupal\Tests\rest\Functional\Views\StyleSerializerTest::setUp()
Same name in other branches
  1. 8.9.x core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php \Drupal\Tests\rest\Functional\Views\StyleSerializerTest::setUp()
  2. 10 core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php \Drupal\Tests\rest\Functional\Views\StyleSerializerTest::setUp()
  3. 11.x core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php \Drupal\Tests\rest\Functional\Views\StyleSerializerTest::setUp()

Overrides ViewTestBase::setUp

File

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

Class

StyleSerializerTest
Tests the serializer style plugin.

Namespace

Drupal\Tests\hal\Functional\rest\Views

Code

protected function setUp($import_test_views = TRUE, $modules = [
    'hal_test_views',
]) : void {
    parent::setUp($import_test_views, $modules);
    $this->adminUser = $this->drupalCreateUser([
        '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();
}

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