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;
22
use C4::Biblio;
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 796-803 subtest 'get_transfers' => sub { Link Here
796
    $schema->storage->txn_rollback;
796
    $schema->storage->txn_rollback;
797
};
797
};
798
798
799
subtest 'move_to_biblio() tests' => sub {
799
subtest 'Tests for relationship between item and item_orders via aqorders_item' => sub {
800
    plan tests => 2;
801
802
    my $biblio = $builder->build_sample_biblio();
803
    my $item = $builder->build_sample_item({ biblionumber => $biblio->biblionumber });
804
    my $aq_budget = $builder->build({
805
        source => 'Aqbudget',
806
        value  => {
807
            budget_notes => 'test',
808
        },
809
    });
810
811
    my $order_note = 'Order for ' . $item->itemnumber;
812
813
    my $aq_order1 = $builder->build_object({
814
        class => 'Koha::Acquisition::Orders',
815
        value  => {
816
            biblionumber => $biblio->biblionumber,
817
            budget_id => $aq_budget->{budget_id},
818
            order_internalnote => $order_note,
819
        },
820
    });
821
    my $aq_order2 = $builder->build_object({
822
        class => 'Koha::Acquisition::Orders',
823
        value  => {
824
            biblionumber => $biblio->biblionumber,
825
            budget_id => $aq_budget->{budget_id},
826
        },
827
    });
828
    my $aq_order_item1 = $builder->build({
829
        source => 'AqordersItem',
830
        value  => {
831
            ordernumber => $aq_order1->ordernumber,
832
            itemnumber => $item->itemnumber,
833
        },
834
    });
835
836
    my $orders = $item->item_orders;
837
    is ($orders->count, 1, 'One order found by item with the relationship');
838
    is ($orders->next->order_internalnote, $order_note, 'Correct order found by item with the relationship');
839
};
800
840
841
subtest 'move_to_biblio() tests' => sub {
801
    plan tests => 16;
842
    plan tests => 16;
802
843
803
    $schema->storage->txn_begin;
844
    $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