Bug 30648: Unit tests

Signed-off-by: Anneli Österman <anneli.osterman@koha-suomi.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 69c2abf14b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2024-10-11 12:49:23 +00:00 committed by Lucas Gass
parent 0b0b171558
commit 368d2c85a1
2 changed files with 38 additions and 1 deletions

View File

@ -691,10 +691,41 @@ subtest 'deletedbiblio_metadata' => sub {
subtest 'DelBiblio' => sub {
plan tests => 10;
plan tests => 11;
t::lib::Mocks::mock_preference( 'RealTimeHoldsQueue', 0 );
subtest 'DelBiblio holds handling' => sub {
plan tests => 3;
my $biblio = $builder->build_sample_biblio;
my $hold = $builder->build_object(
{
class => 'Koha::Holds',
value => { biblionumber => $biblio->biblionumber }
}
);
my $old_hold = $builder->build_object(
{
class => 'Koha::Old::Holds',
value => { biblionumber => $biblio->biblionumber }
}
);
C4::Biblio::DelBiblio($biblio->biblionumber);
$old_hold->discard_changes();
$hold = Koha::Old::Holds->find( $hold->reserve_id );
ok( $hold, "Hold has been successfully cancelled on deletion of biblio" );
is(
$old_hold->deleted_biblionumber, $biblio->biblionumber,
"Biblionumber has been successfully recorded during deletion for old holds"
);
is(
$hold->deleted_biblionumber, $biblio->biblionumber,
"Biblionumber has been successfully recorded during deletion for existing hold that was cancelled"
);
};
my ($biblionumber, $biblioitemnumber) = C4::Biblio::AddBiblio(MARC::Record->new, '');
my $deleted = C4::Biblio::DelBiblio( $biblionumber );
is( $deleted, undef, 'DelBiblio returns undef is the biblio has been deleted correctly - Must be 1 instead'); # FIXME We should return 1 instead!

View File

@ -630,6 +630,12 @@ sub _gen_default_values {
Reserve => {
non_priority => 0,
item_group_id => undef,
deleted_biblionumber => undef,
},
OldReserve => {
non_priority => 0,
item_group_id => undef,
deleted_biblionumber => undef,
},
Itemtype => {
rentalcharge => 0,