Exemplo n.º 1
0
 /**
  * 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();
 }
 /**
  * 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}'");
     }
 }
Exemplo n.º 3
0
 /**
  * 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();
 }
 /**
  * @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"))));
         }
     }
 }