Change MigrateUpgradeExecuteTestBase::assertLogErrors() to assertLogErrorCount(int $expected)

Created on 23 April 2024, about 2 months ago

Problem/Motivation

Follow-up from πŸ› Reduce time of Migrate Upgrade tests by not outputting the logs by default RTBC . When I was reviewing that, I noted:

Took me a moment to understand why we're moving assertLogError() outside the check for if we've written anything to the logs. But then with grep and looking at more context outside of the MR diff, I see that that function relies on $this->expectedLoggedErrors, which is only set in the two functions where assertLogError() is now found.

At the risk of slowing down this important fix, I have to ask: should that method really be something like:

assertLogErrorCount(int $expected): void

Why bother with the expectedLoggedErrors property at all? It's only set exactly twice with hard-coded ints each time:

./core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php:    $this->expectedLoggedErrors = 27;
./core/modules/migrate_drupal_ui/tests/src/Functional/d6/Upgrade6Test.php:    $this->expectedLoggedErrors = 39;

We never increment or anything. It's basically just a constant. Why not pass it directly where we need it?

@catch replied "I think #8's a good idea for follow-up." so here we are. πŸ˜‚

Steps to reproduce

Proposed resolution

  • Rename MigrateUpgradeExecuteTestBase::assertLogError() to assertLogErrorCount(int $expected).
  • Remove the expectedLoggedErrors property.
  • Update the 2 call sites to pass their values directly instead of setting this property.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component
MigrationΒ  β†’

Last updated about 21 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States dww

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024