You are here

function ModuleDependencyTestCase::testEnableWithoutDependency in Drupal 7

Attempt to enable translation module without locale enabled.

File

modules/system/system.test, line 407
Tests for system.module.

Class

ModuleDependencyTestCase
Test module dependency functionality.

Code

function testEnableWithoutDependency() {

  // Attempt to enable content translation without locale enabled.
  $edit = array();
  $edit['modules[Core][translation][enable]'] = 'translation';
  $this
    ->drupalPost('admin/modules', $edit, t('Save configuration'));
  $this
    ->assertText(t('Some required modules must be enabled'), 'Dependency required.');
  $this
    ->assertModules(array(
    'translation',
    'locale',
  ), FALSE);

  // Assert that the locale tables weren't enabled.
  $this
    ->assertTableCount('languages', FALSE);
  $this
    ->assertTableCount('locale', FALSE);
  $this
    ->drupalPost(NULL, NULL, t('Continue'));
  $this
    ->assertText(t('The configuration options have been saved.'), 'Modules status has been updated.');
  $this
    ->assertModules(array(
    'translation',
    'locale',
  ), TRUE);

  // Assert that the locale tables were enabled.
  $this
    ->assertTableCount('languages', TRUE);
  $this
    ->assertTableCount('locale', TRUE);
}