function UserTranslationUITest::testTranslatedUserDeletion

Same name in other branches
  1. 9 core/modules/user/tests/src/Functional/UserTranslationUITest.php \Drupal\Tests\user\Functional\UserTranslationUITest::testTranslatedUserDeletion()
  2. 8.9.x core/modules/user/tests/src/Functional/UserTranslationUITest.php \Drupal\Tests\user\Functional\UserTranslationUITest::testTranslatedUserDeletion()
  3. 10 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 101

Class

UserTranslationUITest
Tests the User Translation UI.

Namespace

Drupal\Tests\user\Functional

Code

public function testTranslatedUserDeletion() : void {
    $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);
}

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