70 throw new \InvalidArgumentException(
71 "Unknown database type: $type"
75 throw new \InvalidArgumentException(
76 "Unknown collation: $collation"
79 $this->type = trim(
$type);
80 $this->host = trim(
$host);
140 return new class($this) extends \
ilIniFile {
150 if ($a_group !==
"db") {
151 throw new \LogicException(
152 "Can only access db-config via this mock."
155 switch ($a_var_name) {
157 return $this->config->getUser();
159 return $this->config->getHost();
161 return $this->config->getPort();
163 $pw = $this->config->getPassword();
164 return $pw ? $pw->toString() :
null;
166 return $this->config->getDatabase();
168 return $this->config->getType();
170 throw new \LogicException(
171 "Cannot provide variable '$a_var_name'"
179 public function read()
181 throw new \LogicException(
"Just a mock here...");
183 public function parse()
185 throw new \LogicException(
"Just a mock here...");
187 public function fixIniFile()
189 throw new \LogicException(
"Just a mock here...");
191 public function write()
193 throw new \LogicException(
"Just a mock here...");
195 public function show()
197 throw new \LogicException(
"Just a mock here...");
201 throw new \LogicException(
"Just a mock here...");
205 throw new \LogicException(
"Just a mock here...");
209 throw new \LogicException(
"Just a mock here...");
213 throw new \LogicException(
"Just a mock here...");
215 public function addGroup($a_group_name)
217 throw new \LogicException(
"Just a mock here...");
221 throw new \LogicException(
"Just a mock here...");
225 throw new \LogicException(
"Just a mock here...");
227 public function setVariable($a_group_name, $a_var_name, $a_var_value)
229 throw new \LogicException(
"Just a mock here...");
231 public function error($a_errmsg)
233 throw new \LogicException(
"Just a mock here...");
237 throw new \LogicException(
"Just a mock here...");
An exception for terminatinating execution or to throw for unit testing.
A password is used as part of credentials for authentication.
getError()
returns error @access public
show()
returns the content of IniFile @access public
readGroups()
returns an array with the names of all the groups @access public
variableExists($a_group, $a_var_name)
returns if a variable exists or not @access public
getGroupCount()
returns number of groups @access public
removeGroup($a_group_name)
removes a group @access public
readGroup($a_group_name)
returns an associative array of the variables in one group @access public
addGroup($a_group_name)
adds a new group @access public
readVariable($a_group, $a_var_name)
reads a single variable from a group @access public
setVariable($a_group_name, $a_var_name, $a_var_value)
sets a variable in a group @access public
groupExists($a_group_name)
checks if a group exists @access public
error($a_errmsg)
set error message @access public
static getAvailableCollations()
static getInstallableTypes()
toMockIniFile()
Adapter to current database-handling via a mock of \ilIniFile.
const DEFAULT_PATH_TO_DB_DUMP
__construct( $type, string $host, string $database, string $user, Password $password=null, bool $create_database=true, string $collation=null, string $port=null, string $path_to_db_dump=null)
A configuration for the setup.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...