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

Created on 26 July 2023, over 1 year ago
Updated 22 August 2023, over 1 year 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 1 day 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 over 1 year ago
    Custom Commands Failed
  • @elber opened merge request.
  • last update over 1 year ago
    29,961 pass
  • Status changed to Needs review over 1 year ago
  • last update over 1 year 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 over 1 year ago
  • 🇺🇸United States smustgrave

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

  • last update over 1 year ago
    Custom Commands Failed
  • Status changed to Needs work over 1 year 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.71.5 2024