You are here

protected function EntityReferenceSettingsTest::setUp in Drupal 10

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

Overrides KernelTestBase::setUp

File

core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceSettingsTest.php, line 67

Class

EntityReferenceSettingsTest
Tests entity reference field settings.

Namespace

Drupal\Tests\field\Kernel\EntityReference

Code

protected function setUp() : void {
  parent::setUp();
  $this
    ->installEntitySchema('node');
  $this
    ->installEntitySchema('taxonomy_term');
  $this
    ->installEntitySchema('entity_test');
  $this->nodeType = NodeType::create([
    'type' => mb_strtolower($this
      ->randomMachineName()),
    'name' => $this
      ->randomString(),
  ]);
  $this->nodeType
    ->save();

  // Create a custom bundle.
  $this->customBundle = 'test_bundle_' . mb_strtolower($this
    ->randomMachineName());
  entity_test_create_bundle($this->customBundle, NULL, 'entity_test');

  // Prepare the logger for collecting the expected critical error.
  $this->container
    ->get($this->testLogServiceName)
    ->cleanLogs();
}