You are here

public function PatternsSystemTestCase::testModules in Patterns 7

Same name and namespace in other branches
  1. 7.2 tests/system/system.test \PatternsSystemTestCase::testModules()

File

tests/system/system.test, line 46
SimpleTests for the System component of Patterns.

Class

PatternsSystemTestCase
@file SimpleTests for the System component of Patterns.

Code

public function testModules() {

  // Check for modules before running the pattern.
  $this
    ->assertModule('aggregator', FALSE);
  $this
    ->assertModule('forum', FALSE);
  $this
    ->assertModule('overlay', TRUE);
  $this
    ->assertModule('number', TRUE);

  // Run the pattern.
  parent::runFile('modules.yaml', 'Enable/disable modules', $this->system_tests_dir);

  // Expected messages.
  $this
    ->assertUniqueText(t('Module(s) forum, number enabled. No modules have been disabled.'), t('The forum module should get enabled.'));
  $this
    ->assertUniqueText(t('No modules have been enabled. Module(s) overlay disabled.'), t('The overlay module should get disabled.'));
  $this
    ->assertUniqueText(t('Warning: Could not disable admin_menu because it is missing.'), t('Disabling a missing module gives a warning.'));
  $this
    ->assertUniqueText(t('Warning: Did not disable aggregator because it is already disabled.'), t('Disabling a disabled module gives a warning.'));
  $this
    ->assertUniqueText(t('Warning: Did not enable number because it is already enabled.'), t('Enabling an enabled module gives a warning.'));

  // Check for modules after running the pattern.
  // TODO: it might be good to check if every other module is left untouched.
  $this
    ->assertModule('aggregator', FALSE);
  $this
    ->assertModule('forum', TRUE);
  $this
    ->assertModule('overlay', FALSE);
  $this
    ->assertModule('number', TRUE);
}