/**
  * @return Database the database currently connected to
  * @throws DatabaseConfigurationNotLoadedException if connect was not called
  */
 public static function connection()
 {
     if (!self::$database instanceof Database) {
         if (empty(self::$databaseConfigFile)) {
             throw new DatabaseConfigurationNotLoadedException();
         }
         self::$database = new Database(DatabaseConfig::parseFromFile(self::$databaseConfigFile));
     }
     return self::$database;
 }
Example #2
0
 private function createDatabase()
 {
     $this->database = new Database(DatabaseConfig::parseFromFile("tests/Database/testdatabase.json"));
     $this->assertNotNull($this->database);
 }