本文整理汇总了PHP中Codeception\Module::validateConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP Module::validateConfig方法的具体用法?PHP Module::validateConfig怎么用?PHP Module::validateConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Codeception\Module
的用法示例。
在下文中一共展示了Module::validateConfig方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validateConfig
/**
* Provide and override for the config settings and allow custom settings depending on the service being used.
*/
protected function validateConfig()
{
$this->IMDriver = $this->createIMDriver();
$this->requiredFields = $this->IMDriver->getRequiredConfig();
$this->config = array_merge($this->IMDriver->getDefaultConfig(), $this->config);
parent::validateConfig();
}
示例2: validateConfig
/**
* Ensure the class specified is valid.
*
* @see \Codeception\Module::validateConfig()
* @throws \Codeception\Exception\ModuleConfig
*/
protected function validateConfig()
{
parent::validateConfig();
$class = $this->config['class'];
if (!class_exists($class)) {
throw new \Codeception\Exception\ModuleConfig("DrupalVariable", "Invalid config. Class '{$class}' does not exist");
}
$interface = "Codeception\\Module\\Drupal\\Variable\\VariableStorage\\StorageInterface";
if (!in_array($interface, class_implements($class))) {
throw new \Codeception\Exception\ModuleConfig("DrupalVariable", "Invalid config. Class '{$class}' must implement '{$interface}'");
}
}
示例3: validateConfig
/**
* Provide and override for the config settings and allow custom settings depending on the service being used.
*/
protected function validateConfig()
{
// Customisable requirement fields depending on the queue type selected. (aws_sqs, iron_mq, beanstalkq)
switch (strtolower($this->config['type'])) {
case 'aws':
case 'sqs':
case 'aws_sqs':
$this->requiredFields = array('key', 'secret', 'region');
break;
case 'iron':
case 'iron_mq':
$this->requiredFields = array('host', 'token', 'project');
break;
default:
$this->requiredFields = array('host');
$this->config = array_merge(array('port' => 11300, 'timeout' => 90), $this->config);
}
parent::validateConfig();
}
示例4: validateConfig
/**
* @inheritdoc
*/
protected function validateConfig()
{
parent::validateConfig();
// If windows, certain chars cannot be passed safely as
// an argument.
// See escapeshellarg().
// See https://github.com/ixis/codeception-module-drupal-user-registry/issues/13
if (!$this->isWindows()) {
return;
}
$chars = array('!', '%', '"');
$values = array();
foreach ($this->config['users'] as $user) {
foreach ($user as $key => $value) {
switch ($key) {
// We don't need to validate root, a boolean value.
case 'root':
continue;
// roles should be an non-associative array of role name values.
// roles should be an non-associative array of role name values.
case 'roles':
$values = array_merge($values, $value);
break;
// All other values should be validated.
// All other values should be validated.
default:
$values[] = $value;
}
}
}
// If the defaultPass key is set, validate this too.
if (isset($this->config['defaultPass'])) {
$values = array_merge(array($this->config['defaultPass']), $values);
}
foreach ($values as $value) {
$present = array_filter($chars, function ($char) use($value) {
return strpos($value, $char) !== false;
});
if (!empty($present)) {
throw new Exception\ModuleConfig(get_class($this), sprintf("\nOn windows, the characters %s cannot be used for %s\n\n", implode(", ", $chars), implode(", ", array("roles", "password"))));
}
}
}