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

(-)a/t/db_dependent/Koha/Item/Transfer.t (-2 / +39 lines)
Lines 24-35 use Koha::DateUtils qw( dt_from_string ); Link Here
24
24
25
use t::lib::TestBuilder;
25
use t::lib::TestBuilder;
26
26
27
use Test::More tests => 7;
27
use Test::More tests => 8;
28
use Test::Exception;
28
use Test::Exception;
29
29
30
my $schema  = Koha::Database->new->schema;
30
my $schema  = Koha::Database->new->schema;
31
my $builder = t::lib::TestBuilder->new;
31
my $builder = t::lib::TestBuilder->new;
32
32
33
subtest 'detail.tt not in transit after transfer has arrived' => sub {
34
    plan tests => 2;
35
36
    $schema->storage->txn_begin;
37
38
    my $item     = $builder->build_sample_item();
39
    my $transfer = $builder->build_object(
40
        {
41
            class => 'Koha::Item::Transfers',
42
            value => {
43
                itemnumber => $item->itemnumber,
44
                datesent => dt_from_string,
45
                datearrived => dt_from_string,
46
            }
47
        }
48
    );
49
50
    my $transfer_item = $transfer->item;
51
    my $biblio = Koha::Biblios->find($transfer_item->biblionumber);
52
53
    my $items_params = { host_items => 1 };
54
    my $params = {};
55
56
    # FROM catalogue/detail.pl
57
    my $items = $biblio->items($items_params)->search_ordered( $params, { prefetch => ['issue','current_branchtransfers'] } );
58
    # but minimum testable case would be
59
    #my $items = Koha::Items->search( { 'me.itemnumber' => $transfer_item->itemnumber }, { prefetch => ['current_branchtransfers'] } );
60
61
    my $detail_tt_item = $items->next;
62
63
    # following two tests should produce the same result
64
    is($transfer_item->itemnumber, $detail_tt_item->itemnumber, 'following two items are the same');
65
    is($transfer_item->get_transfer, undef, 'Koha::Item->get_transfer returns undef');
66
    is($detail_tt_item->get_transfer, undef, 'detail.tt->get_transfer returns undef');
67
68
    $schema->storage->txn_rollback;
69
};
70
33
subtest 'item relation tests' => sub {
71
subtest 'item relation tests' => sub {
34
    plan tests => 2;
72
    plan tests => 2;
35
73
36
- 

Return to bug 34639