Koha/t/db_dependent/Koha_Database.t
Chris Cormack 398b9dfdbd Bug 8798: moving code to Koha::Database and adding tests
- Fixing a bug .. ping does not exist we need to use connected

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-14 21:08:02 +00:00

27 lines
710 B
Perl

#!/usr/bin/perl
#
use strict;
use warnings;
use Test::More tests => 9;
BEGIN {
use_ok('Koha::Database');
}
my $database;
ok( $database = Koha::Database->new(), 'Created Koha::Database Object' );
my $schema;
ok( $schema = $database->schema(), 'Get a schema' );
my $dbh;
ok( $dbh = $schema->storage->dbh(), 'Get an old fashioned DBI dbh handle' );
ok( $schema->storage->connected(), 'Check our db connection is active' );
ok( $schema = $database->schema(), 'Try and get the same schema' );
my $new_schema;
ok( $new_schema = $database->new_schema(), 'Try to get a new schema' );
ok( $database->set_schema($new_schema), 'Switch to new schema' );
ok( $database->restore_schema(), 'Switch back' );