Lines 21-27
use Modern::Perl;
Link Here
|
21 |
|
21 |
|
22 |
use Test::More tests => 12; |
22 |
use Test::More tests => 12; |
23 |
use Test::Warn; |
23 |
use Test::Warn; |
24 |
use Data::Dumper qw(Dumper); |
24 |
use File::Basename qw(dirname); |
25 |
|
25 |
|
26 |
use Koha::Database; |
26 |
use Koha::Database; |
27 |
use Koha::Patrons; |
27 |
use Koha::Patrons; |
Lines 346-352
subtest 'Default values' => sub {
Link Here
|
346 |
|
346 |
|
347 |
subtest 'build_object() tests' => sub { |
347 |
subtest 'build_object() tests' => sub { |
348 |
|
348 |
|
349 |
plan tests => 5; |
349 |
plan tests => 6; |
350 |
|
350 |
|
351 |
$builder = t::lib::TestBuilder->new(); |
351 |
$builder = t::lib::TestBuilder->new(); |
352 |
|
352 |
|
Lines 373-378
subtest 'build_object() tests' => sub {
Link Here
|
373 |
is( $issuing_rule, undef, |
373 |
is( $issuing_rule, undef, |
374 |
'If the class parameter is missing, undef is returned' ); |
374 |
'If the class parameter is missing, undef is returned' ); |
375 |
|
375 |
|
|
|
376 |
subtest 'Test all classes' => sub { |
377 |
my $Koha_modules_dir = dirname(__FILE__) . '/../../Koha'; |
378 |
my @koha_object_based_modules = `/bin/grep -rl 'sub object_class' $Koha_modules_dir`; |
379 |
my @source_in_failure; |
380 |
for my $module_filepath ( @koha_object_based_modules ) { |
381 |
chomp $module_filepath; |
382 |
next unless $module_filepath =~ m|\.pm$|; |
383 |
my $module = $module_filepath; |
384 |
$module =~ s|^.*/(Koha.*)\.pm$|$1|; |
385 |
$module =~ s|/|::|g; |
386 |
next if $module eq 'Koha::Objects'; |
387 |
eval "require $module";; |
388 |
my $object = $builder->build_object( { class => $module } ); |
389 |
is( ref($object), $module->object_class, "Testing $module" ); |
390 |
} |
391 |
}; |
376 |
}; |
392 |
}; |
377 |
|
393 |
|
378 |
$schema->storage->txn_rollback; |
394 |
$schema->storage->txn_rollback; |
379 |
- |
|
|