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 =>18; |
4 |
use Test::More tests => 22; |
5 |
|
5 |
|
6 |
use Test::MockModule; |
6 |
use Test::MockModule; |
7 |
use DBD::Mock; |
7 |
use DBD::Mock; |
Lines 61-68
is( C4::Members::checkcardnumber( q{1234567} ), 2, "1234567 is shorter than $pre
Link Here
|
61 |
$dbh->{mock_add_resultset} = $rs; |
61 |
$dbh->{mock_add_resultset} = $rs; |
62 |
is( C4::Members::checkcardnumber( q{1234567890123456} ), 0, "1234567890123456 matches $pref"); |
62 |
is( C4::Members::checkcardnumber( q{1234567890123456} ), 0, "1234567890123456 matches $pref"); |
63 |
$dbh->{mock_add_resultset} = $rs; |
63 |
$dbh->{mock_add_resultset} = $rs; |
64 |
is( C4::Members::checkcardnumber( q{1234567890} ), 0, "12345678 matches $pref"); |
64 |
is( C4::Members::checkcardnumber( q{1234567890} ), 0, "1234567890 matches $pref"); |
65 |
|
65 |
|
|
|
66 |
$pref = q|,8|; # max 8 chars |
67 |
set_pref( $module_context, $pref ); |
68 |
is_deeply( [ C4::Members::get_cardnumber_length() ], [ 1, 8 ], ',8 => min=1 and max=8'); |
69 |
$dbh->{mock_add_resultset} = $rs; |
70 |
is( C4::Members::checkcardnumber( q{1234567} ), 0, "1234567 matches $pref"); |
71 |
$dbh->{mock_add_resultset} = $rs; |
72 |
is( C4::Members::checkcardnumber( q{1234567890123456} ), 2, "1234567890123456 is longer than $pref"); |
73 |
$dbh->{mock_add_resultset} = $rs; |
74 |
is( C4::Members::checkcardnumber( q{1234567890} ), 2, "1234567890 is longer than $pref"); |
66 |
|
75 |
|
67 |
|
76 |
|
68 |
sub set_pref { |
77 |
sub set_pref { |
69 |
- |
|
|