You are here

public function L10nUpdateTest::testEnableUninstallModule in Localization update 7.2

Tests automatic translation import when a module is enabled.

File

tests/L10nUpdateTest.test, line 311
Contains L10nUpdateTest.

Class

L10nUpdateTest
Tests for update translations.

Code

public function testEnableUninstallModule() {

  // Make the hidden test modules look like a normal custom module.
  variable_set('l10n_update_test_system_info_alter', TRUE);

  // Check if there is no translation yet.
  $this
    ->assertTranslation('Tuesday', '', 'de');

  // Enable a module.
  $edit = array(
    'modules[Testing][l10n_update_test_translate][enable]' => '1',
  );
  $this
    ->drupalPost('admin/modules', $edit, t('Save configuration'));

  // Check if translations have been imported.
  // @TODO: Find out why this currently returns 0 translations.
  $this
    ->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array(
    '%number' => 0,
    '%update' => 0,
    '%delete' => 0,
  )), 'One translation file imported.');
  $this
    ->assertTranslation('Tuesday', 'Dienstag', 'de');

  // Disable and uninstall a module
  //    module_disable(array('l10n_update_test_translate'));
  //    $edit = array(
  //      'uninstall[l10n_update_test_translate]' => '1',
  //    );
  //    $this->drupalPost('admin/modules/uninstall', $edit, t('Uninstall'));
  //    $this->drupalPost(NULL, array(), t('Uninstall'));
  //
  //    // Check if the file data is removed from the database.
  //    $history = l10n_update_get_file_history();
  //    $this->assertFalse(isset($history['l10n_update_test_translate']), 'Project removed from the file history');
  //    $projects = l10n_update_get_projects();
  //    $this->assertFalse(isset($projects['l10n_update_test_translate']), 'Project removed from the project list');
}