3declare(strict_types=1);
61 throw new \InvalidArgumentException(
62 "Unknown database type: $type"
66 throw new \InvalidArgumentException(
67 "Unknown collation: $collation"
70 $this->type = trim(
$type);
71 $this->host = trim(
$host);
131 return new class ($this) extends \
ilIniFile {
139 public function readVariable(
string $a_group,
string $a_var_name):
string
141 if ($a_group !==
"db") {
142 throw new \LogicException(
143 "Can only access db-config via this mock."
146 switch ($a_var_name) {
148 return $this->config->getUser();
150 return $this->config->getHost();
152 return (
string) $this->config->getPort();
154 $pw = $this->config->getPassword();
155 return $pw ? $pw->toString() :
"";
157 return $this->config->getDatabase();
159 return $this->config->getType();
161 throw new \LogicException(
162 "Cannot provide variable '$a_var_name'"
171 public function read():
bool
173 throw new \LogicException(
"Just a mock here...");
175 public function parse():
bool
177 throw new \LogicException(
"Just a mock here...");
179 public function fixIniFile():
void
181 throw new \LogicException(
"Just a mock here...");
183 public function write():
bool
185 throw new \LogicException(
"Just a mock here...");
187 public function show():
string
189 throw new \LogicException(
"Just a mock here...");
193 throw new \LogicException(
"Just a mock here...");
197 throw new \LogicException(
"Just a mock here...");
199 public function groupExists(
string $a_group_name):
bool
201 throw new \LogicException(
"Just a mock here...");
203 public function readGroup(
string $a_group_name): array
205 throw new \LogicException(
"Just a mock here...");
207 public function addGroup(
string $a_group_name):
bool
209 throw new \LogicException(
"Just a mock here...");
211 public function removeGroup(
string $a_group_name):
bool
213 throw new \LogicException(
"Just a mock here...");
215 public function variableExists(
string $a_group,
string $a_var_name):
bool
217 throw new \LogicException(
"Just a mock here...");
219 public function setVariable(
string $a_group_name,
string $a_var_name,
string $a_var_value):
bool
221 throw new \LogicException(
"Just a mock here...");
223 public function error(
string $a_errmsg):
bool
225 throw new \LogicException(
"Just a mock here...");
229 throw new \LogicException(
"Just a mock here...");
A password is used as part of credentials for authentication.
variableExists(string $a_group, string $a_var_name)
returns if a variable exists or not
show()
returns the content of IniFile
readGroups()
returns an array with the names of all the groups
getGroupCount()
returns number of groups
removeGroup(string $a_group_name)
removes a group
readGroup(string $a_group_name)
returns an associative array of the variables in one group
setVariable(string $a_group_name, string $a_var_name, string $a_var_value)
sets a variable in a group
readVariable(string $a_group, string $a_var_name)
reads a single variable from a group
groupExists(string $a_group_name)
checks if a group exists
addGroup(string $a_group_name)
adds a new group
static getAvailableCollations()
static getInstallableTypes()
toMockIniFile()
Adapter to current database-handling via a mock of \ilIniFile.
const DEFAULT_PATH_TO_DB_DUMP
ilDatabaseSetupConfig $config
__construct(string $type, string $host, string $database, string $user, Password $password=null, bool $create_database=true, string $collation=null, int $port=null, string $path_to_db_dump=null)
ILIAS Data Password $password
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
A configuration for the setup.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...