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 => 10; |
24 |
use Test::More tests => 11; |
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 31-36
use t::lib::TestBuilder;
Link Here
|
31 |
|
31 |
|
32 |
use C4::Reserves qw(AddReserve); |
32 |
use C4::Reserves qw(AddReserve); |
33 |
use C4::Circulation qw( AddReturn ); |
33 |
use C4::Circulation qw( AddReturn ); |
|
|
34 |
use Koha::Account::Lines; |
34 |
use Koha::Database; |
35 |
use Koha::Database; |
35 |
use Koha::AuthUtils qw(hash_password); |
36 |
use Koha::AuthUtils qw(hash_password); |
36 |
use Koha::DateUtils; |
37 |
use Koha::DateUtils; |
Lines 337-342
subtest 'Patron info summary > 5 should not crash server' => sub {
Link Here
|
337 |
$schema->storage->txn_rollback; |
338 |
$schema->storage->txn_rollback; |
338 |
}; |
339 |
}; |
339 |
|
340 |
|
|
|
341 |
subtest 'Fee paid message can crash SIP server if paying fee that is not "renewable"' => sub { |
342 |
|
343 |
my $schema = Koha::Database->new->schema; |
344 |
$schema->storage->txn_begin; |
345 |
|
346 |
plan tests => 6; |
347 |
my $builder = t::lib::TestBuilder->new(); |
348 |
my $branchcode = $builder->build({ source => 'Branch' })->{branchcode}; |
349 |
my ( $response, $findpatron ); |
350 |
my $mocks = create_mocks( \$response, \$findpatron, \$branchcode ); |
351 |
my $borrower = $builder->build({ |
352 |
source => 'Borrower', |
353 |
value => { |
354 |
lastseen => '2001-01-01', |
355 |
password => hash_password( PATRON_PW ), |
356 |
branchcode => $branchcode, |
357 |
}, |
358 |
}); |
359 |
my $cardnum = $borrower->{cardnumber}; |
360 |
my $sip_patron = C4::SIP::ILS::Patron->new( $cardnum ); |
361 |
$findpatron = $sip_patron; |
362 |
|
363 |
my $line = Koha::Account::Line->new( |
364 |
{ |
365 |
borrowernumber => $borrower->{borrowernumber}, |
366 |
manager_id => $borrower->{borrowernumber}, |
367 |
itemnumber => 1, |
368 |
debit_type_code => "OVERDUE", |
369 |
status => "RETURNED", |
370 |
amount => 5, |
371 |
interface => 'commandline', |
372 |
} |
373 |
)->store; |
374 |
|
375 |
my $fee_type = '01'; |
376 |
my $pay_type = '00'; |
377 |
my $currency_type = 'USD'; |
378 |
my $fee_amount = '5.00'; |
379 |
|
380 |
my $siprequest = FEE_PAID . 'YYYYMMDDZZZZHHMMSS'. |
381 |
$fee_type . $pay_type . $currency_type . |
382 |
FID_FEE_AMT . $fee_amount . '|' . |
383 |
FID_FEE_ID . $line->id . '|' . |
384 |
FID_INST_ID . $branchcode . '|' . |
385 |
FID_PATRON_ID . $cardnum . '|' . |
386 |
FID_PATRON_PWD . PATRON_PW . '|'; |
387 |
my $msg = C4::SIP::Sip::MsgType->new( $siprequest, 0 ); |
388 |
|
389 |
my $server = { ils => $mocks->{ils} }; |
390 |
undef $response; |
391 |
$msg->handle_fee_paid( $server ); |
392 |
|
393 |
isnt( $response, undef, 'At least we got a response.' ); |
394 |
|
395 |
$schema->storage->txn_rollback; |
396 |
}; |
397 |
|
340 |
# Here is room for some more subtests |
398 |
# Here is room for some more subtests |
341 |
|
399 |
|
342 |
# END of main code |
400 |
# END of main code |
343 |
- |
|
|