Move \Drupal\Tests\system\Functional\Module\ModuleTestBase::assertLogMessage to a trait

Created on 26 July 2023, 11 months ago
Updated 22 August 2023, 10 months ago

Problem/Motivation

\Drupal\Tests\system\Functional\Module\ModuleTestBase::assertLogMessage is a nice utility method for testing a log entry was created.
\Drupal\Tests\user\Functional\UserLoginHttpTest has similar code, and after 🐛 Password reset json endpoint reveals whether an email or username is in use Fixed will now have three instances doing the same thing

Steps to reproduce

Proposed resolution

Move \Drupal\Tests\system\Functional\Module\ModuleTestBase::assertLogMessage to a trait and use that trait in both ModuleTestBase and \Drupal\Tests\user\Functional\UserLoginHttpTest

Search for any other tests that query the watchdog table and use the trait there too

Remaining tasks

All of the above

User interface changes

API changes

Data model changes

Release notes snippet

📌 Task
Status

Needs work

Version

11.0 🔥

Component
PHPUnit 

Last updated about 11 hours ago

Created by

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

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.

Sign in to follow issues

Comments & Activities

  • Issue created by @larowlan
  • 🇺🇸United States dww

    Thanks for splitting this off. Great novice task! I came here to help, but since you tagged it, better to leave this for others. 😅 At least now I'll see it when someone posts a patch or opens an MR, and hopefully whenever that happens I'll have a chance to review. 🤞

  • First commit to issue fork.
  • last update 11 months ago
    Custom Commands Failed
  • @elber opened merge request.
  • last update 11 months ago
    29,961 pass
  • Status changed to Needs review 11 months ago
  • last update 11 months ago
    Custom Commands Failed
  • 🇺🇸United States dww

    Hi @elber, thanks for moving this forward. From looking at your profile, you don't seem like a "novice". 😅 The intention of this tag is to identify issues that would be good for first-time contributors, not for folks like you and me to crank out easy fixes.

    But, what's done is done, so now this needs review. Moving status to match reality.

  • 🇧🇷Brazil elber Brazil

    Ok I'm sorry @dww, I won't make that mistake again

  • 🇺🇸United States dww

    @elber: No worries! It's never a "mistake" to contribute to improving Drupal core. 😅. The tag should probably be called something more self-documenting like "Good for first contribution" or something, but that's kinda clumsy. Anyway, great that you're now aware of all this, and will save the "novice" issues for folks that are just getting started. Please spread the word to your co-workers, too. Obrigado!

    Tchau,
    -Derek

  • Status changed to RTBC 10 months ago
  • 🇺🇸United States smustgrave

    Move didn't seem to cause any issues so think this is good.

  • last update 10 months ago
    Custom Commands Failed
  • Status changed to Needs work 10 months ago
  • 🇳🇱Netherlands Spokje

    Looking at the proposed solution in the IS:

    Move \Drupal\Tests\system\Functional\Module\ModuleTestBase::assertLogMessage to a trait

    Check.

    and use that trait in both ModuleTestBase

    The trait is now used individually in DbLogTest and InstallUninstallTest instead of inheriting it from ModuleTestBase

    and \Drupal\Tests\user\Functional\UserLoginHttpTest

    The trait seems not to be used in that.

    Search for any other tests that query the watchdog table and use the trait there too

    Unsure if that happened?

    Back to NW for the above.

Production build 0.69.0 2024