ModuleContainer
in package
Class ModuleContainer
Table of Contents
Constants
- MAXIMUM_LEVENSHTEIN_DISTANCE = 5
- MODULE_NAMESPACE = '\Codeception\Module\\'
Properties
- $packages : mixed
- $actions : array<string|int, mixed>
- $active : array<string|int, mixed>
- $config : array<string|int, mixed>
- $di : Di
- $modules : array<string|int, mixed>
Methods
- __construct() : mixed
- Constructor.
- all() : array<string|int, mixed>
- Get all modules.
- create() : Module
- Create a module.
- getActions() : array<string|int, mixed>
- Get all actions.
- getModule() : Module
- Get a module from this ModuleContainer.
- hasModule() : bool
- Is a module instantiated in this ModuleContainer?
- mock() : mixed
- Mock a module in this ModuleContainer.
- moduleForAction() : Module|null
- Get the module for an action.
- throwMissingModuleExceptionWithSuggestion() : mixed
- validateConflicts() : mixed
- Check if there are conflicting modules in this ModuleContainer.
- getModuleSuggestion() : mixed
- checkForMissingDependencies() : mixed
- Check for missing dependencies.
- getActionsForModule() : array<string|int, mixed>
- Get the actions of a module.
- getConfiguredDependencies() : array<string|int, mixed>
- Get the configured dependencies for a module.
- getErrorMessageForDependency() : string
- Get the error message for a module dependency that is missing.
- getModuleClass() : string
- Get the fully qualified class name for a module.
- getModuleConfig() : array<string|int, mixed>
- Get the configuration for a module.
- getModuleDependencies() : array<string|int, mixed>
- Get the dependencies of a module.
- includeMethodAsAction() : bool
- Should a method be included as an action?
- injectModuleDependencies() : mixed
- Inject the dependencies of a module.
- isHelper() : bool
- Is the module a helper?
- moduleHasDependencies() : bool
- Does a module have dependencies?
- normalizeConflictSpecification() : string
- Normalize the return value of ConflictsWithModule::_conflicts() to a class name.
- validateConflict() : mixed
- Check if the modules passed as arguments to this method conflict with each other.
Constants
MAXIMUM_LEVENSHTEIN_DISTANCE
public
int
MAXIMUM_LEVENSHTEIN_DISTANCE
= 5
MODULE_NAMESPACE
public
string
MODULE_NAMESPACE
= '\Codeception\Module\\'
Properties
$packages
public
static mixed
$packages
= ['AMQP' => 'codeception/module-amqp', 'Apc' => 'codeception/module-apc', 'Asserts' => 'codeception/module-asserts', 'Cli' => 'codeception/module-cli', 'DataFactory' => 'codeception/module-datafactory', 'Db' => 'codeception/module-db', 'Doctrine2' => "codeception/module-doctrine2", 'Filesystem' => 'codeception/module-filesystem', 'FTP' => 'codeception/module-ftp', 'Laravel5' => 'codeception/module-laravel5', 'Lumen' => 'codeception/module-lumen', 'Memcache' => 'codeception/module-memcache', 'MongoDb' => 'codeception/module-mongodb', 'Phalcon' => 'codeception/module-phalcon', 'PhpBrowser' => 'codeception/module-phpbrowser', 'Queue' => 'codeception/module-queue', 'Redis' => 'codeception/module-redis', 'REST' => 'codeception/module-rest', 'Sequence' => 'codeception/module-sequence', 'SOAP' => 'codeception/module-soap', 'Symfony' => 'codeception/module-symfony', 'WebDriver' => "codeception/module-webdriver", 'Yii2' => "codeception/module-yii2", 'ZendExpressive' => 'codeception/module-zendexpressive', 'ZF2' => 'codeception/module-zf2']
$actions
private
array<string|int, mixed>
$actions
= []
$active
private
array<string|int, mixed>
$active
= []
$config
private
array<string|int, mixed>
$config
$di
private
Di
$di
$modules
private
array<string|int, mixed>
$modules
= []
Methods
__construct()
Constructor.
public
__construct(Di $di, array<string|int, mixed> $config) : mixed
Parameters
- $di : Di
- $config : array<string|int, mixed>
all()
Get all modules.
public
all() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array with module names as keys and modules as values.
create()
Create a module.
public
create(string $moduleName[, bool $active = true ]) : Module
Parameters
- $moduleName : string
- $active : bool = true
Tags
Return values
ModulegetActions()
Get all actions.
public
getActions() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array with actions as keys and module names as values.
getModule()
Get a module from this ModuleContainer.
public
getModule(string $moduleName) : Module
Parameters
- $moduleName : string
Tags
Return values
ModulehasModule()
Is a module instantiated in this ModuleContainer?
public
hasModule(string $moduleName) : bool
Parameters
- $moduleName : string
Return values
boolmock()
Mock a module in this ModuleContainer.
public
mock(string $moduleName, object $mock) : mixed
Parameters
- $moduleName : string
- $mock : object
moduleForAction()
Get the module for an action.
public
moduleForAction(string $action) : Module|null
Parameters
- $action : string
Return values
Module|null —This method returns null if there is no module for $action
throwMissingModuleExceptionWithSuggestion()
public
throwMissingModuleExceptionWithSuggestion(mixed $className, mixed $moduleName) : mixed
Parameters
- $className : mixed
- $moduleName : mixed
validateConflicts()
Check if there are conflicting modules in this ModuleContainer.
public
validateConflicts() : mixed
Tags
getModuleSuggestion()
protected
getModuleSuggestion(mixed $missingModuleName) : mixed
Parameters
- $missingModuleName : mixed
checkForMissingDependencies()
Check for missing dependencies.
private
checkForMissingDependencies(string $moduleName, DependsOnModule $module) : mixed
Parameters
- $moduleName : string
- $module : DependsOnModule
Tags
getActionsForModule()
Get the actions of a module.
private
getActionsForModule(Module $module, array<string|int, mixed> $config) : array<string|int, mixed>
Parameters
- $module : Module
- $config : array<string|int, mixed>
Return values
array<string|int, mixed>getConfiguredDependencies()
Get the configured dependencies for a module.
private
getConfiguredDependencies(string $moduleName) : array<string|int, mixed>
Parameters
- $moduleName : string
Return values
array<string|int, mixed>getErrorMessageForDependency()
Get the error message for a module dependency that is missing.
private
getErrorMessageForDependency(Module $module, string $missingDependency) : string
Parameters
- $module : Module
- $missingDependency : string
Return values
stringgetModuleClass()
Get the fully qualified class name for a module.
private
getModuleClass(string $moduleName) : string
Parameters
- $moduleName : string
Return values
stringgetModuleConfig()
Get the configuration for a module.
private
getModuleConfig(string $moduleName) : array<string|int, mixed>
A module with name $moduleName can be configured at two paths in a configuration file:
- modules.config.$moduleName
- modules.enabled.$moduleName
This method checks both locations for configuration. If there is configuration at both locations this method merges them, where the configuration at modules.enabled.$moduleName takes precedence over modules.config.$moduleName if the same parameters are configured at both locations.
Parameters
- $moduleName : string
Return values
array<string|int, mixed>getModuleDependencies()
Get the dependencies of a module.
private
getModuleDependencies(DependsOnModule $module) : array<string|int, mixed>
Parameters
- $module : DependsOnModule
Tags
Return values
array<string|int, mixed>includeMethodAsAction()
Should a method be included as an action?
private
includeMethodAsAction(Module $module, ReflectionMethod $method[, array<string|int, mixed>|null $configuredParts = null ]) : bool
Parameters
- $module : Module
- $method : ReflectionMethod
- $configuredParts : array<string|int, mixed>|null = null
Return values
boolinjectModuleDependencies()
Inject the dependencies of a module.
private
injectModuleDependencies(string $moduleName, DependsOnModule $module) : mixed
Parameters
- $moduleName : string
- $module : DependsOnModule
Tags
isHelper()
Is the module a helper?
private
isHelper(string $moduleName) : bool
Parameters
- $moduleName : string
Return values
boolmoduleHasDependencies()
Does a module have dependencies?
private
moduleHasDependencies(Module $module) : bool
Parameters
- $module : Module
Return values
boolnormalizeConflictSpecification()
Normalize the return value of ConflictsWithModule::_conflicts() to a class name.
private
normalizeConflictSpecification(string $conflicts) : string
This is necessary because it can return a module name instead of the name of a class or interface.
Parameters
- $conflicts : string
Return values
stringvalidateConflict()
Check if the modules passed as arguments to this method conflict with each other.
private
validateConflict(Module $module, Module $otherModule) : mixed