You are here

public function CommandHelperTest::testIndexItemsToIndexCommand in Search API 8

Tests the indexItemsToIndexCommand.

@covers ::indexItemsToIndexCommand

File

tests/src/Kernel/System/CommandHelperTest.php, line 234

Class

CommandHelperTest
Tests Search API functionality that gets executed by console utilities.

Namespace

Drupal\Tests\search_api\Kernel\System

Code

public function testIndexItemsToIndexCommand() {

  /** @var \Drupal\search_api\IndexInterface $index */
  $index = Index::load('test_index');
  $this
    ->assertSame(5, $index
    ->getTrackerInstance()
    ->getIndexedItemsCount());
  $index
    ->clear();
  $this
    ->assertSame(0, $index
    ->getTrackerInstance()
    ->getIndexedItemsCount());
  $this->systemUnderTest
    ->indexItemsToIndexCommand([
    'test_index',
  ], 10, 10);
  $this
    ->runBatch();
  $this
    ->assertSame(5, $index
    ->getTrackerInstance()
    ->getIndexedItemsCount());
}