Lines 31-37
my $builder = t::lib::TestBuilder->new;
Link Here
|
31 |
|
31 |
|
32 |
subtest 'is_valid' => sub { |
32 |
subtest 'is_valid' => sub { |
33 |
|
33 |
|
34 |
plan tests => 23; |
34 |
plan tests => 25; |
35 |
|
35 |
|
36 |
$schema->storage->txn_begin; |
36 |
$schema->storage->txn_begin; |
37 |
|
37 |
|
Lines 61-66
subtest 'is_valid' => sub {
Link Here
|
61 |
$is_valid = $policy->is_valid( "123" ); |
61 |
$is_valid = $policy->is_valid( "123" ); |
62 |
ok( !$is_valid, "Invalid cardnumber length"); |
62 |
ok( !$is_valid, "Invalid cardnumber length"); |
63 |
|
63 |
|
|
|
64 |
$is_valid = $policy->is_valid( " 123" ); |
65 |
ok( !$is_valid, "Invalid cardnumber length"); |
66 |
|
64 |
my $pref = "10"; |
67 |
my $pref = "10"; |
65 |
t::lib::Mocks::mock_preference('CardnumberLength', $pref); |
68 |
t::lib::Mocks::mock_preference('CardnumberLength', $pref); |
66 |
ok( !$policy->is_valid( q{123456789} ), "123456789 is shorter than $pref"); |
69 |
ok( !$policy->is_valid( q{123456789} ), "123456789 is shorter than $pref"); |
Lines 95-100
subtest 'is_valid' => sub {
Link Here
|
95 |
ok( $policy->is_valid(undef), "If cardnumber is null, we assume they're allowed") ; |
98 |
ok( $policy->is_valid(undef), "If cardnumber is null, we assume they're allowed") ; |
96 |
ok( !$policy->is_valid(""), "Empty string is not correct" ); |
99 |
ok( !$policy->is_valid(""), "Empty string is not correct" ); |
97 |
|
100 |
|
|
|
101 |
$is_valid = $policy->is_valid( " " ); |
102 |
ok( !$is_valid, "Spaces are not allowed"); |
103 |
|
98 |
$schema->storage->txn_rollback; |
104 |
$schema->storage->txn_rollback; |
99 |
}; |
105 |
}; |
100 |
|
106 |
|
101 |
- |
|
|