Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
arogachev committed Nov 19, 2024
1 parent 2d1a81f commit b87162d
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions tests/Support/TestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,26 +78,51 @@ private function getDriver(): PdoDriverInterface

private static function getDatabaseName(): string
{
return getenv('YII_MYSQL_DATABASE');
if (self::isMariadb()) {
return getenv('YII_MARIADB_DATABASE') ?: '';
}

return getenv('YII_MYSQL_DATABASE') ?: '';
}

private static function getHost(): string
{
return getenv('YII_MYSQL_HOST');
if (self::isMariadb()) {
return getenv('YII_MARIADB_HOST') ?: '';
}

return getenv('YII_MYSQL_HOST') ?: '';
}

private static function getPort(): string
{
return getenv('YII_MYSQL_PORT');
if (self::isMariadb()) {
return getenv('YII_MARIADB_PORT') ?: '';
}

return getenv('YII_MYSQL_PORT') ?: '';
}

private static function getUsername(): string
{
return getenv('YII_MYSQL_USER');
if (self::isMariadb()) {
return getenv('YII_MARIADB_USER') ?: '';
}

return getenv('YII_MYSQL_USER') ?: '';
}

private static function getPassword(): string
{
return getenv('YII_MYSQL_PASSWORD');
if (self::isMariadb()) {
return getenv('YII_MARIADB_PASSWORD') ?: '';
}

return getenv('YII_MYSQL_PASSWORD') ?: '';
}

private static function isMariadb(): bool
{
return getenv('YII_MYSQL_TYPE') === 'mariadb';
}
}

0 comments on commit b87162d

Please sign in to comment.