You are here

public function ShareMessageExtraFieldTest::setUp in Share Message 8

@inheritdoc

Overrides ShareMessageTestBase::setUp

File

tests/src/Functional/ShareMessageExtraFieldTest.php, line 55

Class

ShareMessageExtraFieldTest
Tests the Share Message extra field functionality through the admin UI.

Namespace

Drupal\Tests\sharemessage\Functional

Code

public function setUp() {
  parent::setUp();

  // Setup vocabulary and terms.
  Vocabulary::create([
    'vid' => 'tags',
    'name' => 'Tags',
  ])
    ->save();
  $term = Term::create([
    'vid' => 'tags',
    'name' => 'term0',
  ]);
  $term
    ->save();
  $this->terms[0] = $term;
  $term = Term::create([
    'vid' => 'tags',
    'name' => 'term1',
  ]);
  $term
    ->save();
  $this->terms[1] = $term;

  // Extra field entity types are filtered based on whether they have view
  // displays. Explicitly save one for user and terms here.
  \Drupal::service('entity_display.repository')
    ->getViewDisplay('user', 'user')
    ->save();
  \Drupal::service('entity_display.repository')
    ->getViewDisplay('taxonomy_term', 'tags')
    ->save();
}