Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 5; |
20 |
use Test::More tests => 6; |
21 |
use Test::MockModule; |
21 |
use Test::MockModule; |
22 |
use Test::Warn; |
22 |
use Test::Warn; |
23 |
|
23 |
|
Lines 101-106
subtest "InProcessingToShelvingCart tests" => sub {
Link Here
|
101 |
"InProcessingToShelvingCart functions as intended" ); |
101 |
"InProcessingToShelvingCart functions as intended" ); |
102 |
}; |
102 |
}; |
103 |
|
103 |
|
|
|
104 |
subtest "BlankShelvingLocationOnReturn tests" => sub { |
105 |
|
106 |
plan tests => 2; |
107 |
|
108 |
$branch = $builder->build({ source => 'Branch' })->{ branchcode }; |
109 |
my $permanent_location = 'TEST'; |
110 |
my $location = 'PROC'; |
111 |
|
112 |
# Create a biblio record with biblio-level itemtype |
113 |
my $record = MARC::Record->new(); |
114 |
my ( $biblionumber, $biblioitemnumber ) = AddBiblio( $record, '' ); |
115 |
my $built_item = $builder->build({ |
116 |
source => 'Item', |
117 |
value => { |
118 |
biblionumber => $biblionumber, |
119 |
homebranch => $branch, |
120 |
holdingbranch => $branch, |
121 |
location => $location, |
122 |
permanent_location => $permanent_location |
123 |
} |
124 |
}); |
125 |
my $barcode = $built_item->{ barcode }; |
126 |
my $itemnumber = $built_item->{ itemnumber }; |
127 |
my $item; |
128 |
|
129 |
t::lib::Mocks::mock_preference( "BlankShelvingLocationOnReturn", 1 ); |
130 |
AddReturn( $barcode, $branch ); |
131 |
$item = GetItem( $itemnumber ); |
132 |
is( $item->{location}, '', |
133 |
"BlankShelvingLocationOnReturn functions as intended" ); |
134 |
|
135 |
$item->{location} = $location; |
136 |
ModItem( $item, undef, $itemnumber ); |
137 |
|
138 |
t::lib::Mocks::mock_preference( "BlankShelvingLocationOnReturn", 0 ); |
139 |
AddReturn( $barcode, $branch ); |
140 |
$item = GetItem( $itemnumber ); |
141 |
is( $item->{location}, $permanent_location, |
142 |
"BlankShelvingLocationOnReturn functions as intended" ); |
143 |
}; |
144 |
|
145 |
subtest "BlankShelvingLocationOnIssue tests" => sub { |
146 |
|
147 |
plan tests => 2; |
148 |
|
149 |
$branch = $builder->build({ source => 'Branch' })->{ branchcode }; |
150 |
my $permanent_location = 'TEST'; |
151 |
my $location = 'PROC'; |
152 |
|
153 |
# Create a biblio record with biblio-level itemtype |
154 |
my $record = MARC::Record->new(); |
155 |
my ( $biblionumber, $biblioitemnumber ) = AddBiblio( $record, '' ); |
156 |
my $built_item = $builder->build({ |
157 |
source => 'Item', |
158 |
value => { |
159 |
biblionumber => $biblionumber, |
160 |
homebranch => $branch, |
161 |
holdingbranch => $branch, |
162 |
location => $location, |
163 |
permanent_location => $permanent_location |
164 |
} |
165 |
}); |
166 |
my $barcode = $built_item->{ barcode }; |
167 |
my $itemnumber = $built_item->{ itemnumber }; |
168 |
my $item; |
169 |
|
170 |
t::lib::Mocks::mock_preference( "BlankShelvingLocationOnIssue", 1 ); |
171 |
my $borrower = Koha::Patrons->find( $borrowernumber )->unblessed; |
172 |
$item = GetItem( $itemnumber ); |
173 |
AddIssue( $borrower, $item->{barcode}); |
174 |
$item = GetItem( $itemnumber ); |
175 |
is( $item->{location}, '', |
176 |
"BlankShelvingLocationOnIssue functions as intended" ); |
177 |
|
178 |
$item->{location} = $location; |
179 |
ModItem( $item, undef, $itemnumber ); |
180 |
|
181 |
t::lib::Mocks::mock_preference( "BlankShelvingLocationOnReturn", 0 ); |
182 |
AddIssue( $borrower, $item->{barcode} ); |
183 |
$item = GetItem( $itemnumber ); |
184 |
is( $item->{location}, $permanent_location, |
185 |
"BlankShelvingLocationOnReturn functions as intended" ); |
186 |
}; |
104 |
|
187 |
|
105 |
subtest "AddReturn logging on statistics table (item-level_itypes=1)" => sub { |
188 |
subtest "AddReturn logging on statistics table (item-level_itypes=1)" => sub { |
106 |
|
189 |
|