Lines 4-13
Link Here
|
4 |
# This needs to be extended! Your help is appreciated.. |
4 |
# This needs to be extended! Your help is appreciated.. |
5 |
|
5 |
|
6 |
use Modern::Perl; |
6 |
use Modern::Perl; |
7 |
use Test::More tests => 2; |
7 |
use Test::More tests => 3; |
8 |
|
8 |
|
9 |
use Koha::Database; |
9 |
use Koha::Database; |
10 |
use t::lib::TestBuilder; |
10 |
use t::lib::TestBuilder; |
|
|
11 |
use t::lib::Mocks; |
11 |
use C4::SIP::ILS::Patron; |
12 |
use C4::SIP::ILS::Patron; |
12 |
|
13 |
|
13 |
my $schema = Koha::Database->new->schema; |
14 |
my $schema = Koha::Database->new->schema; |
Lines 26-29
$schema->resultset('Borrower')->search({ cardnumber => $card })->delete;
Link Here
|
26 |
my $sip_patron2 = C4::SIP::ILS::Patron->new( $card ); |
27 |
my $sip_patron2 = C4::SIP::ILS::Patron->new( $card ); |
27 |
is( $sip_patron2, undef, "Patron is not valid (anymore)" ); |
28 |
is( $sip_patron2, undef, "Patron is not valid (anymore)" ); |
28 |
|
29 |
|
|
|
30 |
subtest "OverduesBlockCirc tests" => sub { |
31 |
|
32 |
plan tests => 6; |
33 |
|
34 |
my $odue_patron = $builder->build({ source => 'Borrower' }); |
35 |
my $good_patron = $builder->build({ source => 'Borrower' }); |
36 |
my $odue = $builder->build({ source => 'Issue', value => { |
37 |
borrowernumber => $odue_patron->{borrowernumber}, |
38 |
date_due => '2017-01-01', |
39 |
} |
40 |
}); |
41 |
t::lib::Mocks::mock_preference( 'OverduesBlockCirc', 'noblock' ); |
42 |
my $odue_sip_patron = C4::SIP::ILS::Patron->new( $odue_patron->{cardnumber} ); |
43 |
is( $odue_sip_patron->{charge_ok}, 1, "Not blocked with overdues when set to 'Don't block'"); |
44 |
$odue_sip_patron = C4::SIP::ILS::Patron->new( $good_patron->{cardnumber} ); |
45 |
is( $odue_sip_patron->{charge_ok}, 1, "Not blocked without overdues when set to 'Don't block'"); |
46 |
|
47 |
t::lib::Mocks::mock_preference( 'OverduesBlockCirc', 'confirmation' ); |
48 |
$odue_sip_patron = C4::SIP::ILS::Patron->new( $odue_patron->{cardnumber} ); |
49 |
is( $odue_sip_patron->{charge_ok}, '', "Blocked with overdues when set to 'Ask for confirmation'"); |
50 |
$odue_sip_patron = C4::SIP::ILS::Patron->new( $good_patron->{cardnumber} ); |
51 |
is( $odue_sip_patron->{charge_ok}, 1, "Not blocked without overdues when set to 'confirmation'"); |
52 |
|
53 |
t::lib::Mocks::mock_preference( 'OverduesBlockCirc', 'block' ); |
54 |
$odue_sip_patron = C4::SIP::ILS::Patron->new( $odue_patron->{cardnumber} ); |
55 |
is( $odue_sip_patron->{charge_ok}, '', "Blocked with overdues when set to 'Block'"); |
56 |
$odue_sip_patron = C4::SIP::ILS::Patron->new( $good_patron->{cardnumber} ); |
57 |
is( $odue_sip_patron->{charge_ok}, 1, "Not blocked without overdues when set to 'Block'"); |
58 |
|
59 |
}; |
60 |
|
29 |
$schema->storage->txn_rollback; |
61 |
$schema->storage->txn_rollback; |
30 |
- |
|
|