You are here

function ModuleBuilderModuleGenerationTestCase::generateModuleFiles in Module Builder 8.3

Generate module files from a data array.

Parameters

$module_data: An array of module data for the module generator.

An array of files.:

1 call to ModuleBuilderModuleGenerationTestCase::generateModuleFiles()
ModuleBuilderModuleGenerationTestCase::testModuleGeneration in tests/module_builder.test
Test generating module code.

File

tests/module_builder.test, line 179
Contains tests for the Module builder module.

Class

ModuleBuilderModuleGenerationTestCase
Test case for Module Builder module generation.

Code

function generateModuleFiles($module_data) {
  \DrupalCodeBuilder\Factory::setEnvironmentClass('TestsSampleLocation');
  $mb_task_handler_generate = \DrupalCodeBuilder\Factory::getTask('Generate', 'module');
  $root_generator = $mb_task_handler_generate
    ->getRootGenerator();
  $component_data_info = $root_generator
    ->getComponentDataInfo();

  // Perform final processing on the component data.
  // This prepares data, for example expands options such as hook presets.
  $mb_task_handler_generate
    ->getRootGenerator()
    ->processComponentData($component_data_info, $module_data);
  $files = $mb_task_handler_generate
    ->generateComponent($module_data);
  return $files;
}