Changed config.ini hierarchy
This commit is contained in:
parent
f3096ffc5d
commit
ff310f56c5
3 changed files with 15 additions and 10 deletions
10
config.ini
10
config.ini
|
@ -1,3 +1,7 @@
|
|||
databaseHost = localhost
|
||||
databasePort = 27017;
|
||||
databaseName = booru-dev
|
||||
[database]
|
||||
host = localhost
|
||||
port = 27017;
|
||||
name = booru-dev
|
||||
|
||||
[security]
|
||||
secret = change
|
||||
|
|
|
@ -10,7 +10,7 @@ final class DatabaseConnection
|
|||
{
|
||||
$connectionString = $this->getConnectionString($config);
|
||||
$this->connection = new \MongoClient($connectionString);
|
||||
$this->database = $this->connection->selectDb($config->databaseName);
|
||||
$this->database = $this->connection->selectDb($config->database->name);
|
||||
}
|
||||
|
||||
public function getConnection()
|
||||
|
@ -27,8 +27,8 @@ final class DatabaseConnection
|
|||
{
|
||||
return sprintf(
|
||||
'mongodb://%s:%d/%s',
|
||||
$config->databaseHost,
|
||||
$config->databasePort,
|
||||
$config->databaseName);
|
||||
$config->database->host,
|
||||
$config->database->port,
|
||||
$config->database->name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,9 +12,10 @@ abstract class AbstractDatabaseTest extends \PHPUnit_Framework_TestCase
|
|||
$port = 27017;
|
||||
$database = 'test';
|
||||
$config = new \Szurubooru\Config();
|
||||
$config->databaseHost = 'localhost';
|
||||
$config->databasePort = 27017;
|
||||
$config->databaseName = 'test';
|
||||
$config->database = new \StdClass;
|
||||
$config->database->host = 'localhost';
|
||||
$config->database->port = 27017;
|
||||
$config->database->name = 'test';
|
||||
$this->databaseConnection = new \Szurubooru\DatabaseConnection($config);
|
||||
$this->upgradeService = new \Szurubooru\UpgradeService($this->databaseConnection);
|
||||
$this->upgradeService->prepareForUsage();
|
||||
|
|
Loading…
Reference in a new issue