Codeception\Lib\Generator\WPUnit::produce PHP Method

produce() public method

public produce ( )
    public function produce()
    {
        $ns = $this->getNamespaceHeader($this->settings['namespace'] . '\\' . $this->name);
        return (new Template($this->template))->place('namespace', $ns)->place('baseClass', $this->baseClass)->place('name', $this->getShortClassName($this->name))->produce();
    }

Usage Example

 public function execute(InputInterface $input, OutputInterface $output)
 {
     $suite = $input->getArgument('suite');
     $class = $input->getArgument('class');
     $config = $this->getSuiteConfig($suite, $input->getOption('config'));
     $path = $this->buildPath($config['path'], $class);
     $filename = $this->completeSuffix($this->getClassName($class), 'Test');
     $filename = $path . $filename;
     $gen = new WPUnitGenerator($config, $class);
     $res = $this->save($filename, $gen->produce());
     if (!$res) {
         $output->writeln("<error>Test {$filename} already exists</error>");
         exit;
     }
     $output->writeln("<info>Test was created in {$filename}</info>");
 }