View | Details | Raw Unified | Return to bug 22690
Collapse All | Expand All

(-)a/t/db_dependent/Koha/Biblio.t (-1 / +23 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 14;
20
use Test::More tests => 15;
21
21
22
use C4::Biblio qw( AddBiblio ModBiblio );
22
use C4::Biblio qw( AddBiblio ModBiblio );
23
use Koha::Database;
23
use Koha::Database;
Lines 637-639 subtest 'get_marc_notes() UNIMARC tests' => sub { Link Here
637
637
638
    $schema->storage->txn_rollback;
638
    $schema->storage->txn_rollback;
639
};
639
};
640
641
subtest 'adopt_items_from_biblio() tests' => sub {
642
643
    plan tests => 2;
644
645
    $schema->storage->txn_begin;
646
647
    my $biblio1 = $builder->build_sample_biblio;
648
    my $biblio2 = $builder->build_sample_biblio;
649
    my $item1 = $builder->build_sample_item({ biblionumber => $biblio1->biblionumber });
650
    my $item2 = $builder->build_sample_item({ biblionumber => $biblio1->biblionumber });
651
652
    $biblio2->adopt_items_from_biblio($biblio1);
653
654
    $item1->discard_changes;
655
    $item2->discard_changes;
656
657
    is($item1->biblionumber, $biblio2->biblionumber, "Item 1 moved");
658
    is($item2->biblionumber, $biblio2->biblionumber, "Item 2 moved");
659
660
    $schema->storage->txn_rollback;
661
};
(-)a/t/db_dependent/Koha/Item.t (-1 / +42 lines)
Lines 817-824 subtest 'get_transfers' => sub { Link Here
817
    $schema->storage->txn_rollback;
817
    $schema->storage->txn_rollback;
818
};
818
};
819
819
820
subtest 'move_to_biblio() tests' => sub {
820
subtest 'Tests for relationship between item and item_orders via aqorders_item' => sub {
821
    plan tests => 2;
822
823
    my $biblio = $builder->build_sample_biblio();
824
    my $item = $builder->build_sample_item({ biblionumber => $biblio->biblionumber });
825
    my $aq_budget = $builder->build({
826
        source => 'Aqbudget',
827
        value  => {
828
            budget_notes => 'test',
829
        },
830
    });
831
832
    my $order_note = 'Order for ' . $item->itemnumber;
833
834
    my $aq_order1 = $builder->build_object({
835
        class => 'Koha::Acquisition::Orders',
836
        value  => {
837
            biblionumber => $biblio->biblionumber,
838
            budget_id => $aq_budget->{budget_id},
839
            order_internalnote => $order_note,
840
        },
841
    });
842
    my $aq_order2 = $builder->build_object({
843
        class => 'Koha::Acquisition::Orders',
844
        value  => {
845
            biblionumber => $biblio->biblionumber,
846
            budget_id => $aq_budget->{budget_id},
847
        },
848
    });
849
    my $aq_order_item1 = $builder->build({
850
        source => 'AqordersItem',
851
        value  => {
852
            ordernumber => $aq_order1->ordernumber,
853
            itemnumber => $item->itemnumber,
854
        },
855
    });
856
857
    my $orders = $item->item_orders;
858
    is ($orders->count, 1, 'One order found by item with the relationship');
859
    is ($orders->next->order_internalnote, $order_note, 'Correct order found by item with the relationship');
860
};
821
861
862
subtest 'move_to_biblio() tests' => sub {
822
    plan tests => 16;
863
    plan tests => 16;
823
864
824
    $schema->storage->txn_begin;
865
    $schema->storage->txn_begin;
(-)a/t/db_dependent/Koha/SearchEngine/Indexer.t (-2 / +9 lines)
Lines 61-67 subtest 'Test indexer object creation' => sub { Link Here
61
};
61
};
62
62
63
subtest 'Test indexer calls' => sub {
63
subtest 'Test indexer calls' => sub {
64
    plan tests => 44;
64
    plan tests => 46;
65
65
66
    my @engines = ('Zebra');
66
    my @engines = ('Zebra');
67
    eval { Koha::SearchEngine::Elasticsearch->get_elasticsearch_params; };
67
    eval { Koha::SearchEngine::Elasticsearch->get_elasticsearch_params; };
Lines 71-76 subtest 'Test indexer calls' => sub { Link Here
71
            if scalar @engines == 1;
71
            if scalar @engines == 1;
72
    }
72
    }
73
73
74
    t::lib::Mocks::mock_preference( 'BiblioAddsAuthorities', 0 );
75
74
    for my $engine ( @engines ){
76
    for my $engine ( @engines ){
75
        t::lib::Mocks::mock_preference( 'SearchEngine', $engine );
77
        t::lib::Mocks::mock_preference( 'SearchEngine', $engine );
76
        my $mock_index = Test::MockModule->new("Koha::SearchEngine::".$engine."::Indexer");
78
        my $mock_index = Test::MockModule->new("Koha::SearchEngine::".$engine."::Indexer");
Lines 170-175 subtest 'Test indexer calls' => sub { Link Here
170
            $item4->move_to_biblio($biblio2, { skip_record_index => 1 });
172
            $item4->move_to_biblio($biblio2, { skip_record_index => 1 });
171
        } undef, "index_records is not called for $engine when moving an item to another biblio (Item->move_to_biblio) if skip_record_index passed";
173
        } undef, "index_records is not called for $engine when moving an item to another biblio (Item->move_to_biblio) if skip_record_index passed";
172
174
175
        my $item5 = $builder->build_sample_item({biblionumber => $biblio->biblionumber});
176
        my $item6 = $builder->build_sample_item({biblionumber => $biblio->biblionumber});
177
        warnings_are{
178
            $biblio2->adopt_items_from_biblio($biblio);
179
        } [$engine,"Koha::Biblio",$engine,"Koha::Biblio"], "index_records is called for both biblios for $engine when adopting items (Biblio->adopt_items_from_biblio)";
180
173
        $builder->build({
181
        $builder->build({
174
            source => 'Issue',
182
            source => 'Issue',
175
            value  => {
183
            value  => {
176
- 

Return to bug 22690