/** * PluginRestResource generator test * * @param $module * @param $class_name * @param $plugin_label * @param $plugin_id * @param $plugin_url * @param $plugin_states * * @dataProvider commandData */ public function testGeneratePluginRestResource($module, $class_name, $plugin_label, $plugin_id, $plugin_url, $plugin_states) { $generator = new PluginRestResourceGenerator(); $this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs()); $this->getRenderHelper()->setTranslator($this->getTranslatorHelper()); $generator->setHelperSet($this->getHelperSet()); $generator->generate($module, $class_name, $plugin_label, $plugin_id, $plugin_url, $plugin_states); $this->assertTrue(file_exists($generator->getSite()->getPluginPath($module, 'rest') . '/resource/' . $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; } $module = $input->getOption('module'); $class_name = $input->getOption('class'); $plugin_id = $input->getOption('plugin-id'); $plugin_label = $input->getOption('plugin-label'); $plugin_url = $input->getOption('plugin-url'); $plugin_states = $input->getOption('plugin-states'); $this->generator->generate($module, $class_name, $plugin_label, $plugin_id, $plugin_url, $plugin_states); $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); }