You are here

public static function TestGenerateTask::getDefinition in Module Builder 8.3

File

tests/modules/module_builder_test_component_type/src/TestGenerateTask.php, line 31

Class

TestGenerateTask
Mock Generate task for functional tests.

Namespace

Drupal\module_builder_test_component_type

Code

public static function getDefinition() : BasePropertyDefinition {
  $definition = GeneratorDefinition::createFromGeneratorType('module', 'complex');

  // The component form expects these to always exist.
  $definition
    ->addProperty(PropertyDefinition::create('string')
    ->setName('root_name')
    ->setLabel('Extension machine name'));
  $definition
    ->addProperty(PropertyDefinition::create('string')
    ->setName('readable_name')
    ->setLabel('Extension readable name'));

  // TODO: convert the whole definition to OO.
  $array_property_info = static::getInfoArray();

  // ARGH this method should be somewhere in a service!
  \DrupalCodeBuilder\Generator\BaseGenerator::addArrayPropertyInfoToDefinition($definition, $array_property_info);
  $definition
    ->setName('module');
  return $definition;
}