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\Codeception\Template\TemplateFactory;
use SmartWeb\ModuleTesting\Codeception\Template\TemplateFactoryInterface;
use SmartWeb\ModuleTesting\Codeception\Template\TemplateInterface;
use SmartWeb\ModuleTesting\Util\UsesDisk;
abstract class BaseGenerator implements Generator
{
use Namespaces, UsesDisk;
/**
* @var string
*/
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);
name
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: