From a55bf5c59515c4121e6bd9d93ba19607344f09f6 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 21 Jan 2020 15:46:53 -0300 Subject: [PATCH] Bug 24356: prefetch_whitelist tests This patch adds tests for the introduced methods. To test: 1. Run the tests :-D => SUCCESS: They pass! 2. Sign off :-D Signed-off-by: David Nind Signed-off-by: Martin Renvoize --- t/db_dependent/Koha/Object.t | 25 ++++++++++++++++++++++++- t/db_dependent/Koha/Objects.t | 28 ++++++++++++++++++++++++++-- 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/t/db_dependent/Koha/Object.t b/t/db_dependent/Koha/Object.t index 4b7d0ce913..40f117007e 100755 --- a/t/db_dependent/Koha/Object.t +++ b/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; +}; diff --git a/t/db_dependent/Koha/Objects.t b/t/db_dependent/Koha/Objects.t index 56cf4af05d..891f30f393 100644 --- a/t/db_dependent/Koha/Objects.t +++ b/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::Patron::Category; use Koha::Patron::Categories; use Koha::Patrons; @@ -776,4 +777,27 @@ subtest "from_api_mapping() tests" => sub { ); $schema->storage->txn_rollback; -}; \ No newline at end of file +}; + +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; +}; -- 2.20.1