1 module.test public ModuleUninstallTestCase::testUninstallLocale()

Tests that uninstalling locale does not cause problems.

File

core/modules/simpletest/tests/module.test, line 308
Tests for the module API.

Class

ModuleUninstallTestCase
Unit tests for module uninstallation and related hooks.

Code

public function testUninstallLocale() {
  // Enable Locale with dependencies, add a language and set it to default.
  module_enable(array('language', 'locale'), FALSE);
  $language = (object) array(
    'langcode' => 'fr',
    'name' => 'French',
    'direction' => LANGUAGE_LTR,
    'enabled' => TRUE,
  );
  language_save($language);
  config_set('system.core', 'language_default', 'fr');
  $prefixes = array(
    'en' => 'en',
    'fr' => '',
  );
  config_set('locale.settings', 'language_negotiation_url_prefixes', $prefixes);
  // Defaults to "en" otherwise.
  global $language;
  $language = language_load('fr');

  $this->admin_user = $this->backdropCreateUser(array(
    'administer modules',
  ));
  $this->backdropLogin($this->admin_user);

  module_disable(array('locale'), FALSE);
  $edit = array(
    'uninstall[locale]' => TRUE,
  );
  // This should not cause "PDOException: SQLSTATE[42S02]: Base table or view
  // not found".
  $this->backdropPost('admin/modules/uninstall', $edit, t('Uninstall'));
  $this->backdropPost(NULL, array(), t('Uninstall'));

  $this->backdropGet('admin/modules/uninstall');
  $this->assertNoText('Uninstall Locale module', 'Module Locale has been successfully uninstalled');
}