Fix strict type errors: Convert FormattableMarkup to strings (complex replacement) in core Kernel tests

Created on 17 November 2023, 10 months ago
Updated 28 April 2024, 5 months ago

Problem/Motivation

See parent(s).

All the simple conversions are for πŸ“Œ Fix strict type errors: Convert FormattableMarkup to strings (simple replacement) in core/tests/Drupal/KernelTests/* Active and πŸ“Œ Fix strict type errors: Convert FormattableMarkup to strings (simple replacement) in core/modules/*/tests/src/Kernel/* Active . This issue is for all the more complicated places where we need rewrite how the message is generated. If that's still too huge a set of changes, we can split this one up futher.

Steps to reproduce

Proposed resolution

Convert "everything else" from FormattableMarkup into strings (e.g. with new local variables, other simplifications, etc).

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Fixed

Version

10.2 ✨

Component
BaseΒ  β†’

Last updated about 1 hour ago

Created by

πŸ‡ΊπŸ‡ΈUnited States dww

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

Merge Requests

Comments & Activities

  • Issue created by @dww
  • First commit to issue fork.
  • Status changed to Needs work 10 months ago
  • πŸ‡¦πŸ‡ΊAustralia mstrelan

    Split these changes from the parent issue, marking NW to make readability improvements.

  • Pipeline finished with Success
    10 months ago
    Total: 3830s
    #52496
  • Pipeline finished with Failed
    8 months ago
    Total: 155s
    #73969
  • Pipeline finished with Failed
    8 months ago
    Total: 139s
    #73971
  • Status changed to Needs review 8 months ago
  • πŸ‡¦πŸ‡ΊAustralia mstrelan

    Addressed feedback

  • Pipeline finished with Failed
    8 months ago
    Total: 186s
    #73973
  • Pipeline finished with Failed
    8 months ago
    Total: 164s
    #73975
  • Pipeline finished with Success
    8 months ago
    Total: 517s
    #73982
  • Status changed to RTBC 8 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    All feedback/threads appear to be addressed.

  • Status changed to Needs work 8 months ago
  • πŸ‡¦πŸ‡ΊAustralia mstrelan

    MR needs rebasing

  • Pipeline finished with Success
    8 months ago
    Total: 698s
    #77127
  • Status changed to Needs review 8 months ago
  • πŸ‡¦πŸ‡ΊAustralia mstrelan

    Rebased, seems like some of the changes were already addressed in a related issue.

  • Status changed to RTBC 8 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Rebase seems good.

  • Status changed to Needs work 8 months ago
  • πŸ‡³πŸ‡ΏNew Zealand quietone New Zealand

    I found a stray character and left a question about using ...$args.

  • Status changed to Needs review 8 months ago
  • πŸ‡¦πŸ‡ΊAustralia mstrelan

    Fixed the stray % character. Perhaps we should get rid of the $args array in those sprintf calls and just add the values directly?

  • Pipeline finished with Success
    8 months ago
    Total: 1148s
    #83923
  • Status changed to RTBC 8 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Perhaps we should get rid of the $args array in those sprintf calls and just add the values directly?

    Removing that sounds like it could be a follow up as that could lead down a rabbit hole (I imagine)

  • Status changed to Needs work 8 months ago
  • πŸ‡³πŸ‡ΏNew Zealand quietone New Zealand

    I don't this it is a rabbit hole for reasons I mention in the MR. I wanted to use the suggestion feature for these two changes but it wasn't working for me \Drupal\Tests\system\Kernel\Form\ProgrammaticTest::doSubmitForm so I abandoned that idea.

  • πŸ‡¦πŸ‡ΊAustralia mstrelan

    Do we even need a $message here? Would make all these issues so much easier. Anyway, that's a topic for another day.

  • Pipeline finished with Failed
    5 months ago
    Total: 177s
    #140755
  • Status changed to Needs review 5 months ago
  • πŸ‡³πŸ‡ΏNew Zealand quietone New Zealand

    I agree, most of these don't need a message.

    To get this moving again I made the changes I suggested.

  • Status changed to Needs work 5 months ago
  • The Needs Review Queue Bot β†’ tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

    This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide β†’ to find step-by-step guides for working with issues.

  • Status changed to Needs review 5 months ago
  • πŸ‡³πŸ‡ΏNew Zealand quietone New Zealand

    Arg, I've had trouble with git with this issue. Should be sorted now.

  • Status changed to RTBC 5 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Appears feedback has been addressed

  • πŸ‡¦πŸ‡ΊAustralia mstrelan

    Thank you @quietone, have looked over the last 3 commits and am happy with these changes.

  • Status changed to Fixed 5 months ago
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    Committed and pushed 955418c2df to 11.x and c9255990e0 to 10.3.x. Thanks!
    Committed ac127f0 and pushed to 10.2.x. Thanks!

    Backported to 10.2.x to keep tests aligned...

    We should file a followup to change \Drupal\Tests\file\Kernel\FileManagedUnitTestBase::assertFileHooksCalled() to something like:

      public function assertFileHooksCalled($expected) {
        \Drupal::state()->resetCache();
    
        // Determine which hooks were called.
        $actual = array_keys(array_filter(file_test_get_all_calls()));
    
        // Determine if there were any expected that were not called.
        $uncalled = array_diff($expected, $actual);
        $this->assertEmpty($uncalled, sprintf('Expected hooks %s to be called but %s was not called.', implode(', ', $expected), implode(', ', $uncalled)));
    
        // Determine if there were any unexpected calls.
        $unexpected = array_diff($actual, $expected);
        $this->assertEmpty($unexpected, sprintf('Unexpected hooks were called: %s.', empty($unexpected) ? '(none)' : implode(', ', $unexpected)));
      }
    

    The $this->assertTrue(FALSE is bizarre... but not added here.

    • alexpott β†’ committed ac127f07 on 10.2.x
      Issue #3402294 by mstrelan, quietone, dww, smustgrave: Fix strict type...
    • alexpott β†’ committed c9255990 on 10.3.x
      Issue #3402294 by mstrelan, quietone, dww, smustgrave: Fix strict type...
    • alexpott β†’ committed 955418c2 on 11.x
      Issue #3402294 by mstrelan, quietone, dww, smustgrave: Fix strict type...
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024