Bug 16423: [QA Follow-up] Remove $opac
[koha.git] / t / db_dependent / SIP / ILS.t
1 #!/usr/bin/perl
2
3 # Tests for C4::SIP::ILS
4 # Please help to extend them!
5
6 # This file is part of Koha.
7 #
8 # Koha is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
12 #
13 # Koha is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with Koha; if not, see <http://www.gnu.org/licenses>.
20
21 use Modern::Perl;
22
23 use Test::More tests => 9;
24
25 BEGIN {
26     use_ok('C4::SIP::ILS');
27 }
28
29 my $class = 'C4::SIP::ILS';
30 my $institution = { id => 'CPL', };
31
32 my $ils = $class->new( $institution );
33
34 isa_ok( $ils, $class );
35
36 # Check all methods required for interface are there
37 my @methods = qw(
38     find_patron find_item checkout_ok checkin_ok offline_ok status_update_ok
39     offline_ok checkout checkin end_patron_session pay_fee add_hold cancel_hold
40     alter_hold renew renew_all
41 );
42
43 can_ok( $ils, @methods );
44
45 is( $ils->institution(), 'CPL', 'institution method returns id' );
46
47 is( $ils->institution_id(), 'CPL', 'institution_id method returns id' );
48
49 is( $ils->supports('checkout'), 1, 'checkout supported' );
50
51 is( $ils->supports('security_inhibit'),
52     q{}, 'unsupported feature returns false' );
53
54 is( $ils->test_cardnumber_compare( 'A1234', 'a1234' ),
55     1, 'borrower bc test is case insensitive' );
56
57 is( $ils->test_cardnumber_compare( 'A1234', 'b1234' ),
58     q{}, 'borrower bc test identifies difference' );