@@ -, +, @@ --- t/db_dependent/Koha/Object.t | 25 ++++++++++++++++++++++++- t/db_dependent/Koha/Objects.t | 28 ++++++++++++++++++++++++++-- 2 files changed, 50 insertions(+), 3 deletions(-) --- a/t/db_dependent/Koha/Object.t +++ a/t/db_dependent/Koha/Object.t @@ -17,7 +17,7 @@ use Modern::Perl; -use Test::More tests => 18; +use Test::More tests => 19; use Test::Exception; use Test::Warn; use DateTime; @@ -795,3 +795,26 @@ subtest 'get_from_storage' => sub { $schema->storage->txn_rollback; }; + +subtest 'prefetch_whitelist() tests' => sub { + + plan tests => 2; + + $schema->storage->txn_begin; + + my $biblio = Koha::Biblio->new; + + my $prefetch_whitelist = $biblio->prefetch_whitelist; + + ok( + exists $prefetch_whitelist->{orders}, + 'Relationship matching method name is listed' + ); + is( + $prefetch_whitelist->{orders}, + 'Koha::Acquisition::Order', + 'Guessed the object class correctly' + ); + + $schema->storage->txn_rollback; +}; --- a/t/db_dependent/Koha/Objects.t +++ a/t/db_dependent/Koha/Objects.t @@ -19,12 +19,13 @@ use Modern::Perl; -use Test::More tests => 20; +use Test::More tests => 21; use Test::Exception; use Test::Warn; use Koha::Authority::Types; use Koha::Cities; +use Koha::Biblios; use Koha::IssuingRules; use Koha::Patron::Category; use Koha::Patron::Categories; @@ -783,4 +784,27 @@ subtest "from_api_mapping() tests" => sub { ); $schema->storage->txn_rollback; -}; +}; + +subtest 'prefetch_whitelist() tests' => sub { + + plan tests => 2; + + $schema->storage->txn_begin; + + my $biblios = Koha::Biblios->new; + + my $prefetch_whitelist = $biblios->prefetch_whitelist; + + ok( + exists $prefetch_whitelist->{orders}, + 'Relationship matching method name is listed' + ); + is( + $prefetch_whitelist->{orders}, + 'Koha::Acquisition::Order', + 'Guessed the object class correctly' + ); + + $schema->storage->txn_rollback; +}; --