You are here

function ModuleDependencyTestCase::testModuleMetaData in Drupal 7

Tests whether the correct module metadata is returned.

File

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

Class

ModuleDependencyTestCase
Test module dependency functionality.

Code

function testModuleMetaData() {

  // Generate the list of available modules.
  $modules = system_rebuild_module_data();

  // Check that the mtime field exists for the system module.
  $this
    ->assertTrue(!empty($modules['system']->info['mtime']), 'The system.info file modification time field is present.');

  // Use 0 if mtime isn't present, to avoid an array index notice.
  $test_mtime = !empty($modules['system']->info['mtime']) ? $modules['system']->info['mtime'] : 0;

  // Ensure the mtime field contains a number that is greater than zero.
  $this
    ->assertTrue(is_numeric($test_mtime) && $test_mtime > 0, 'The system.info file modification time field contains a timestamp.');
}