Lines 8-14
use Koha::Patrons;
Link Here
|
8 |
|
8 |
|
9 |
use t::lib::TestBuilder; |
9 |
use t::lib::TestBuilder; |
10 |
|
10 |
|
11 |
use Test::More tests => 31; |
11 |
use Test::More tests => 33; |
12 |
|
12 |
|
13 |
use_ok('Koha::Patron::Debarments'); |
13 |
use_ok('Koha::Patron::Debarments'); |
14 |
|
14 |
|
Lines 161-163
is( Koha::Patrons->find( $borrowernumber )->is_debarred, undef, 'A patron withou
Link Here
|
161 |
|
161 |
|
162 |
$dbh->do(q|UPDATE borrowers SET debarred = '9999-12-31'|); # Note: Change this test before the first of January 10000! |
162 |
$dbh->do(q|UPDATE borrowers SET debarred = '9999-12-31'|); # Note: Change this test before the first of January 10000! |
163 |
is( Koha::Patrons->find( $borrowernumber )->is_debarred, '9999-12-31', 'A patron with a debarred date in the future is debarred' ); |
163 |
is( Koha::Patrons->find( $borrowernumber )->is_debarred, '9999-12-31', 'A patron with a debarred date in the future is debarred' ); |
164 |
- |
164 |
|
|
|
165 |
# Test patrons merge |
166 |
my $borrowernumber2 = Koha::Patron->new( |
167 |
{ |
168 |
firstname => 'my firstname bis', |
169 |
surname => 'my surname bis', |
170 |
categorycode => $patron_category->{categorycode}, |
171 |
branchcode => $library->{branchcode}, |
172 |
} |
173 |
)->store->borrowernumber; |
174 |
my $debarreddate2 = '9999-06-10'; # Be sure to be in the future |
175 |
my $debarredcomment2 = 'Test merge'; |
176 |
AddDebarment( |
177 |
{ |
178 |
borrowernumber => $borrowernumber2, |
179 |
expiration => $debarreddate2, |
180 |
type => 'MANUAL', |
181 |
comment => $debarredcomment2, |
182 |
} |
183 |
); |
184 |
my $borrowernumber3 = Koha::Patron->new( |
185 |
{ |
186 |
firstname => 'my firstname ter', |
187 |
surname => 'my surname ter', |
188 |
categorycode => $patron_category->{categorycode}, |
189 |
branchcode => $library->{branchcode}, |
190 |
} |
191 |
)->store->borrowernumber; |
192 |
Koha::Patrons->find($borrowernumber3)->merge_with( [$borrowernumber2] ); |
193 |
is( Koha::Patrons->find($borrowernumber3)->debarred, |
194 |
$debarreddate2, 'Koha::Patron->merge_with() transfers well debarred' ); |
195 |
is( Koha::Patrons->find($borrowernumber3)->debarredcomment, |
196 |
$debarredcomment2, 'Koha::Patron->merge_with() transfers well debarredcomment' ); |