You are here

function ModuleHandlerTest::testThemeMetaData in Service Container 7

Same name and namespace in other branches
  1. 7.2 lib/Drupal/service_container/Tests/ModuleHandlerTest.php \Drupal\service_container\Tests\ModuleHandlerTest::testThemeMetaData()

Tests whether the correct theme metadata is returned.

File

lib/Drupal/service_container/Tests/ModuleHandlerTest.php, line 248
Contains \Drupal\service_container\Tests\ModuleHandlerTest.

Class

ModuleHandlerTest
Tests the module_handler implementation of the service_container.

Namespace

Drupal\service_container\Tests

Code

function testThemeMetaData() {

  // Generate the list of available themes.
  $themes = system_rebuild_theme_data();

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

  // Use 0 if mtime isn't present, to avoid an array index notice.
  $test_mtime = !empty($themes['bartik']->info['mtime']) ? $themes['bartik']->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 bartik.info.yml file modification time field contains a timestamp.');
}