public function TaskTest::testTaskUnknown in Search API 8
Tests unknown task execution.
File
- tests/
src/ Kernel/ System/ TaskTest.php, line 150
Class
- TaskTest
- Tests whether the Search API task system works correctly.
Namespace
Drupal\Tests\search_api\Kernel\SystemCode
public function testTaskUnknown() {
$task = $this
->addTask('unknown');
$this
->assertEquals(1, $this->taskManager
->getTasksCount());
try {
$this->taskManager
->executeAllTasks();
$this
->fail('Exception expected');
} catch (SearchApiException $e) {
$id = $task
->id();
$type = $task
->getType();
$this
->assertEquals("Could not execute task #{$id} of type '{$type}'. Type seems to be unknown.", $e
->getMessage());
}
$this
->assertEquals(1, $this->taskManager
->getTasksCount());
$this
->assertEquals([], $this->taskWorker
->getEventLog());
}