You are here

public function UserTranslationUITest::testTranslatedUserDeletion in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/user/tests/src/Functional/UserTranslationUITest.php \Drupal\Tests\user\Functional\UserTranslationUITest::testTranslatedUserDeletion()
  2. 9 core/modules/user/tests/src/Functional/UserTranslationUITest.php \Drupal\Tests\user\Functional\UserTranslationUITest::testTranslatedUserDeletion()

Tests translated user deletion.

File

core/modules/user/tests/src/Functional/UserTranslationUITest.php, line 97

Class

UserTranslationUITest
Tests the User Translation UI.

Namespace

Drupal\Tests\user\Functional

Code

public function testTranslatedUserDeletion() {
  $this
    ->drupalLogin($this->administrator);
  $entity_id = $this
    ->createEntity($this
    ->getNewEntityValues('en'), 'en');
  $entity = $this->container
    ->get('entity_type.manager')
    ->getStorage($this->entityTypeId)
    ->load($entity_id);
  $translated_entity = $entity
    ->addTranslation('fr');
  $translated_entity
    ->save();
  $url = $entity
    ->toUrl('edit-form', [
    'language' => $this->container
      ->get('language_manager')
      ->getLanguage('en'),
  ]);
  $this
    ->drupalGet($url);
  $this
    ->clickLink('Cancel account');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
}