Lines 676-685
subtest 'deletedbiblio_metadata' => sub {
Link Here
|
676 |
|
676 |
|
677 |
subtest 'DelBiblio' => sub { |
677 |
subtest 'DelBiblio' => sub { |
678 |
|
678 |
|
679 |
plan tests => 10; |
679 |
plan tests => 11; |
680 |
|
680 |
|
681 |
t::lib::Mocks::mock_preference( 'RealTimeHoldsQueue', 0 ); |
681 |
t::lib::Mocks::mock_preference( 'RealTimeHoldsQueue', 0 ); |
682 |
|
682 |
|
|
|
683 |
subtest 'DelBiblio holds handling' => sub { |
684 |
|
685 |
plan tests => 3; |
686 |
my $biblio = $builder->build_sample_biblio; |
687 |
my $hold = $builder->build_object( |
688 |
{ |
689 |
class => 'Koha::Holds', |
690 |
value => { biblionumber => $biblio->biblionumber } |
691 |
} |
692 |
); |
693 |
my $old_hold = $builder->build_object( |
694 |
{ |
695 |
class => 'Koha::Old::Holds', |
696 |
value => { biblionumber => $biblio->biblionumber } |
697 |
} |
698 |
); |
699 |
|
700 |
C4::Biblio::DelBiblio($biblio->biblionumber); |
701 |
$old_hold->discard_changes(); |
702 |
$hold = Koha::Old::Holds->find( $hold->reserve_id ); |
703 |
ok( $hold, "Hold has been successfully cancelled on deletion of biblio" ); |
704 |
is( |
705 |
$old_hold->deleted_biblionumber, $biblio->biblionumber, |
706 |
"Biblionumber has been successfully recorded during deletion for old holds" |
707 |
); |
708 |
is( |
709 |
$hold->deleted_biblionumber, $biblio->biblionumber, |
710 |
"Biblionumber has been successfully recorded during deletion for existing hold that was cancelled" |
711 |
); |
712 |
}; |
713 |
|
683 |
my ($biblionumber, $biblioitemnumber) = C4::Biblio::AddBiblio(MARC::Record->new, ''); |
714 |
my ($biblionumber, $biblioitemnumber) = C4::Biblio::AddBiblio(MARC::Record->new, ''); |
684 |
my $deleted = C4::Biblio::DelBiblio( $biblionumber ); |
715 |
my $deleted = C4::Biblio::DelBiblio( $biblionumber ); |
685 |
is( $deleted, undef, 'DelBiblio returns undef is the biblio has been deleted correctly - Must be 1 instead'); # FIXME We should return 1 instead! |
716 |
is( $deleted, undef, 'DelBiblio returns undef is the biblio has been deleted correctly - Must be 1 instead'); # FIXME We should return 1 instead! |