|
Lines 251-256
sub run_tests {
Link Here
|
| 251 |
# roll back ES index changes. |
251 |
# roll back ES index changes. |
| 252 |
t::lib::Mocks::mock_preference('SearchEngine', 'Zebra'); |
252 |
t::lib::Mocks::mock_preference('SearchEngine', 'Zebra'); |
| 253 |
|
253 |
|
|
|
254 |
my $bgj_mock = Test::MockModule->new('Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue'); |
| 255 |
$bgj_mock->mock( 'enqueue', undef ); |
| 256 |
|
| 254 |
my $isbn = '0590353403'; |
257 |
my $isbn = '0590353403'; |
| 255 |
my $title = 'Foundation'; |
258 |
my $title = 'Foundation'; |
| 256 |
my $subtitle1 = 'Research'; |
259 |
my $subtitle1 = 'Research'; |
|
Lines 636-641
subtest 'IsMarcStructureInternal' => sub {
Link Here
|
| 636 |
subtest 'deletedbiblio_metadata' => sub { |
639 |
subtest 'deletedbiblio_metadata' => sub { |
| 637 |
plan tests => 2; |
640 |
plan tests => 2; |
| 638 |
|
641 |
|
|
|
642 |
my $mock = Test::MockModule->new('Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue'); |
| 643 |
$mock->mock( 'enqueue', undef ); |
| 644 |
|
| 639 |
my ($biblionumber, $biblioitemnumber) = AddBiblio(MARC::Record->new, ''); |
645 |
my ($biblionumber, $biblioitemnumber) = AddBiblio(MARC::Record->new, ''); |
| 640 |
my $biblio_metadata = C4::Biblio::GetXmlBiblio( $biblionumber ); |
646 |
my $biblio_metadata = C4::Biblio::GetXmlBiblio( $biblionumber ); |
| 641 |
C4::Biblio::DelBiblio( $biblionumber ); |
647 |
C4::Biblio::DelBiblio( $biblionumber ); |
|
Lines 646-652
subtest 'deletedbiblio_metadata' => sub {
Link Here
|
| 646 |
}; |
652 |
}; |
| 647 |
|
653 |
|
| 648 |
subtest 'DelBiblio' => sub { |
654 |
subtest 'DelBiblio' => sub { |
| 649 |
plan tests => 5; |
655 |
|
|
|
656 |
plan tests => 6; |
| 657 |
|
| 658 |
my $mock = Test::MockModule->new('Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue'); |
| 659 |
$mock->mock( 'enqueue', undef ); |
| 650 |
|
660 |
|
| 651 |
my ($biblionumber, $biblioitemnumber) = C4::Biblio::AddBiblio(MARC::Record->new, ''); |
661 |
my ($biblionumber, $biblioitemnumber) = C4::Biblio::AddBiblio(MARC::Record->new, ''); |
| 652 |
my $deleted = C4::Biblio::DelBiblio( $biblionumber ); |
662 |
my $deleted = C4::Biblio::DelBiblio( $biblionumber ); |
|
Lines 684-689
subtest 'DelBiblio' => sub {
Link Here
|
| 684 |
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' ); |
| 685 |
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' ); |
| 686 |
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 |
}; |
| 687 |
}; |
730 |
}; |
| 688 |
|
731 |
|
| 689 |
subtest 'MarcFieldForCreatorAndModifier' => sub { |
732 |
subtest 'MarcFieldForCreatorAndModifier' => sub { |
| 690 |
- |
|
|