Lines 8-18
use C4::Branch;
Link Here
|
8 |
use C4::Circulation; |
8 |
use C4::Circulation; |
9 |
use Koha::Database; |
9 |
use Koha::Database; |
10 |
use Koha::DateUtils; |
10 |
use Koha::DateUtils; |
|
|
11 |
use Koha::Items; |
11 |
use DateTime::Duration; |
12 |
use DateTime::Duration; |
12 |
|
13 |
|
13 |
use t::lib::TestBuilder; |
14 |
use t::lib::TestBuilder; |
14 |
|
15 |
|
15 |
use Test::More tests => 22; |
16 |
use Test::More tests => 37; |
16 |
use Test::Deep; |
17 |
use Test::Deep; |
17 |
|
18 |
|
18 |
BEGIN { |
19 |
BEGIN { |
Lines 77-82
my @sampleitem2 = C4::Items::AddItem(
Link Here
|
77 |
); |
78 |
); |
78 |
my $item_id2 = $sampleitem2[2]; |
79 |
my $item_id2 = $sampleitem2[2]; |
79 |
|
80 |
|
|
|
81 |
my $item = Koha::Items->find( $item_id1 ); |
82 |
my $transit_data = $item->_get_transit_data(); |
83 |
is( ref($transit_data), 'HASH', '_get_transit_data() returns hashref even if item is not in transit' ); |
84 |
is( $transit_data->{date}, undef, 'Got transit date undef from _get_transit_data()' ); |
85 |
is( $transit_data->{from}, undef, 'Got transit from undef from _get_transit_data()' ); |
86 |
is( $transit_data->{to}, undef, 'Got transit to undef from _get_tranist_data()' ); |
87 |
|
88 |
is( $item->is_in_transit(), 0, 'Item is not in transit' ); |
89 |
is( $item->in_transit_date(), undef, 'Transit date is undef' ); |
90 |
is( $item->in_transit_to(), undef, 'Transit to library is undef' ); |
91 |
is( $item->in_transit_from(), undef, 'Transit from library is undef' ); |
92 |
|
80 |
#Add transfers |
93 |
#Add transfers |
81 |
ModItemTransfer( |
94 |
ModItemTransfer( |
82 |
$item_id1, |
95 |
$item_id1, |
Lines 116-121
cmp_deeply(
Link Here
|
116 |
[ re('^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$'), $samplebranch1->{branchcode}, $samplebranch2->{branchcode} ], |
129 |
[ re('^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$'), $samplebranch1->{branchcode}, $samplebranch2->{branchcode} ], |
117 |
"Transfers of the item1" |
130 |
"Transfers of the item1" |
118 |
); #NOTE: Only the first transfer is returned |
131 |
); #NOTE: Only the first transfer is returned |
|
|
132 |
|
133 |
$item = Koha::Items->find( $item_id1 ); |
134 |
$transit_data = $item->_get_transit_data(); |
135 |
is( $transit_data->{date}, $transfers[0], 'Got transit date correctly from _get_transit_data()' ); |
136 |
is( $transit_data->{from}, $samplebranch1->{branchcode}, 'Got transit from correctly from _get_transit_data()' ); |
137 |
is( $transit_data->{to}, $samplebranch2->{branchcode}, 'Got transit to correctly from _get_tranist_data()' ); |
138 |
|
139 |
is( $item->is_in_transit(), 1, 'Item is in transit' ); |
140 |
is( $item->in_transit_date(), $transfers[0], 'Transit date is correct' ); |
141 |
is( $item->in_transit_to(), $samplebranch2->{branchcode}, 'Transit to library is correct' ); |
142 |
is( $item->in_transit_from(), $samplebranch1->{branchcode}, 'Transit from library is correct' ); |
143 |
|
119 |
@transfers = GetTransfers; |
144 |
@transfers = GetTransfers; |
120 |
is_deeply( \@transfers, [], |
145 |
is_deeply( \@transfers, [], |
121 |
"GetTransfers without params returns an empty array" ); |
146 |
"GetTransfers without params returns an empty array" ); |
122 |
- |
|
|