for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace SmartWeb\ModuleTesting\Codeception\Generator;
use Codeception\Util\Shared\Namespaces;
use SmartWeb\ModuleTesting\Template\TemplateFactory;
use SmartWeb\ModuleTesting\Template\TemplateFactoryInterface;
use SmartWeb\ModuleTesting\Template\TemplateInterface;
/**
* Class BaseGenerator
*
* @package SmartWeb\ModuleTesting\Codeception\Generator
*/
abstract class BaseGenerator implements Generator
{
use Namespaces;
* @var string
protected $name;
private $suite;
private $template;
* @var TemplateFactoryInterface
private $factory;
* @var array
protected $settings;
* BaseGenerator constructor.
* @param string $suite
* @param string $template
public function __construct(string $suite, string $template)
$this->suite = $suite;
$this->template = $template;
$this->factory = new TemplateFactory();
}
* @return TemplateInterface
final public function getTemplate() : TemplateInterface
return $this->factory->getTemplate($this->template);
* @return string
final protected function getSuite() : string
return $this->suite;
public function produce() : string
return $this->getTemplate()->produceWith($this->settings);
protected function getNamespaceForTest() : string
return $this->settings['namespace'] . '\\' . $this->settings['testsDir'] . '\\' . $this->getSuite() . '\\' . $this->getNamespaceString($this->name);