10 use Test::More tests => 8;
11 C4::Context->_new_userenv(1234567);
12 C4::Context->set_userenv(91, 'CLIstaff', '23529001223661', 'CPL',
13 'CPL', 'CPL', '', 'cc@cscnet.co.uk');
16 my $test_patron = '23529001223651';
17 my $test_item_fic = '502326000402';
18 my $test_item_24 = '502326000404';
19 my $test_item_48 = '502326000403';
21 my $borrower1 = GetMember(cardnumber => $test_patron);
22 my $item1 = GetItem (undef,$test_item_fic);
25 skip 'Missing test borrower or item, skipping tests', 8
26 unless ( defined $borrower1 && defined $item1 );
28 for my $item_barcode ( $test_item_fic, $test_item_24, $test_item_48 ) {
29 my $duedate = try_issue( $test_patron, $item_barcode );
30 isa_ok( $duedate, 'DateTime' );
31 if ( $item_barcode eq $test_item_fic ) {
32 is( $duedate->hour(), 23, "daily loan hours = 23" );
33 is( $duedate->minute(), 59, "daily loan mins = 59" );
35 my $ret_ok = try_return($item_barcode);
36 is( $ret_ok, 1, 'Return succeeded' );
41 my ($cardnumber, $item ) = @_;
42 my $issuedate = '2011-05-16';
43 my $borrower = GetMemberDetails(0, $cardnumber);
44 my ($issuingimpossible,$needsconfirmation) = CanBookBeIssued( $borrower, $item );
45 my $due_date = AddIssue($borrower, $item, undef, 0, $issuedate);
51 my ($ret, $messages, $iteminformation, $borrower) = AddReturn($barcode);