Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
\Drupal\system\Tests\System\CronQueueTest
is currently implemented as a web test, even everything happens without HTTP requests but rather in the scope of the test process.
This is slower than possible for example.
Proposed resolution
Move the test to extend KernelTestBase
to be a little bit faster and more important, more convenient to work with.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#4 | interdiff.txt | 1.68 KB | juampynr |
#4 | convert-2765207-4.patch | 7.11 KB | juampynr |
#2 | convert-2765207-2.patch | 7.14 KB | juampynr |
#2 | diff-webtest-to-kernel.txt | 3.75 KB | juampynr |
Comments
Comment #2
juampynr CreditAttribution: juampynr at Lullabot commentedHere it is. I have added a diff between the WebTest and the KernelTest to make easier to see what I changed.
Comment #3
dawehnerWe could clean that up in https://www.drupal.org/node/2717207 a bit, I think, but for now this seems okay/the only solution to test that?
Why does
$this->cron->run()
not executesystem_cron()
?Do we care that this bit is actually implemented in system module itself?
Comment #4
juampynr CreditAttribution: juampynr at Lullabot commented1. Yes, for the moment this is how we need to do it. I have subscribed to that issue, so I will see if I can help.
2. Good catch! I did further debugging, and saw that cron->run() calls Cron Handlers, which invokes hook_cron, which calls system_cron(). Therefore, there is no need to call system_cron() directly. I have removed it from the patch.
Comment #6
juampynr CreditAttribution: juampynr at Lullabot commentedDrupal CI has been drinking. Not me.
Comment #7
dawehnerThank you!
Comment #8
alexpottCommitted and pushed 2c4aa41e63ff42c668c605f49d671f55e3d3a116 to 8.2.x and 71300b5 to 8.1.x. Thanks!