You are here

protected function NewResultsCheckTest::setUp in Search API Saved Searches 8

Overrides KernelTestBase::setUp

File

tests/src/Kernel/NewResultsCheckTest.php, line 50

Class

NewResultsCheckTest
Tests the functionality of "new results" checks.

Namespace

Drupal\Tests\search_api_saved_searches\Kernel

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('search_api_task');
  $this
    ->installEntitySchema('search_api_saved_search');
  $this
    ->installEntitySchema('entity_test_mulrev_changed');
  $this
    ->installSchema('search_api', [
    'search_api_item',
  ]);
  $this
    ->installSchema('search_api_saved_searches', [
    'search_api_saved_searches_old_results',
  ]);
  $this
    ->installConfig([
    'search_api',
    'search_api_test_db',
    'search_api_saved_searches',
  ]);

  // Report all log messages as errors.
  $logger = new TestLogger('');
  $this->container
    ->set('logger.factory', $logger);
  $this->container
    ->set('logger.channel.search_api', $logger);
  $this->container
    ->set('logger.channel.search_api_saved_searches', $logger);

  // Add anonymous user for having a saved search owner.
  User::create([
    'uid' => 0,
    'name' => '',
  ])
    ->save();
  $this
    ->setUpExampleStructure();
  $this
    ->insertExampleContent();
  $this->index = Index::load('database_search_index');
  $this->index
    ->indexItems();
}