You are here

protected function TaxonomyEntityIndexUuidArgumentTest::setUp in Taxonomy Entity Index 8

Overrides TaxonomyEntityIndexTestBase::setUp

File

tests/src/Functional/Views/TaxonomyEntityIndexUuidArgumentTest.php, line 75

Class

TaxonomyEntityIndexUuidArgumentTest
Test whether it is possible to select terms using a UUID argument.

Namespace

Drupal\Tests\taxonomy_entity_index\Functional\Views

Code

protected function setUp($import_test_views = TRUE) {
  parent::setUp($import_test_views);

  // Configure the eponymous Taxonomy Entity Index.
  $config = $this
    ->config('taxonomy_entity_index.settings');
  $config
    ->set('types.node', 'node');
  $config
    ->set('index_revisions', FALSE);
  $config
    ->set('index_per_field', FALSE);
  $config
    ->save();

  // Create a term with a pre-defined UUID; and a node tagged with that term.
  $firstUuid = '0d82a97e-2688-4e8f-a913-72c9d0abbc5c';
  $this->uuids[0] = $firstUuid;
  $firstTerm = $this
    ->createTerm([
    'name' => 'First',
    'uuid' => $firstUuid,
  ]);
  $this->terms[0] = $firstTerm;

  // Create a node tagged with only the first term.
  $settings = [
    'type' => 'article',
  ];
  $settings['field_views_testing_tags'][0]['target_id'] = $firstTerm
    ->id();
  $this->thisTestNodes[0] = $this
    ->drupalCreateNode($settings);
  taxonomy_entity_index_entity_update($this->thisTestNodes[0]);

  // Load the view configuration fixture we will use to test.
  $this->view = Views::getView('test_argument_taxonomy_entity_index_uuid');
}