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 correctly in transit' => 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 = {}; |
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->get_transfer, undef, 'Koha::Item->get_transfer returns undef'); |
65 |
is($detail_tt_item->get_transfer, undef, 'detail.tt->get_transfer returns undef'); |
66 |
|
67 |
$schema->storage->txn_rollback; |
68 |
}; |
69 |
|
33 |
subtest 'item relation tests' => sub { |
70 |
subtest 'item relation tests' => sub { |
34 |
plan tests => 2; |
71 |
plan tests => 2; |
35 |
|
72 |
|
36 |
- |
|
|