3 namespace DrupalCodeGenerator\Command\Drupal_8\Test;
5 use DrupalCodeGenerator\Command\BaseGenerator;
6 use DrupalCodeGenerator\Utils;
7 use Symfony\Component\Console\Input\InputInterface;
8 use Symfony\Component\Console\Output\OutputInterface;
9 use Symfony\Component\Console\Question\Question;
12 * Implements d8:test:unit command.
14 class Unit extends BaseGenerator {
16 protected $name = 'd8:test:unit';
17 protected $description = 'Generates a unit test';
18 protected $alias = 'unit-test';
23 protected function interact(InputInterface $input, OutputInterface $output) {
24 $questions = Utils::defaultQuestions();
25 $questions['class'] = new Question('Class', 'ExampleTest');
26 $questions['class']->setValidator([Utils::class, 'validateClassName']);
28 $this->collectVars($input, $output, $questions);
31 ->path('tests/src/Unit/{class}.php')
32 ->template('d8/test/unit.twig');