Lines 1-7
Link Here
|
1 |
#!/usr/bin/env perl |
1 |
#!/usr/bin/env perl |
2 |
|
2 |
|
3 |
use Modern::Perl; |
3 |
use Modern::Perl; |
4 |
use Test::More tests => 23; |
4 |
use Test::More tests => 25; |
5 |
|
5 |
|
6 |
use t::lib::Mocks; |
6 |
use t::lib::Mocks; |
7 |
|
7 |
|
Lines 67-71
is( C4::Members::checkcardnumber( q{1234567890123456} ), 2, "1234567890123456 is
Link Here
|
67 |
$dbh->{mock_add_resultset} = $rs; |
67 |
$dbh->{mock_add_resultset} = $rs; |
68 |
is( C4::Members::checkcardnumber( q{1234567890} ), 2, "1234567890 is longer than $pref"); |
68 |
is( C4::Members::checkcardnumber( q{1234567890} ), 2, "1234567890 is longer than $pref"); |
69 |
|
69 |
|
|
|
70 |
$pref = q|,40|; # max 40 chars, not allowed |
71 |
t::lib::Mocks::mock_preference('CardnumberLength', $pref); |
72 |
is_deeply( [ C4::Members::get_cardnumber_length() ], [ 0, 16 ], ',40 => min=0 and max=16'); |
73 |
$dbh->{mock_add_resultset} = $rs; |
74 |
is( C4::Members::checkcardnumber( q{12345678901234567890} ), 2, "12345678901234567890 is longer than $pref => 16 is max!"); |
75 |
|
76 |
$pref = q|,8|; # max 8 chars |
77 |
t::lib::Mocks::mock_preference('CardnumberLength', $pref); |
70 |
t::lib::Mocks::mock_preference('BorrowerMandatoryField', 'cardnumber'); |
78 |
t::lib::Mocks::mock_preference('BorrowerMandatoryField', 'cardnumber'); |
71 |
is_deeply( [ C4::Members::get_cardnumber_length() ], [ 1, 8 ], ',8 => min=1 and max=8 if cardnumber is mandatory'); |
79 |
is_deeply( [ C4::Members::get_cardnumber_length() ], [ 1, 8 ], ',8 => min=1 and max=8 if cardnumber is mandatory'); |
72 |
- |
|
|