3 declare(strict_types=1);
55 bool $create_database =
true,
56 string $collation = null,
58 string $path_to_db_dump = null
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);
72 $this->database = trim($database);
73 $this->
user = trim($user);
76 $this->collation = $collation ? trim($collation) : self::DEFAULT_COLLATION;
78 $this->path_to_db_dump = $path_to_db_dump ?? self::DEFAULT_PATH_TO_DB_DUMP;
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...");
191 public function getGroupCount():
int 193 throw new \LogicException(
"Just a mock here...");
195 public function readGroups(): array
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...");
227 public function getError():
string 229 throw new \LogicException(
"Just a mock here...");
toMockIniFile()
Adapter to current database-handling via a mock of .
A password is used as part of credentials for authentication.
ILIAS Data Password $password
ilDatabaseSetupConfig $config
static getAvailableCollations()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__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)
const DEFAULT_PATH_TO_DB_DUMP
static getInstallableTypes()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...