function ModuleInfoTest::testModuleInfo

Same name in other branches
  1. 10 core/tests/Drupal/Tests/Core/Extension/ModuleInfoTest.php \Drupal\Tests\Core\Extension\ModuleInfoTest::testModuleInfo()
  2. 11.x core/tests/Drupal/Tests/Core/Extension/ModuleInfoTest.php \Drupal\Tests\Core\Extension\ModuleInfoTest::testModuleInfo()

Tests that core module info files have the expected keys.

@dataProvider coreModuleListDataProvider

File

core/tests/Drupal/Tests/Core/Extension/ModuleInfoTest.php, line 23

Class

ModuleInfoTest
Tests that core module info files have the expected keys.

Namespace

Drupal\Tests\Core\Extension

Code

public function testModuleInfo($module) {
    $module_directory = __DIR__ . '/../../../../../modules/' . $module;
    $info = Yaml::decode(file_get_contents($module_directory . '/' . $module . '.info.yml'));
    $this->assertArrayHasKey('version', $info);
    $this->assertEquals('VERSION', $info['version']);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.