You are here

public function CommandHelperTest::testClearIndexCommand in Search API 8

Tests the clear index command.

@covers ::clearIndexCommand

File

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

Class

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

Namespace

Drupal\Tests\search_api\Kernel\System

Code

public function testClearIndexCommand() {

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