function CronTest::testProcessQueues

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/CronTest.php \Drupal\Tests\Core\CronTest::testProcessQueues()
  2. 11.x core/tests/Drupal/Tests/Core/CronTest.php \Drupal\Tests\Core\CronTest::testProcessQueues()

Tests the ::processQueues() method.

@covers ::processQueues @dataProvider processQueuesTestData

File

core/tests/Drupal/Tests/Core/CronTest.php, line 195

Class

CronTest
Tests the Cron class.

Namespace

Drupal\Tests\Core

Code

public function testProcessQueues($item, $message_logged_assertion, $count_post_run) : void {
    $this->resetTestingState();
    $this->queue
        ->createItem($item);
    $this->assertFalse($this->state
        ->get('cron_test.message_logged'));
    $this->assertEquals(1, $this->queue
        ->numberOfItems());
    $this->cron
        ->run();
    $this->{$message_logged_assertion}($this->state
        ->get('cron_test.message_logged'));
    $this->assertEquals($count_post_run, $this->queue
        ->numberOfItems());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.