You are here

public function CommandHelperTest::testStatusCommand in Search API 8

Tests the "Index status" command.

@covers ::indexStatusCommand

File

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

Class

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

Namespace

Drupal\Tests\search_api\Kernel\System

Code

public function testStatusCommand() {
  $results = $this->systemUnderTest
    ->indexStatusCommand();
  $this
    ->assertIsArray($results);
  $this
    ->assertCount(2, $results);
  $this
    ->assertArrayHasKey('test_index', $results);
  $this
    ->assertArrayHasKey('id', $results['test_index']);
  $this
    ->assertArrayHasKey('name', $results['test_index']);
  $this
    ->assertSame('test_index', $results['test_index']['id']);
  $this
    ->assertSame('Test Index', $results['test_index']['name']);
  $this
    ->assertSame('second_index', $results['second_index']['id']);
  $this
    ->assertSame('Secondary index.', $results['second_index']['name']);
  $this
    ->assertSame(5, $results['test_index']['total']);
  $this
    ->assertSame(5, $results['test_index']['indexed']);
  $this
    ->assertSame('100%', $results['test_index']['complete']);
}