Bug 29915: Add selenium tests
[srvgit] / Koha / Database.pm
index 2dc5101..376f910 100644 (file)
@@ -37,12 +37,25 @@ use Koha::Config;
 
 our $database;
 
-# FIXME: It is useless to have a Koha::Database object since all methods
-# below act as class methods
-# Koha::Database->new->schema is exactly the same as Koha::Database->schema
-# We should use Koha::Database->schema everywhere and remove the `new` method
+=head2 new
+
+    $schema = Koha::Database->new->schema;
+
+    FIXME: It is useless to have a Koha::Database object since all methods
+    below act as class methods
+    Koha::Database->new->schema is exactly the same as Koha::Database->schema
+    We should use Koha::Database->schema everywhere and remove the `new` method
+
+=cut
+
 sub new { bless {}, shift }
 
+=head2 dbh
+
+    Returns a database handler without loading the DBIx::Class schema.
+
+=cut
+
 sub dbh {
     my $config = Koha::Config->get_instance;
     my $driver = db_scheme2dbi($config->get('db_scheme'));
@@ -51,7 +64,7 @@ sub dbh {
     my $dsn = sprintf(
         'dbi:%s:database=%s;host=%s;port=%s',
         $driver,
-        $config->get("database"),
+        $config->get("database_test") || $config->get("database"),
         $config->get("hostname"),
         $config->get("port") || '',
     );