You are here

protected function OptionsTestBase::setUp in Drupal 10

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

Parameters

bool $import_test_views: Should the views specified on the test class be imported. If you need to setup some additional stuff, like fields, you need to call false and then call createTestViews for your own.

Overrides ViewsKernelTestBase::setUp

File

core/modules/options/tests/src/Kernel/Views/OptionsTestBase.php, line 51

Class

OptionsTestBase
Base class for options views tests.

Namespace

Drupal\Tests\options\Kernel\Views

Code

protected function setUp($import_test_views = TRUE) : void {
  parent::setUp();
  $this
    ->mockStandardInstall();
  ViewTestData::createTestViews(static::class, [
    'options_test_views',
  ]);
  $settings = [];
  $settings['type'] = 'article';
  $settings['title'] = $this
    ->randomString();
  $settings['field_test_list_string'][]['value'] = $this->fieldValues[0];
  $settings['field_test_list_integer'][]['value'] = 0;
  $node = Node::create($settings);
  $node
    ->save();
  $this->nodes[] = $node;
  $node = $node
    ->createDuplicate();
  $node
    ->save();
  $this->nodes[] = $node;
}