You are here

public function UserTranslationUITest::testTranslatedUserDeletion in Drupal 8

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

Test translated user deletion.

File

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

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
    ->drupalPostForm($url, [], t('Cancel account'));
  $this
    ->assertSession()
    ->statusCodeEquals(200);
}