19 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 {
140 public function readVariable(
string $a_group,
string $a_var_name):
string 142 if ($a_group !==
"db") {
143 throw new \LogicException(
144 "Can only access db-config via this mock." 147 switch ($a_var_name) {
149 return $this->config->getUser();
151 return $this->config->getHost();
153 return (
string) $this->config->getPort();
155 $pw = $this->config->getPassword();
156 return $pw ? $pw->toString() :
"";
158 return $this->config->getDatabase();
160 return $this->config->getType();
162 throw new \LogicException(
163 "Cannot provide variable '$a_var_name'" 172 public function read():
bool 174 throw new \LogicException(
"Just a mock here...");
176 public function parse():
bool 178 throw new \LogicException(
"Just a mock here...");
180 public function fixIniFile():
void 182 throw new \LogicException(
"Just a mock here...");
184 public function write():
bool 186 throw new \LogicException(
"Just a mock here...");
188 public function show():
string 190 throw new \LogicException(
"Just a mock here...");
192 public function getGroupCount():
int 194 throw new \LogicException(
"Just a mock here...");
196 public function readGroups(): array
198 throw new \LogicException(
"Just a mock here...");
200 public function groupExists(
string $a_group_name):
bool 202 throw new \LogicException(
"Just a mock here...");
204 public function readGroup(
string $a_group_name): array
206 throw new \LogicException(
"Just a mock here...");
208 public function addGroup(
string $a_group_name):
bool 210 throw new \LogicException(
"Just a mock here...");
212 public function removeGroup(
string $a_group_name):
bool 214 throw new \LogicException(
"Just a mock here...");
216 public function variableExists(
string $a_group,
string $a_var_name):
bool 218 throw new \LogicException(
"Just a mock here...");
220 public function setVariable(
string $a_group_name,
string $a_var_name,
string $a_var_value):
bool 222 throw new \LogicException(
"Just a mock here...");
224 public function error(
string $a_errmsg):
bool 226 throw new \LogicException(
"Just a mock here...");
228 public function getError():
string 230 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...