Problem/Motivation

AssertLegacyTrait::assertCacheTag() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseHeaderContains() 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

Assigned: Unassigned » mondrake

On this.

mondrake’s picture

Assigned: mondrake » Unassigned
Status: Active » Needs review
StatusFileSize
new33.12 KB

Removed silencer, added deprecation test, replaced usages.

pavnish’s picture

StatusFileSize
new30.34 KB

@mondrake Hi

I was trying to apply the patch on latest Drupal 9.1.x then it's give me errors.

curl https://www.drupal.org/files/issues/2020-05-25/3139437-4.patch | git apply -v
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 33911 100 33911 0 0 5013 0 0:00:06 0:00:06 --:--:-- 9843
Checking patch core/modules/block/tests/src/Functional/BlockInstallTest.php...
Checking patch core/modules/block/tests/src/Functional/BlockSystemBrandingTest.php...
Checking patch core/modules/book/tests/src/Functional/BookTest.php...
Checking patch core/modules/comment/tests/src/Functional/CommentAnonymousTest.php...
Checking patch core/modules/config/tests/src/Functional/CacheabilityMetadataConfigOverrideIntegrationTest.php...
Checking patch core/modules/contact/tests/src/Functional/ContactSitewideTest.php...
Checking patch core/modules/content_translation/tests/src/Functional/ContentTranslationWorkflowsTest.php...
Checking patch core/modules/forum/tests/src/Functional/ForumIndexTest.php...
Checking patch core/modules/forum/tests/src/Functional/ForumTest.php...
error: while searching for:

// Test the root forum page title change.
$this->drupalGet('forum');
$this->assertCacheTag('config:taxonomy.vocabulary.' . $this->forum['vid']);
$this->assertTitle(t('Forums | Drupal'));
$vocabulary = Vocabulary::load($this->forum['vid']);
$vocabulary->set('name', 'Discussions');

error: patch failed: core/modules/forum/tests/src/Functional/ForumTest.php:245
error: core/modules/forum/tests/src/Functional/ForumTest.php: patch does not apply
Checking patch core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php...
Checking patch core/modules/node/tests/src/Functional/NodeTypeTest.php...
Checking patch core/modules/page_cache/tests/src/Functional/PageCacheTest.php...
Checking patch core/modules/search/tests/src/Functional/SearchPageCacheTagsTest.php...
Checking patch core/modules/system/tests/src/Functional/Common/EarlyRenderingControllerTest.php...
Checking patch core/modules/system/tests/src/Functional/Entity/EntityListBuilderTest.php...
Checking patch core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php...
Checking patch core/modules/system/tests/src/Functional/Render/DisplayVariantTest.php...
Checking patch core/modules/user/tests/src/Functional/UserLoginTest.php...
Checking patch core/modules/user/tests/src/Functional/UserRegistrationTest.php...
Checking patch core/tests/Drupal/Tests/Core/Assert/AssertLegacyTraitTest.php...
Checking patch core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php...
Hunk #1 succeeded at 201 (offset -3 lines).

So patch need to be re-rolled

Also i create a new patch please review

Status: Needs review » Needs work

The last submitted patch, 5: 3139437-5.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

pavnish’s picture

Assigned: Unassigned » pavnish
pavnish’s picture

StatusFileSize
new717 bytes
new30.34 KB

Sorry #5 was wrong some issue with this patch please review this patch.

pavnish’s picture

Assigned: pavnish » Unassigned
Status: Needs work » Needs review
longwave’s picture

Status: Needs review » Needs work

#8 is missing the changes to core/tests/Drupal/Tests/Core/Assert/AssertLegacyTraitTest.php and core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php from #4.

mrinalini9’s picture

Assigned: Unassigned » mrinalini9
mrinalini9’s picture

Assigned: mrinalini9 » Unassigned
Status: Needs work » Needs review
StatusFileSize
new33.22 KB
new2.48 KB

Updated patch #8 along with the missed changes as mentioned in #10, please review.

longwave’s picture

Status: Needs review » Needs work
+++ b/core/modules/user/tests/src/Functional/UserRegistrationTest.php
@@ -386,10 +386,10 @@ public function testRegistrationWithUserFields() {
+    $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:core.entity_form_display.user.user.register');
+    $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:field.field.user.user.test_user_field');
+   $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:field.storage.user.test_user_field');
+    $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:user.settings');

One more tiny issue: the third line here is indented incorrectly.

Otherwise, this is good to go.

pavnish’s picture

Assigned: Unassigned » pavnish
pavnish’s picture

Assigned: pavnish » Unassigned
Status: Needs work » Needs review
StatusFileSize
new1.9 KB
new33.06 KB

@longwave Thanks
RE #13: Fixed
Updated patch #12 along with the missed changes as mentioned in #13, please review.

Pavnish

longwave’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for working on this, this looks good now.

bunty badgujar’s picture

The deprecation message suppression for AssertLegacyTrait::assertCacheTag have been removed.
All occurrences of $this->assertCacheTag() have been replaced by $this->assertSession()->responseHeaderContains().
#10 and #13 addressed.
DeprecationListener removed.
All changes look good to me.
The testbot is green.
For me it is RTBC.

bunty badgujar’s picture

@longwave, I guess we are checking this issue on same time. ;)

  • catch committed 2b7d2e1 on 9.1.x
    Issue #3139437 by pavnish, mrinalini9, mondrake, longwave, Bunty...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed 2b7d2e1 and pushed to 9.1.x. Thanks!

Status: Fixed » Closed (fixed)

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