Problem/Motivation

AssertLegacyTrait::assertPattern() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseMatches() instead. See https://www.drupal.org/node/3129738

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

mondrake created an issue. See original summary.

jungle’s picture

Issue tags: +Deprecated assertions

Adding the "Deprecated assertions" tag to add this into the kanban board https://contribkanban.com/board/Deprecatedassertions

mondrake’s picture

Status: Active » Postponed

The current calls to assertPattern in functional tests still have a message passed in, even if the AssertLegacyTrait::assertPattern() does not tak that in. We need to remove the messages from the calls and inline them as comments where appropriate before doing the conversion.

mondrake’s picture

Status: Postponed » Active

Blocker went in, unpostponing

mondrake’s picture

Status: Active » Needs review
Issue tags: +Needs tests
StatusFileSize
new24.96 KB

First patch. Needs deprecation tests.

mondrake’s picture

Status: Needs review » Needs work
mondrake’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
StatusFileSize
new25.83 KB
new882 bytes

Added deprecation test.

Status: Needs review » Needs work

The last submitted patch, 8: 3139436-8.patch, failed testing. View results

mondrake’s picture

Status: Needs work » Needs review
StatusFileSize
new25.83 KB
new828 bytes

Title is not in the page...

mondrake’s picture

Ready for review.

jungle’s picture

Status: Needs review » Reviewed & tested by the community
  1. +++ b/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php
    @@ -284,6 +284,17 @@ public function testTextAsserts() {
    +  public function testAssertPattern() {
    +    $this->drupalGet('test-escaped-characters');
    +    $this->assertPattern('/div class.*escaped/');
    

    Deprecated AssertLegacyTrait::assertPattern() gets tested

  2. +++ b/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php
    @@ -185,7 +185,6 @@ public static function getSkippedDeprecations() {
    -      'AssertLegacyTrait::assertPattern() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseMatches() instead. See https://www.drupal.org/node/3129738',
    

    Removed from the list.

  3. Testing passed -- no more left to replace
  4. No CS violations

It's ready to go to me, Thanks @mondrake!

dww’s picture

Status: Reviewed & tested by the community » Needs review

core/tests/Drupal/KernelTests/AssertContentTrait.php has a non-deprecated version of assertPattern(). What's up, doc?

Thanks/sorry,
-Derek

mondrake’s picture

Status: Needs review » Reviewed & tested by the community
dww’s picture

Re #14: thanks for clarifying.
#12 is an excellent RTBC. ;) That's everything I just checked and agree with all points.

One might complain that the summary is a bit bare, but this is part of a bigger effort and it says all it needs to say. ;)

Thanks/sorry,
-Derek

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 10: 3139436-10.patch, failed testing. View results

dww’s picture

Status: Needs work » Reviewed & tested by the community

Random fail. Requeued.

catch’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

Needs a re-roll.

jungle’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new1.91 KB
new25.87 KB

Rejected:

$ cat core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php.rej
diff a/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php b/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php  (rejected hunks)
@@ -185,7 +185,6 @@ public static function getSkippedDeprecations() {
       'AssertLegacyTrait::assertFieldsByValue() is deprecated in drupal:8.3.0 and is removed from drupal:10.0.0. Use iteration over the fields yourself instead and directly check the values in the test. See https://www.drupal.org/node/3129738',
       'AssertLegacyTrait::assertEscaped() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->assertEscaped() instead. See https://www.drupal.org/node/3129738',
       'AssertLegacyTrait::assertNoEscaped() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->assertNoEscaped() instead. See https://www.drupal.org/node/3129738',
-      'AssertLegacyTrait::assertPattern() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseMatches() instead. See https://www.drupal.org/node/3129738',
       'AssertLegacyTrait::constructFieldXpath() is deprecated in drupal:8.5.0 and is removed from drupal:10.0.0. Use $this->getSession()->getPage()->findField() instead. See https://www.drupal.org/node/3129738',
     ];
   }
dww’s picture

Status: Needs review » Reviewed & tested by the community

rawdiff looks good. Only context changed, nothing in the code.
Confirming #19 applies cleanly to 9.1.x branch.
Assuming the bot is happy, this is RTBC again.

Thanks,
-Derek

  • catch committed 49d9b09 on 9.1.x
    Issue #3139436 by mondrake, jungle: Replace usages of AssertLegacyTrait...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed 49d9b09 and pushed to 9.1.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.