src/Context/SQLHandler.php
public function setDBParams(array $dbParams = array())
    {
        if (defined('SQLDBENGINE')) {
            $this->params = [
                'DBSCHEMA' => SQLDBSCHEMA,
                'DBNAME' => SQLDBNAME,
                'DBPREFIX' => SQLDBPREFIX
            ];

            // Allow params to be over-ridable.
            $this->params['DBHOST'] = (isset($dbParams['host']) ? $dbParams['host'] : SQLDBHOST);
            $this->params['DBUSER'] = (isset($dbParams['username']) ? $dbParams['username'] : SQLDBUSERNAME);
            $this->params['DBPASSWORD'] = (isset($dbParams['password']) ? $dbParams['password'] : SQLDBPASSWORD);
            $this->params['DBENGINE'] = (isset($dbParams['engine']) ? $dbParams['engine'] : SQLDBENGINE);
        } else {
            $params = getenv('BEHAT_ENV_PARAMS');

            if (! $params) {
                throw new \Exception('"BEHAT_ENV_PARAMS" environment variable was not found.');
            }

            $params = explode(';', $params);

            foreach ($params as $param) {
                list($key, $val) = explode(':', $param);
                $this->params[$key] = trim($val);
            }
        }

        return $this;
    }
public function setDBParams(array $dbParams = array())
    {
        if (defined('SQLDBENGINE')) {
            $this->params = [
                'DBSCHEMA' => SQLDBSCHEMA,
                'DBNAME' => SQLDBNAME,
                'DBPREFIX' => SQLDBPREFIX
            ];

            // Allow params to be over-ridable.
            $this->params['DBHOST'] = (isset($dbParams['host']) ? $dbParams['host'] : SQLDBHOST);
            $this->params['DBUSER'] = (isset($dbParams['username']) ? $dbParams['username'] : SQLDBUSERNAME);
            $this->params['DBPASSWORD'] = (isset($dbParams['password']) ? $dbParams['password'] : SQLDBPASSWORD);
            $this->params['DBENGINE'] = (isset($dbParams['engine']) ? $dbParams['engine'] : SQLDBENGINE);
        } else {
            $params = getenv('BEHAT_ENV_PARAMS');

            if (! $params) {
                throw new \Exception('"BEHAT_ENV_PARAMS" environment variable was not found.');
            }

            $params = explode(';', $params);

            foreach ($params as $param) {
                list($key, $val) = explode(':', $param);
                $this->params[$key] = trim($val);
            }
        }

        return $this;
    }
public function setDBParams ( array $ dbParams = array ( ) ) { if ( defined ( 'SQLDBENGINE' ) ) { $ this -> params = [ 'DBSCHEMA' => SQLDBSCHEMA , 'DBNAME' => SQLDBNAME , 'DBPREFIX' => SQLDBPREFIX ] ; // Allow params to be over-ridable. $ this -> params [ 'DBHOST' ] = ( isset ( $ dbParams [ 'host' ] ) ? $ dbParams [ 'host' ] : SQLDBHOST ) ; $ this -> params [ 'DBUSER' ] = ( isset ( $ dbParams [ 'username' ] ) ? $ dbParams [ 'username' ] : SQLDBUSERNAME ) ; $ this -> params [ 'DBPASSWORD' ] = ( isset ( $ dbParams [ 'password' ] ) ? $ dbParams [ 'password' ] : SQLDBPASSWORD ) ; $ this -> params [ 'DBENGINE' ] = ( isset ( $ dbParams [ 'engine' ] ) ? $ dbParams [ 'engine' ] : SQLDBENGINE ) ; } else { $ params = getenv ( 'BEHAT_ENV_PARAMS' ) ; if ( ! $ params ) { throw new \ Exception ( '"BEHAT_ENV_PARAMS" environment variable was not found.' ) ; } $ params = explode ( ';' , $ params ) ; foreach ( $ params as $ param ) { list ( $ key , $ val ) = explode ( ':' , $ param ) ; $ this -> params [ $ key ] = trim ( $ val ) ; } } return $ this ; }
Sets the database param from either the environment variable or params
passed in by behat.yml, params have precedence over env variable.
Sets the database param from either the environment variable or params passed in by behat . yml params have precedence over env variable .