]> git.koha-community.org Git - koha.git/blob - C4/SIP/t/08checkin.t
SIP/t - test files adapted, supplemented, expanded. Note: requires matching data...
[koha.git] / C4 / SIP / t / 08checkin.t
1 #!/usr/bin/perl
2 # checkin: test Checkin Response
3
4 use strict;
5 use warnings;
6 use Clone qw(clone);
7
8 use Sip::Constants qw(:all);
9 use SIPtest qw(:basic :user1 :item1);
10
11 my $checkin_test_template = {
12     id => "Checkin: Item ($item_barcode) is checked out",
13     msg => "09N20060102    08423620060113    084235APUnder the bed|AO$instid|AB$item_barcode|AC$password|",
14     pat => qr/^101YNN$datepat/,
15     fields => [
16                $SIPtest::field_specs{(FID_INST_ID)},
17                $SIPtest::field_specs{(FID_SCREEN_MSG)},
18                $SIPtest::field_specs{(FID_PRINT_LINE)},
19                { field    => FID_PATRON_ID,
20                  pat      => qr/^$user_barcode$/,
21                  required => 1, },
22                { field    => FID_ITEM_ID,
23                  pat      => qr/^$item_barcode$/,
24                  required => 1, },
25                { field    => FID_PERM_LOCN,
26                  pat      => $textpat,
27                  required => 1, },
28                { field    => FID_TITLE_ID,
29                  pat      => qr/^$item_title\s*$/,
30                  required => 1, }, # not required by the spec.
31                ],};
32
33 my $checkout_template = {
34     id => "Checkin: prep: check out item ($item_barcode)",
35     msg => "11YN20060329    203000                  AO$instid|AA$user_barcode|AB$item_barcode|AC|",
36     pat => qr/^121NNY$datepat/,
37     fields => [],
38 };
39
40 my @tests = (
41         $SIPtest::login_test,
42         $SIPtest::sc_status_test,
43         $checkout_template,
44         $checkin_test_template,
45         );
46
47 my $test;
48
49 # Checkin item that's not checked out.  Basically, this
50 # is identical to the first case, except the header says that
51 # the ILS didn't check the item in, and there's no patron id.
52 $test = clone($checkin_test_template);
53 $test->{id} = 'Checkin: Item not checked out';
54 $test->{pat} = qr/^100YNN$datepat/o;
55 $test->{fields} = [grep $_->{field} ne FID_PATRON_ID, @{$test->{fields}}];
56
57 push @tests, $test;
58
59
60 # Still need tests for magnetic media
61
62
63 SIPtest::run_sip_tests(@tests);
64
65 1;