You are here

protected function FacetsTest::setUp in Select 2 8

Overrides BrowserTestBase::setUp

File

modules/select2_facets/tests/src/FunctionalJavascript/FacetsTest.php, line 30

Class

FacetsTest
Tests the select2 element.

Namespace

Drupal\Tests\select2_facets\FunctionalJavascript

Code

protected function setUp() {
  parent::setUp();
  $reference1 = EntityTestMulRevPub::create([
    'name' => 'Reference 1',
  ]);
  $reference1
    ->save();
  $reference2 = EntityTestMulRevPub::create([
    'name' => 'Reference 2',
  ]);
  $reference2
    ->save();
  $reference3 = EntityTestMulRevPub::create([
    'name' => 'Reference 3',
  ]);
  $reference3
    ->save();
  EntityTestMulRevPub::create([
    'name' => 'Entity 1',
    'field_references' => [
      $reference1,
      $reference2,
    ],
  ])
    ->save();
  EntityTestMulRevPub::create([
    'name' => 'Entity 2',
    'field_references' => [
      $reference1,
      $reference3,
    ],
  ])
    ->save();
  $account = $this
    ->createUser([
    'view test entity',
  ]);
  $this
    ->drupalLogin($account);

  // Index all entities.
  search_api_cron();
  $this
    ->drupalPlaceBlock('facet_block:referenced');
}