/**
  * Profile generator test.
  *
  * @param $profile
  * @param $machine_name
  * @param $profile_path
  * @param $description
  * @param $core
  * @param $dependencies
  * @param $distribution
  *
  * @dataProvider commandData
  */
 public function testGenerateProfile($profile, $machine_name, $profile_path, $description, $core, $dependencies, $distribution)
 {
     $generator = new ProfileGenerator();
     $this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs());
     $this->getRenderHelper()->setTranslator($this->getTranslatorHelper());
     $generator->setHelperSet($this->getHelperSet());
     $generator->generate($profile, $machine_name, $profile_path, $description, $core, $dependencies, $distribution);
     $files = [$machine_name . '.info.yml', $machine_name . '.install', $machine_name . '.profile'];
     foreach ($files as $file) {
         $file_path = $profile_path . '/' . $machine_name . '/' . $file;
         $this->assertTrue(file_exists($file_path), sprintf('%s has been generated', $file_path));
     }
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     if (!$this->confirmGeneration($io)) {
         return;
     }
     $profile = $this->validator->validateModuleName($input->getOption('profile'));
     $machine_name = $this->validator->validateMachineName($input->getOption('machine-name'));
     $description = $input->getOption('description');
     $core = $input->getOption('core');
     $distribution = $input->getOption('distribution');
     $profile_path = $this->appRoot . '/profiles';
     // Check if all module dependencies are available.
     $dependencies = $this->validator->validateModuleDependencies($input->getOption('dependencies'));
     if ($dependencies) {
         $checked_dependencies = $this->checkDependencies($dependencies['success']);
         if (!empty($checked_dependencies['no_modules'])) {
             $io->info(sprintf($this->trans('commands.generate.profile.warnings.module-unavailable'), implode(', ', $checked_dependencies['no_modules'])));
         }
         $dependencies = $dependencies['success'];
     }
     $this->generator->generate($profile, $machine_name, $profile_path, $description, $core, $dependencies, $distribution);
 }