You are here

protected function SearchPageTest::IndexationContent in Opigno Search 8

Same name and namespace in other branches
  1. 3.x tests/src/Functional/SearchPageTest.php \Drupal\Tests\opigno_learning_path\Functional\SearchPageTest::IndexationContent()

Tests creating an indexation content.

1 call to SearchPageTest::IndexationContent()
SearchPageTest::testSearchPageContent in tests/src/Functional/SearchPageTest.php
Tests search.

File

tests/src/Functional/SearchPageTest.php, line 79

Class

SearchPageTest
Tests for Search process.

Namespace

Drupal\Tests\opigno_learning_path\Functional

Code

protected function IndexationContent() {

  // Create few trainings.
  for ($i = 0; $i < 5; $i++) {
    $training = $this
      ->createGroup([
      'label' => $this->key . ' ' . $this
        ->randomMachineName(),
      'field_learning_path_visibility' => 'public',
      'field_learning_path_published' => TRUE,
    ]);
    $this
      ->assertNotEmpty($training);
  }

  // Reindex content;
  $index = Index::load('default_index');
  $this
    ->assertNotEmpty($index);
  if (!empty($index)) {
    $index
      ->indexItems();
  }

  // Check if all items indexed.
  $this
    ->drupalGet('admin/config/search/search-api/index/default_index');
  $this
    ->assertSession()
    ->pageTextContains('100%');
}