/** * Theme generator test * * @param $theme * @param $machine_name * @param $theme_path * @param $description * @param $core * @param $package * @param $global_library * @param $base_theme * @param $regions * @param $breakpoints * * @dataProvider commandData */ public function testGenerateTheme($theme, $machine_name, $theme_path, $description, $core, $package, $global_library, $base_theme, $regions, $breakpoints) { $generator = new ThemeGenerator(); $this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs()); $this->getRenderHelper()->setTranslator($this->getTranslatorHelper()); $generator->setHelperSet($this->getHelperSet()); $generator->generate($theme, $machine_name, $theme_path, $description, $core, $package, $global_library, $base_theme, $regions, $breakpoints); $files = [$theme_path . '/' . $machine_name . '/' . $machine_name . '.info.yml', $theme_path . '/' . $machine_name . '/' . $machine_name . '.theme']; foreach ($files as $file) { $this->assertTrue(file_exists($file), sprintf('%s does not exist', $file)); } if ($breakpoints) { $this->assertTrue(file_exists($theme_path . '/' . $machine_name . '.breakpoints.yml'), sprintf('%s does not exist', $machine_name . '.breakpoints.yml')); } }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration if (!$this->confirmGeneration($io)) { return; } $theme = $this->validator->validateModuleName($input->getOption('theme')); $theme_path = $this->appRoot . $input->getOption('theme-path'); $theme_path = $this->validator->validateModulePath($theme_path, true); $machine_name = $this->validator->validateMachineName($input->getOption('machine-name')); $description = $input->getOption('description'); $core = $input->getOption('core'); $package = $input->getOption('package'); $base_theme = $input->getOption('base-theme'); $global_library = $input->getOption('global-library'); $regions = $input->getOption('regions'); $breakpoints = $input->getOption('breakpoints'); $this->generator->generate($theme, $machine_name, $theme_path, $description, $core, $package, $base_theme, $global_library, $regions, $breakpoints); }