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

(-)a/C4/Installer.pm (-2 / +6 lines)
Lines 34-40 use vars qw(@ISA @EXPORT); Link Here
34
BEGIN {
34
BEGIN {
35
    require Exporter;
35
    require Exporter;
36
    @ISA = qw( Exporter );
36
    @ISA = qw( Exporter );
37
    push @EXPORT, qw( primary_key_exists unique_key_exists foreign_key_exists index_exists column_exists TableExists marc_framework_sql_list TransformToNum CheckVersion NewVersion SetVersion sanitize_zero_date update get_db_entries get_atomic_updates run_atomic_updates has_non_dynamic_row_format );
37
    push @EXPORT, qw( primary_key_exists unique_key_exists foreign_key_exists index_exists column_exists TableExists table_exists marc_framework_sql_list TransformToNum CheckVersion NewVersion SetVersion sanitize_zero_date update get_db_entries get_atomic_updates run_atomic_updates has_non_dynamic_row_format );
38
};
38
};
39
39
40
=head1 NAME
40
=head1 NAME
Lines 686-692 sub column_exists { Link Here
686
    return $exists;
686
    return $exists;
687
}
687
}
688
688
689
sub TableExists { # Could be renamed table_exists for consistency
689
sub TableExists { # Legacy name
690
    my $table = shift;
690
    my $table = shift;
691
    eval {
691
    eval {
692
                my $dbh = C4::Context->dbh;
692
                my $dbh = C4::Context->dbh;
Lines 698-703 sub TableExists { # Could be renamed table_exists for consistency Link Here
698
    return 0;
698
    return 0;
699
}
699
}
700
700
701
sub table_exists { # More consistently named alias for TableExists
702
    return TableExists(@_);
703
}
704
701
sub version_from_file {
705
sub version_from_file {
702
    my $file = shift;
706
    my $file = shift;
703
    return unless $file =~ m|(^\|/)(\d{2})(\d{2})(\d{2})(\d{3}).pl$|;
707
    return unless $file =~ m|(^\|/)(\d{2})(\d{2})(\d{2})(\d{3}).pl$|;
(-)a/t/db_dependent/Installer.t (-6 / +11 lines)
Lines 18-35 Link Here
18
# You should have received a copy of the GNU General Public License
18
# You should have received a copy of the GNU General Public License
19
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
# along with Koha; if not, see <http://www.gnu.org/licenses>.
20
20
21
# This Koha test module is still a stub!
22
# Add more tests here!!!
23
24
use Modern::Perl;
21
use Modern::Perl;
25
use Test::More tests => 22;
22
use Test::More tests => 23;
26
use File::Temp qw(tempfile);
23
use File::Temp qw(tempfile);
27
use utf8;
24
use utf8;
28
25
29
use Koha::Database;
26
use Koha::Database;
30
27
31
BEGIN {
28
BEGIN {
32
    use_ok('C4::Installer', qw( column_exists index_exists unique_key_exists foreign_key_exists primary_key_exists marc_framework_sql_list ));
29
    use_ok(
30
        'C4::Installer',
31
        qw( column_exists index_exists unique_key_exists foreign_key_exists primary_key_exists marc_framework_sql_list table_exists )
32
    );
33
}
33
}
34
34
35
ok( my $installer = C4::Installer->new(), 'Testing NewInstaller' );
35
ok( my $installer = C4::Installer->new(), 'Testing NewInstaller' );
Lines 77-82 ok( primary_key_exists( 'borrowers' ), 'Borrowers does have a primary key on som Link Here
77
ok( primary_key_exists( 'borrowers', 'borrowernumber'), 'Borrowers has primary key on borrowernumber');
77
ok( primary_key_exists( 'borrowers', 'borrowernumber'), 'Borrowers has primary key on borrowernumber');
78
ok( ! primary_key_exists( 'borrowers', 'email'), 'Borrowers does not have a primary key on email');
78
ok( ! primary_key_exists( 'borrowers', 'email'), 'Borrowers does not have a primary key on email');
79
79
80
subtest 'table_exists' => sub {
81
    plan tests => 2;
82
    is( table_exists( 'borrowers' ), 1, 'Table borrowers still exists ;)' );
83
    is( table_exists( 'this_table_will_never_exist' ), 0, 'This table does not exist, not likely to be created too' );
84
};
85
80
subtest 'marc_framework_sql_list' => sub {
86
subtest 'marc_framework_sql_list' => sub {
81
    plan tests => 1;
87
    plan tests => 1;
82
88
83
- 

Return to bug 33537