/** * PluginRulesAction generator test * * @param $module * @param $class_name * @param $label * @param $plugin_id * @param $category * @param $context, * @param $type * * @dataProvider commandData */ public function testGeneratePluginRulesAction($module, $class_name, $label, $plugin_id, $category, $context, $type) { $generator = new PluginRulesActionGenerator(); $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, $category, $context, $type); $files = [$generator->getSite()->getPluginPath($module, 'Action') . '/' . $class_name . '.php', $generator->getSite()->getModulePath($module) . '/config/install/system.action.' . $plugin_id . '.yml']; foreach ($files as $file) { $this->assertTrue(file_exists($file), sprintf('%s does not exist', $file)); } }
/** * {@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; } $module = $input->getOption('module'); $class_name = $input->getOption('class'); $label = $input->getOption('label'); $plugin_id = $input->getOption('plugin-id'); $type = $input->getOption('type'); $category = $input->getOption('category'); $context = $input->getOption('context'); $this->generator->generate($module, $class_name, $label, $plugin_id, $category, $context, $type); $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); }