View | Details | Raw Unified | Return to bug 19821
Collapse All | Expand All

(-)a/t/lib/Bootstrap.pm (-6 / +9 lines)
Lines 6-12 use DBI; Link Here
6
use File::Temp qw( tempfile );
6
use File::Temp qw( tempfile );
7
use XML::LibXML;
7
use XML::LibXML;
8
8
9
our $database;
9
our ( $database, $database_test );
10
sub import {
10
sub import {
11
    my ($self, %args) = @_;
11
    my ($self, %args) = @_;
12
12
Lines 15-21 sub import { Link Here
15
15
16
    my $host = C4::Context->config('hostname');
16
    my $host = C4::Context->config('hostname');
17
    my $port = C4::Context->config('port');
17
    my $port = C4::Context->config('port');
18
    $database = C4::Context->config("database_test") || C4::Context->config('database');
18
    $database_test = C4::Context->config("database_test") or die "Config entry 'database_test' does not exist";
19
    $database = C4::Context->config('database');
20
    die "Entries 'database_test' and 'database' have the same value in your config"
21
        if $database_test eq $database;
19
    my $user = C4::Context->config('user');
22
    my $user = C4::Context->config('user');
20
    my $pass = C4::Context->config('pass');
23
    my $pass = C4::Context->config('pass');
21
24
Lines 24-37 sub import { Link Here
24
        PrintError => 0,
27
        PrintError => 0,
25
    });
28
    });
26
29
27
    $dbh->do("DROP DATABASE IF EXISTS $database");
30
    $dbh->do("DROP DATABASE IF EXISTS $database_test");
28
    $dbh->do("CREATE DATABASE $database");
31
    $dbh->do("CREATE DATABASE $database_test");
29
32
30
}
33
}
31
34
32
END {
35
END {
33
    my $dbh = C4::Context->dbh;
36
    my $dbh = C4::Context->dbh;
34
    $dbh->do("DROP DATABASE IF EXISTS $database") if $database;
37
    $dbh->do("DROP DATABASE IF EXISTS $database_test")
38
      if $database_test && $database_test ne $database;
35
    Koha::Caches->get_instance()->flush_all;
39
    Koha::Caches->get_instance()->flush_all;
36
    Koha::Caches->get_instance('config')->flush_all;
40
    Koha::Caches->get_instance('config')->flush_all;
37
};
41
};
38
- 

Return to bug 19821