You are here

public function FeaturesCtoolsIntegrationTest::testModuleEnable in Features 7

Same name and namespace in other branches
  1. 7.2 tests/features.test \FeaturesCtoolsIntegrationTest::testModuleEnable()

Run test.

File

tests/features.test, line 250

Class

FeaturesCtoolsIntegrationTest
Tests intergration of ctools for features.

Code

public function testModuleEnable() {
  $try = array(
    'strongarm',
    'views',
  );

  // Trigger the first includes and the static to be set.
  features_include();
  $function_ends = array(
    'features_export',
    'features_export_options',
    'features_export_render',
    'features_revert',
  );
  foreach ($try as $module) {
    $function = $module . '_features_api';
    $this
      ->assertFalse(function_exists($function), 'Chaos tools functions for ' . $module . ' do not exist while it is disabled.');

    // Module enable will trigger declaring the new functions.
    module_enable(array(
      $module,
    ));
    if (module_exists($module)) {
      $function_exists = function_exists($function);
      if ($function_exists) {
        foreach ($function() as $component_type => $component_info) {
          foreach ($function_ends as $function_end) {
            $function_exists = $function_exists && function_exists($component_type . '_' . $function_end);
          }
        }
      }
      $this
        ->assertTrue($function_exists, 'Chaos tools functions for ' . $module . ' exist when it is enabled.');
    }
  }
}