Bug 34609: Add tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit eaa1a1d7e2)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 315927af8b)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
This commit is contained in:
Pedro Amorim 2023-08-30 13:13:04 +00:00 committed by Matt Blenkinsop
parent 19e908b483
commit 1ffc2d4501
1 changed files with 39 additions and 1 deletions

View File

@ -17,7 +17,7 @@
use Modern::Perl;
use Test::More tests => 1;
use Test::More tests => 2;
use Test::Exception;
use Koha::Database;
@ -80,3 +80,41 @@ subtest 'anonymize() tests' => sub {
$schema->storage->txn_rollback;
};
subtest 'biblio() tests' => sub {
plan tests => 3;
$schema->storage->txn_begin;
my $hold_1 = $builder->build_object(
{
class => 'Koha::Old::Holds',
value => { biblionumber => undef }
}
);
is( $hold_1->biblio, undef, 'Old hold has no biblionumber, returns undef' );
my $hold_2 = $builder->build_object(
{
class => 'Koha::Old::Holds',
value => { biblionumber => '' }
}
);
is( $hold_1->biblio, undef, 'Old hold has empty biblionumber, returns undef' );
my $biblio = $builder->build_object( { class => 'Koha::Biblios' } );
my $hold_3 = $builder->build_object(
{
class => 'Koha::Old::Holds',
value => { biblionumber => $biblio->biblionumber }
}
);
is_deeply( $hold_3->biblio->unblessed, $biblio->unblessed, 'Old hold has a biblionumber, returns a biblio object' );
$schema->storage->txn_rollback;
};