documentation in CronInterface is out of date and incomplete

Created on 8 February 2023, almost 2 years ago
Updated 9 May 2024, 7 months ago

Problem/Motivation

Docs in CronInterface say:

   * Do not call this function from a test. Use $this->cronRun() instead.

First, this is incomplete -- what is $this representing here? There is no cronRun() method on the interface.

It what is meant is \Drupal\Tests\Traits\Core\CronRunTrait -- that's the only place in core I can find a function with this name. The full name should be given in the docs.

Second, this is partially incorrect, or possibly predates the existence of Kernel tests, because the code of cronRun() is this:

    $this->drupalGet('cron/' . \Drupal::state()->get('system.cron_key'));

Unit and Kernel tests can't do browser requests with drupalGet().

So the docs are misleading, and should say that the function should be used in *browser* tests.

Third, I'm not clear why cron should be run by making a browser request, rather than through the API. That should be explained too.

Steps to reproduce

Proposed resolution

Remaining tasks

- Determine if last change was correct (Adding full stop (.) to end of comment lines)
- Review

User interface changes

API changes

Data model changes

Release notes snippet

๐Ÿ› Bug report
Status

Needs work

Version

11.0 ๐Ÿ”ฅ

Component
Documentationย  โ†’

Last updated about 4 hours ago

No maintainer
Created by

๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom joachim

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024