You are here

public function TaskTest::testTaskSuccess in Search API 8

Tests successful task execution.

File

tests/src/Kernel/System/TaskTest.php, line 98

Class

TaskTest
Tests whether the Search API task system works correctly.

Namespace

Drupal\Tests\search_api\Kernel\System

Code

public function testTaskSuccess() {
  $task = $this
    ->addTask('success');
  $this
    ->assertEquals(1, $this->taskManager
    ->getTasksCount());
  $this->taskManager
    ->executeSingleTask();
  $this
    ->assertEquals(0, $this->taskManager
    ->getTasksCount());
  $this
    ->assertEquals($task
    ->toArray(), $this->taskWorker
    ->getEventLog()[0]);
}