You are here

protected function PrettyPathsFunctionalTest::ensureSearchResults in Facets Pretty Paths 8

Ensures that there is test content indexed and ready to be used.

2 calls to PrettyPathsFunctionalTest::ensureSearchResults()
PrettyPathsFunctionalTest::testPrettyPathsCoder in tests/src/Functional/PrettyPathsFunctionalTest.php
Tests that the coder plugins get called properly when generating the URLs.
PrettyPathsFunctionalTest::testPrettyPathsUrlProcessor in tests/src/Functional/PrettyPathsFunctionalTest.php
Tests the Facets Pretty Paths URL preprocessor..

File

tests/src/Functional/PrettyPathsFunctionalTest.php, line 140

Class

PrettyPathsFunctionalTest
Main functional test for the Pretty Paths URL processor.

Namespace

Drupal\Tests\facets_pretty_paths\Functional

Code

protected function ensureSearchResults() {
  $this->container
    ->get('entity_type.manager')
    ->getStorage('node')
    ->create([
    'type' => 'article',
    'title' => 'My article title',
  ])
    ->save();
  $this->container
    ->get('entity_type.manager')
    ->getStorage('node')
    ->create([
    'type' => 'page',
    'title' => 'My page title',
  ])
    ->save();

  /** @var \Drupal\search_api\IndexInterface $index */
  $index = $this->container
    ->get('entity_type.manager')
    ->getStorage('search_api_index')
    ->load('node');
  $index
    ->indexItems();

  // Clear the caches for the new route of the Views to be regenerated.
  $this
    ->rebuildAll();
}