You are here

function SimplifiedModulesTestCase::testCombinedSubModulesAndDependencies in Simplified Modules 7

Test that a combined set of hidden submodules and dependencies works.

File

./simplified_modules.test, line 124

Class

SimplifiedModulesTestCase
Tests for auto-enabling and disabling hidden submodules and dependencies.

Code

function testCombinedSubModulesAndDependencies() {

  // Trigger the dependencies and submodules we want to be hidden for this
  // test.
  $this
    ->setModuleStatus(array(
    'blog' => FALSE,
    'forum' => FALSE,
    'poll' => FALSE,
  ));

  // This sets up a situation where 'simplified_modules_test_submodule' and
  // 'blog' both depend on 'forum', 'simplified_modules_test_submodule' also
  // depends on 'poll', and 'blog', 'forum', and 'poll' are all hidden.
  variable_set('simplified_modules_test_both', TRUE);

  // Enable the module that has the hidden dependencies, and make sure the
  // dependencies (and their hidden submodules) were auto-enabled.
  $this
    ->setModuleStatus(array(
    'simplified_modules_test_submodule' => TRUE,
  ));
  $this
    ->assertTrue(module_exists('forum') && module_exists('poll') && module_exists('blog'), t('The hidden dependencies and their hidden submodules were automatically enabled.'));

  // Disable the module that has the hidden dependencies, and make sure the
  // dependencies (and their hidden submodules) were auto-disabled.
  $this
    ->setModuleStatus(array(
    'simplified_modules_test_submodule' => FALSE,
  ));
  $this
    ->assertTrue(!module_exists('forum') && !module_exists('poll') && !module_exists('blog'), t('The hidden dependencies and their hidden submodules were automatically disabled.'));
}