/**
  * PluginBlock generator test
  *
  * @param $module
  * @param $class_name
  * @param $label
  * @param $plugin_id
  * @param $services
  * @param $inputs
  *
  * @dataProvider commandData
  */
 public function testGeneratePluginBlock($module, $class_name, $label, $plugin_id, $services, $inputs)
 {
     $generator = new PluginBlockGenerator();
     $this->getHelperSet()->get('renderer')->setSkeletonDirs($this->getSkeletonDirs());
     $this->getHelperSet()->get('renderer')->setTranslator($this->getTranslatorHelper());
     $generator->setHelpers($this->getHelperSet());
     $generator->generate($module, $class_name, $label, $plugin_id, $services, $inputs);
     $this->assertTrue(file_exists($generator->getSite()->getPluginPath($module, 'Block') . '/' . $class_name . '.php'), sprintf('%s does not exist', $class_name . '.php'));
 }
 /**
  * {@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 1;
     }
     $module = $input->getOption('module');
     $class_name = $input->getOption('class');
     $label = $input->getOption('label');
     $plugin_id = $input->getOption('plugin-id');
     $services = $input->getOption('services');
     $theme_region = $input->getOption('theme-region');
     $inputs = $input->getOption('inputs');
     $theme = $this->configFactory->get('system.theme')->get('default');
     $themeRegions = \system_region_list($theme, REGIONS_VISIBLE);
     if (!empty($theme_region) && !isset($themeRegions[$theme_region])) {
         $io->error(sprintf($this->trans('commands.generate.plugin.block.messages.invalid-theme-region'), $theme_region));
         return 1;
     }
     // @see use Drupal\Console\Command\Shared\ServicesTrait::buildServices
     $build_services = $this->buildServices($services);
     $this->generator->generate($module, $class_name, $label, $plugin_id, $build_services, $inputs);
     $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']);
     if ($theme_region) {
         // Load block to set theme region
         $block = $this->entityTypeManager->getStorage('block')->create(array('id' => $plugin_id, 'plugin' => $plugin_id, 'theme' => $theme));
         $block->setRegion($theme_region);
         $block->save();
     }
 }