protected function EntityTranslationUITest::assertTranslationDeletion

Tests translation deletion.

1 call to EntityTranslationUITest::assertTranslationDeletion()

File

drupal/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationUITest.php, line 202
Definition of Drupal\entity\Tests\EntityTranslationUITest.

Class

EntityTranslationUITest
Tests the Entity Translation UI.

Namespace

Drupal\translation_entity\Tests

Code

protected function assertTranslationDeletion() {

  // Confirm and delete a translation.
  $langcode = 'fr';
  $entity = entity_load($this->entityType, $this->entityId, TRUE);
  $this
    ->drupalPost($langcode . '/' . $this->controller
    ->getEditPath($entity), array(), t('Delete translation'));
  $this
    ->drupalPost(NULL, array(), t('Delete'));
  $entity = entity_load($this->entityType, $this->entityId, TRUE);
  if ($this
    ->assertTrue(is_object($entity), 'Entity found')) {
    $translations = $entity
      ->getTranslationLanguages();
    $this
      ->assertTrue(count($translations) == 2 && empty($translations[$langcode]), 'Translation successfully deleted.');
  }
}