Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 62; |
20 |
use Test::More tests => 74; |
21 |
use Test::MockModule; |
21 |
use Test::MockModule; |
22 |
use Data::Dumper; |
22 |
use Data::Dumper; |
23 |
use C4::Context; |
23 |
use C4::Context; |
Lines 217-223
is( $borrower, undef, 'DelMember should remove the patron' );
Link Here
|
217 |
categorycode => "S", |
217 |
categorycode => "S", |
218 |
branchcode => "MPL", |
218 |
branchcode => "MPL", |
219 |
dateofbirth => '', |
219 |
dateofbirth => '', |
220 |
dateexpiry => '9999-12-31', |
220 |
debarred => '', |
|
|
221 |
dateexpiry => '', |
222 |
dateenrolled => '', |
221 |
); |
223 |
); |
222 |
# Add a new borrower |
224 |
# Add a new borrower |
223 |
my $borrowernumber = AddMember( %data ); |
225 |
my $borrowernumber = AddMember( %data ); |
Lines 230-235
is( Check_Userid( 'tomasito.none', '' ), 0,
Link Here
|
230 |
is( Check_Userid( 'tomasitoxxx', '' ), 1, |
232 |
is( Check_Userid( 'tomasitoxxx', '' ), 1, |
231 |
'non-existent userid -> unique (blank borrowernumber)' ); |
233 |
'non-existent userid -> unique (blank borrowernumber)' ); |
232 |
|
234 |
|
|
|
235 |
$borrower = GetMember( borrowernumber => $borrowernumber ); |
236 |
is( $borrower->{dateofbirth}, undef, 'AddMember should undef dateofbirth if empty string is given'); |
237 |
is( $borrower->{debarred}, undef, 'AddMember should undef debarred if empty string is given'); |
238 |
isnt( $borrower->{dateexpiry}, '0000-00-00', 'AddMember should not set dateexpiry to 0000-00-00 if empty string is given'); |
239 |
isnt( $borrower->{dateenrolled}, '0000-00-00', 'AddMember should not set dateenrolled to 0000-00-00 if empty string is given'); |
240 |
|
241 |
ModMember( borrowernumber => $borrowernumber, dateofbirth => '', debarred => '', dateexpiry => '', dateenrolled => '' ); |
242 |
$borrower = GetMember( borrowernumber => $borrowernumber ); |
243 |
is( $borrower->{dateofbirth}, undef, 'ModMember should undef dateofbirth if empty string is given'); |
244 |
is( $borrower->{debarred}, undef, 'ModMember should undef debarred if empty string is given'); |
245 |
isnt( $borrower->{dateexpiry}, '0000-00-00', 'ModMember should not set dateexpiry to 0000-00-00 if empty string is given'); |
246 |
isnt( $borrower->{dateenrolled}, '0000-00-00', 'ModMember should not set dateenrolled to 0000-00-00 if empty string is given'); |
247 |
|
248 |
ModMember( borrowernumber => $borrowernumber, dateofbirth => '1970-01-01', debarred => '2042-01-01', dateexpiry => '9999-12-31', dateenrolled => '2015-09-06' ); |
249 |
$borrower = GetMember( borrowernumber => $borrowernumber ); |
250 |
is( $borrower->{dateofbirth}, '1970-01-01', 'ModMember should correctly set dateofbirth if a valid date is given'); |
251 |
is( $borrower->{debarred}, '2042-01-01', 'ModMember should correctly set debarred if a valid date is given'); |
252 |
is( $borrower->{dateexpiry}, '9999-12-31', 'ModMember should correctly set dateexpiry if a valid date is given'); |
253 |
is( $borrower->{dateenrolled}, '2015-09-06', 'ModMember should correctly set dateenrolled if a valid date is given'); |
254 |
|
233 |
# Add a new borrower with the same userid but different cardnumber |
255 |
# Add a new borrower with the same userid but different cardnumber |
234 |
$data{ cardnumber } = "987654321"; |
256 |
$data{ cardnumber } = "987654321"; |
235 |
my $new_borrowernumber = AddMember( %data ); |
257 |
my $new_borrowernumber = AddMember( %data ); |
236 |
- |
|
|