Koha/t/lib/KohaTest/Installer.pm
Galen Charlton 8645d38f41 test suite: allow skipping of expensive tests
Defined a function attribute for KohaTest and subclasses
called 'Expensive'.  When a test method has that attribute,
it is skipped unless the RUN_EXPENSIVE_TESTS environment
variable is true.

To mark a test method, expensive, do this:

sub test_foo : Tests(4) Expensive { ... }

To mark a whole class and its subclasses expensive,
define a SKIP_CLASS sub (with empty body) with the
Expensive attribute:

sub SKIP_CLASS : Expensive { }

Updated the t/Makefile so that 'make test' runs
nonexpensive tests, while 'make fulltest' runs both
cheap and expensive tests.

Marked KohaTest::Installer test class expensive.

Signed-off-by: Andrew Moore <andrew.moore@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-05-19 13:25:57 -05:00

42 lines
1 KiB
Perl

package KohaTest::Installer;
use base qw( KohaTest );
use strict;
use warnings;
use Test::More;
use C4::Languages;
use C4::Installer;
sub SKIP_CLASS : Expensive { }
sub testing_class { 'C4::Installer' };
sub methods : Test( 1 ) {
my $self = shift;
my @methods = qw(
new
marcflavour_list
marc_framework_sql_list
sample_data_sql_list
sql_file_list
load_db_schema
load_sql_in_order
set_marcflavour_syspref
set_indexing_engine
set_version_syspref
load_sql
);
can_ok( $self->testing_class, @methods );
}
# ensure that we have a fresh, empty database
# after running through the installer tests
sub shutdown_50_init_db : Tests( shutdown ) {
my $self = shift;
KohaTest::clear_test_database();
KohaTest::create_test_database();
}
1;