|
Lines 639-646
subtest 'IsMarcStructureInternal' => sub {
Link Here
|
| 639 |
subtest 'deletedbiblio_metadata' => sub { |
639 |
subtest 'deletedbiblio_metadata' => sub { |
| 640 |
plan tests => 2; |
640 |
plan tests => 2; |
| 641 |
|
641 |
|
| 642 |
my $mock = Test::MockModule->new('Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue'); |
642 |
my $bgj_mock = Test::MockModule->new('Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue'); |
| 643 |
$mock->mock( 'enqueue', undef ); |
643 |
$bgj_mock->mock( 'enqueue', undef ); |
| 644 |
|
644 |
|
| 645 |
my ($biblionumber, $biblioitemnumber) = AddBiblio(MARC::Record->new, ''); |
645 |
my ($biblionumber, $biblioitemnumber) = AddBiblio(MARC::Record->new, ''); |
| 646 |
my $biblio_metadata = C4::Biblio::GetXmlBiblio( $biblionumber ); |
646 |
my $biblio_metadata = C4::Biblio::GetXmlBiblio( $biblionumber ); |
|
Lines 653-662
subtest 'deletedbiblio_metadata' => sub {
Link Here
|
| 653 |
|
653 |
|
| 654 |
subtest 'DelBiblio' => sub { |
654 |
subtest 'DelBiblio' => sub { |
| 655 |
|
655 |
|
| 656 |
plan tests => 6; |
656 |
plan tests => 5; |
| 657 |
|
657 |
|
| 658 |
my $mock = Test::MockModule->new('Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue'); |
658 |
my $bgj_mock = Test::MockModule->new('Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue'); |
| 659 |
$mock->mock( 'enqueue', undef ); |
659 |
$bgj_mock->mock( 'enqueue', undef ); |
| 660 |
|
660 |
|
| 661 |
my ($biblionumber, $biblioitemnumber) = C4::Biblio::AddBiblio(MARC::Record->new, ''); |
661 |
my ($biblionumber, $biblioitemnumber) = C4::Biblio::AddBiblio(MARC::Record->new, ''); |
| 662 |
my $deleted = C4::Biblio::DelBiblio( $biblionumber ); |
662 |
my $deleted = C4::Biblio::DelBiblio( $biblionumber ); |
|
Lines 694-732
subtest 'DelBiblio' => sub {
Link Here
|
| 694 |
is( $subscription->get_from_storage, undef, 'subscription should be deleted on biblio deletion' ); |
694 |
is( $subscription->get_from_storage, undef, 'subscription should be deleted on biblio deletion' ); |
| 695 |
is( $serial->get_from_storage, undef, 'serial should be deleted on biblio deletion' ); |
695 |
is( $serial->get_from_storage, undef, 'serial should be deleted on biblio deletion' ); |
| 696 |
is( $subscription_history->get_from_storage, undef, 'subscription history should be deleted on biblio deletion' ); |
696 |
is( $subscription_history->get_from_storage, undef, 'subscription history should be deleted on biblio deletion' ); |
| 697 |
|
|
|
| 698 |
subtest 'holds_queue update tests' => sub { |
| 699 |
|
| 700 |
plan tests => 1; |
| 701 |
|
| 702 |
$schema->storage->txn_begin; |
| 703 |
|
| 704 |
my $biblio = $builder->build_sample_biblio; |
| 705 |
|
| 706 |
my $mock = Test::MockModule->new('Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue'); |
| 707 |
$mock->mock( 'enqueue', sub { |
| 708 |
my ( $self, $args ) = @_; |
| 709 |
is_deeply( |
| 710 |
$args->{biblio_ids}, |
| 711 |
[ $biblio->id ], |
| 712 |
'->cancel triggers a holds queue update for the related biblio' |
| 713 |
); |
| 714 |
} ); |
| 715 |
|
| 716 |
# add a hold |
| 717 |
$builder->build_object( |
| 718 |
{ |
| 719 |
class => 'Koha::Holds', |
| 720 |
value => { |
| 721 |
biblionumber => $biblio->id, |
| 722 |
} |
| 723 |
} |
| 724 |
); |
| 725 |
|
| 726 |
C4::Biblio::DelBiblio( $biblio->id ); |
| 727 |
|
| 728 |
$schema->storage->txn_rollback; |
| 729 |
}; |
| 730 |
}; |
697 |
}; |
| 731 |
|
698 |
|
| 732 |
subtest 'MarcFieldForCreatorAndModifier' => sub { |
699 |
subtest 'MarcFieldForCreatorAndModifier' => sub { |