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
As part of #2847428: [Meta] Modernize dblog module and #2807237: PHPUnit initiative the test that ensures dblog_cron works fine could be moved from the WebTestBase into a Kernel test.
Proposed resolution
Extract the DbLogTest::verifyCron into a kernel test.
Remaining tasks
Write a patch.
User interface changes
None
API changes
New Kernel test class.
Comment | File | Size | Author |
---|---|---|---|
#13 | 2848529-13.patch | 5.99 KB | ApacheEx |
Comments
Comment #2
dagmarComment #3
dagmarComment #5
ApacheEx CreditAttribution: ApacheEx as a volunteer and at Internetdevels commentedHere is a patch.
I'd like to highlight:
1) was changed
$cron_count = 1
to$cron_count == 1
which is more correct.2) was renamed
verifyCron
totestDbLogCron
.Comment #6
dawehnerI'm curious whether we should improve the code while porting it to a kernel test or not.
You could use assertGreaterThan here
You could use assertEquals here
You could use assertEquals here as well
Comment #7
ApacheEx CreditAttribution: ApacheEx as a volunteer and at Internetdevels commentedthanks for your review. I'm always want to improve smth here :). Then I read this:
and try to convert with minimal changes. Anyways, Here is improved patch.
Comment #8
dagmarThanks for working on this! But I think we should fix #2848914: Move DbLogTest::generateLogEntries() into a Trait to avoid code duplication on the code duplication on generate log entries.
Comment #11
dagmar#2848914: Move DbLogTest::generateLogEntries() into a Trait was committed. This issue is unblocked now.
Comment #12
longwaveThis needs #2985701: Followup: Move DbLogTest::generateLogEntries() into a Trait first as $this->adminUser is not set during the kernel test.
Comment #13
ApacheEx CreditAttribution: ApacheEx as a volunteer and at Internetdevels, Drupal Ukraine Community commented#2985701: Followup: Move DbLogTest::generateLogEntries() into a Trait was committed as well :)
Here is a patch
Comment #14
longwaveLooks good to me.
Comment #15
alexpottComment #16
alexpottCommitted and pushed 41b994cc88 to 8.7.x and 9130e65fbe to 8.6.x. Thanks!
Backported to 8.6.x since this is a test only change.