function LocaleFileImportStatus::testDeleteLanguage

Delete translation files after deleting a language.

File

drupal/core/modules/locale/lib/Drupal/locale/Tests/LocaleFileImportStatus.php, line 192
Definition of Drupal\locale\Tests\LocaleFileImportStatus.

Class

LocaleFileImportStatus
Functional tests for the import of translation files.

Namespace

Drupal\locale\Tests

Code

function testDeleteLanguage() {
  $langcode = 'de';
  $this
    ->addLanguage($langcode);
  $file_uri = 'translations://po_' . $this
    ->randomName() . '.' . $langcode . '.po';
  file_put_contents(drupal_realpath($file_uri), $this
    ->randomName());
  $this
    ->assertTrue(is_file($file_uri), 'Translation file is created.');
  language_delete($langcode);
  $this
    ->assertTrue($file_uri);
  $this
    ->assertFalse(is_file($file_uri), 'Translation file deleted after deleting language');
}