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 <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Tomás Cohen Arazi 2020-01-21 15:46:53 -03:00 committed by Martin Renvoize
parent e875e39806
commit a7bf8a488f
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F
2 changed files with 50 additions and 3 deletions

View file

@ -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;
};

View file

@ -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;
};
};
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;
};