Testomatio - Test Management for Codeception
Codeception\Command\Shared\FileSystemTrait, Codeception\Command\Shared\StyleTraitCodeception templates allow creating a customized setup and configuration for your project.
An abstract class for installation template. Each init template should extend it and implement a setup method.
Use it to build a custom setup class which can be started with codecept init command.
<?php
namespace Codeception\Template; // it is important to use this namespace so codecept init could locate this template
class CustomInstall extends \Codeception\InitTemplate
{
     public function setup()
     {
        // implement this
     }
}This class provides various helper methods for building customized setup
public __construct($input, $output)
param \Symfony\Component\Console\Input\InputInterface $inputparam \Symfony\Component\Console\Output\OutputInterface $outputprotected addModulesToComposer(array $modules)
param array $modulesreturn ?intpublic addStyles($output)
param \Symfony\Component\Console\Output\OutputInterface $outputreturn voidprotected ask($question, $answer = null)
param string $questionparam array|string|bool|null $answerreturn mixed|string<?php
// propose firefox as default browser
$this->ask('select the browser of your choice', 'firefox');
// propose firefox or chrome possible options
$this->ask('select the browser of your choice', ['firefox', 'chrome']);
// ask true/false question
$this->ask('do you want to proceed (y/n)', true);protected breakParts($class)
param string $classreturn string[]protected checkInstalled($dir = β.β)
param string $dirreturn voidprotected completeSuffix($filename, $suffix)
param string $filenameparam string $suffixreturn stringprotected createActor($name, $directory, array $suiteConfig)
param string $nameparam string $directoryparam array $suiteConfigreturn voidCreate an Actor class and generate actions for it.
Requires a suite config as array in 3rd parameter.
protected createDirectoryFor($basePath, $className = ββ)
param string $basePathparam string $classNamereturn stringprotected createEmptyDirectory($dir)
param string $dirreturn voidCreate an empty directory and add a placeholder file into it
protected createFile($filename, $contents, $force = false, $flags = 0)
param string $filenameparam string $contentsparam bool $forceparam int $flagsreturn boolprotected createHelper($name, $directory, array $settings = array ( ))
param string $nameparam string $directoryparam array $settingsreturn voidCreate a helper class inside a directory
protected getNamespaceHeader($class)
param string $classreturn stringprotected getNamespaceString($class)
param string $classreturn stringprotected getNamespaces($class)
param string $classreturn arrayprotected getShortClassName($class)
param string $classreturn stringprotected gitIgnore($path)
param string $pathreturn voidpublic initDir($workDir)
param string $workDirreturn voidChange the directory where Codeception should be installed.
protected removeSuffix($classname, $suffix)
param string $classnameparam string $suffixreturn stringprotected say($message = ββ)
param string $messagereturn voidPrint a message to console.
<?php
$this->say('Welcome to Setup');protected sayError($message)
param string $messagereturn voidPrint error message
protected sayInfo($message)
param string $messagereturn voidPrint info message
protected saySuccess($message)
param string $messagereturn voidPrint a successful message
protected sayWarning($message)
param string $messagereturn voidPrint warning message
abstract public setup()
return mixedOverride this class to create customized setup.
private updateComposerClassMap($vendorDir = βvendorβ)
param string $vendorDirreturn void