Test cron runs.
function testCronRun() {
global $base_url;
// Run cron anonymously without any cron key.
$this
->drupalGet('cron');
$this
->assertResponse(404);
// Run cron anonymously with a random cron key.
$key = $this
->randomName(16);
$this
->drupalGet('cron/' . $key);
$this
->assertResponse(403);
// Run cron anonymously with the valid cron key.
$key = state()
->get('system.cron_key');
$this
->drupalGet('cron/' . $key);
$this
->assertResponse(204);
}