You are here

protected function ExcludedFieldTokenTest::setUp in Drupal 10

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

Overrides ViewTestBase::setUp

File

core/modules/rest/tests/src/Functional/Views/ExcludedFieldTokenTest.php, line 50

Class

ExcludedFieldTokenTest
Tests the display of an excluded field that is used as a token.

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);

  // Create some test content.
  for ($i = 1; $i <= 10; $i++) {
    Node::create([
      'type' => 'article',
      'title' => 'Article test ' . $i,
    ])
      ->save();
  }
  $this
    ->enableViewsTestModule();
  $this->view = Views::getView('test_excluded_field_token_display');
  $this->view
    ->setDisplay('rest_export_1');
}