function UserCreatedFieldDisplayUpgradeTest::testMemberForDeprecationAndUserDisplayUpdate

Same name and namespace in other branches
  1. 11.x core/modules/user/tests/src/Functional/UserCreatedFieldDisplayUpgradeTest.php \Drupal\Tests\user\Functional\UserCreatedFieldDisplayUpgradeTest::testMemberForDeprecationAndUserDisplayUpdate()

Test user_post_update_add_created_to_display() and 'member_for' deprecation.

File

core/modules/user/tests/src/Functional/UserCreatedFieldDisplayUpgradeTest.php, line 37

Class

UserCreatedFieldDisplayUpgradeTest
Tests that 'created' field is added to user entity view display after update.

Namespace

Drupal\Tests\user\Functional

Code

public function testMemberForDeprecationAndUserDisplayUpdate() : void {
  $this->checkUserEntityViewDisplayConfig(TRUE);
  $this->runUpdates();
  $this->checkUserEntityViewDisplayConfig(FALSE);
  $this->drupalLogin($this->drupalCreateUser(values: [
    'roles' => [
      'administrator',
    ],
  ]));
  $this->drupalGet('user/1');
  $this->expectUserDeprecationMessage('The user entity "member_for" display extra field is deprecated in drupal:11.5.0 and removed in drupal:13.0.0. Use the "created" field in displays instead. See https://www.drupal.org/node/3611943');
  $assertSession = $this->assertSession();
  $assertSession->addressEquals('user/1');
  $assertSession->elementTextContains('css', 'h4.label', 'Member for');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.