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 344-350
subtest 'Default values' => sub {
Link Here
|
344 |
|
344 |
|
345 |
subtest 'build_object() tests' => sub { |
345 |
subtest 'build_object() tests' => sub { |
346 |
|
346 |
|
347 |
plan tests => 5; |
347 |
plan tests => 6; |
348 |
|
348 |
|
349 |
$builder = t::lib::TestBuilder->new(); |
349 |
$builder = t::lib::TestBuilder->new(); |
350 |
|
350 |
|
Lines 371-376
subtest 'build_object() tests' => sub {
Link Here
|
371 |
is( $issuing_rule, undef, |
371 |
is( $issuing_rule, undef, |
372 |
'If the class parameter is missing, undef is returned' ); |
372 |
'If the class parameter is missing, undef is returned' ); |
373 |
|
373 |
|
|
|
374 |
subtest 'Test all classes' => sub { |
375 |
my $Koha_modules_dir = dirname(__FILE__) . '/../../Koha'; |
376 |
my @koha_object_based_modules = `/bin/grep -rl 'sub object_class' $Koha_modules_dir`; |
377 |
my @source_in_failure; |
378 |
for my $module_filepath ( @koha_object_based_modules ) { |
379 |
chomp $module_filepath; |
380 |
next unless $module_filepath =~ m|\.pm$|; |
381 |
my $module = $module_filepath; |
382 |
$module =~ s|^.*/(Koha.*)\.pm$|$1|; |
383 |
$module =~ s|/|::|g; |
384 |
next if $module eq 'Koha::Objects'; |
385 |
eval "require $module";; |
386 |
my $object = $builder->build_object( { class => $module } ); |
387 |
is( ref($object), $module->object_class ); |
388 |
} |
389 |
}; |
374 |
}; |
390 |
}; |
375 |
|
391 |
|
376 |
$schema->storage->txn_rollback; |
392 |
$schema->storage->txn_rollback; |
377 |
- |
|
|