Lines 21-27
Link Here
|
21 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
21 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
22 |
|
22 |
|
23 |
use Modern::Perl; |
23 |
use Modern::Perl; |
24 |
use Test::More tests => 8; |
24 |
use Test::More tests => 9; |
25 |
use Test::MockObject; |
25 |
use Test::MockObject; |
26 |
use Test::MockModule; |
26 |
use Test::MockModule; |
27 |
use Test::Warn; |
27 |
use Test::Warn; |
Lines 198-203
subtest "Test build_additional_item_fields_string" => sub {
Link Here
|
198 |
$schema->storage->txn_rollback; |
198 |
$schema->storage->txn_rollback; |
199 |
}; |
199 |
}; |
200 |
|
200 |
|
|
|
201 |
subtest "Test cr_item_field" => sub { |
202 |
plan tests => 1; |
203 |
|
204 |
my $builder = t::lib::TestBuilder->new(); |
205 |
my $branchcode = $builder->build({ source => 'Branch' })->{branchcode}; |
206 |
my $branchcode2 = $builder->build({ source => 'Branch' })->{branchcode}; |
207 |
my ( $response, $findpatron ); |
208 |
my $mocks = create_mocks( \$response, \$findpatron, \$branchcode ); |
209 |
|
210 |
# create some data |
211 |
my $patron1 = $builder->build({ |
212 |
source => 'Borrower', |
213 |
value => { |
214 |
password => hash_password( PATRON_PW ), |
215 |
}, |
216 |
}); |
217 |
my $card1 = $patron1->{cardnumber}; |
218 |
my $sip_patron1 = C4::SIP::ILS::Patron->new( $card1 ); |
219 |
$findpatron = $sip_patron1; |
220 |
my $item_object = $builder->build_sample_item({ |
221 |
damaged => 0, |
222 |
withdrawn => 0, |
223 |
itemlost => 0, |
224 |
restricted => 0, |
225 |
homebranch => $branchcode, |
226 |
holdingbranch => $branchcode, |
227 |
}); |
228 |
|
229 |
my $mockILS = $mocks->{ils}; |
230 |
my $server = { ils => $mockILS, account => {} }; |
231 |
$mockILS->mock( 'institution', sub { $branchcode; } ); |
232 |
$mockILS->mock( 'supports', sub { return; } ); |
233 |
$mockILS->mock( 'checkin', sub { |
234 |
shift; |
235 |
return C4::SIP::ILS->checkin(@_); |
236 |
}); |
237 |
my $today = dt_from_string; |
238 |
|
239 |
my $respcode; |
240 |
|
241 |
# Not checked out, toggle option checked_in_ok |
242 |
my $siprequest = CHECKIN . 'N' . 'YYYYMMDDZZZZHHMMSS' . |
243 |
siprequestdate( $today->clone->add( days => 1) ) . |
244 |
FID_INST_ID . $branchcode . '|'. |
245 |
FID_ITEM_ID . $item_object->barcode . '|' . |
246 |
FID_TERMINAL_PWD . 'ignored' . '|'; |
247 |
undef $response; |
248 |
my $msg = C4::SIP::Sip::MsgType->new( $siprequest, 0 ); |
249 |
|
250 |
$server->{account}->{cr_item_field} = 'itemnumber'; |
251 |
|
252 |
$msg->handle_checkin( $server ); |
253 |
|
254 |
my $id = $item_object->id; |
255 |
ok( $response =~ m/CR$id/, "Found correct CR field in response"); |
256 |
}; |
257 |
|
201 |
subtest 'Patron info summary > 5 should not crash server' => sub { |
258 |
subtest 'Patron info summary > 5 should not crash server' => sub { |
202 |
|
259 |
|
203 |
my $schema = Koha::Database->new->schema; |
260 |
my $schema = Koha::Database->new->schema; |
204 |
- |
|
|