View | Details | Raw Unified | Return to bug 33940
Collapse All | Expand All

(-)a/Koha/Policy/Patrons/Cardnumber.pm (-1 / +1 lines)
Lines 51-57 Returns whether a cardnumber is valid of not for a given I<Koha::Patron> object. Link Here
51
sub is_valid {
51
sub is_valid {
52
    my ( $class, $cardnumber, $patron ) = @_;
52
    my ( $class, $cardnumber, $patron ) = @_;
53
53
54
    return Koha::Result::Boolean->new(0)->add_message( { message => "is_empty" } )
54
    return Koha::Result::Boolean->new(1)
55
        unless defined $cardnumber;
55
        unless defined $cardnumber;
56
56
57
    return Koha::Result::Boolean->new(0)->add_message( { message => "already_exists" } )
57
    return Koha::Result::Boolean->new(0)->add_message( { message => "already_exists" } )
(-)a/t/db_dependent/Koha/Policy/Patrons/Cardnumber.t (-2 / +4 lines)
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 => 21;
34
    plan tests => 23;
35
35
36
    $schema->storage->txn_begin;
36
    $schema->storage->txn_begin;
37
37
Lines 92-97 subtest 'is_valid' => sub { Link Here
92
    ok( !$policy->is_valid( q{1234567890123456} ), "1234567890123456 is longer than $pref");
92
    ok( !$policy->is_valid( q{1234567890123456} ), "1234567890123456 is longer than $pref");
93
    ok( !$policy->is_valid( q{1234567890} ), "1234567890 is longer than $pref");
93
    ok( !$policy->is_valid( q{1234567890} ), "1234567890 is longer than $pref");
94
94
95
    ok( $policy->is_valid(undef), "If cardnumber is null, we assume they're allowed") ;
96
    ok( !$policy->is_valid(""), "Empty string is not correct" );
97
95
    $schema->storage->txn_rollback;
98
    $schema->storage->txn_rollback;
96
};
99
};
97
100
98
- 

Return to bug 33940