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

(-)a/t/db_dependent/Koha/Patrons.t (-1 / +5 lines)
Lines 1810-1816 subtest 'Test Koha::Patrons::merge' => sub { Link Here
1810
};
1810
};
1811
1811
1812
subtest '->store' => sub {
1812
subtest '->store' => sub {
1813
    plan tests => 9;
1813
    plan tests => 11;
1814
    my $schema = Koha::Database->new->schema;
1814
    my $schema = Koha::Database->new->schema;
1815
    $schema->storage->txn_begin;
1815
    $schema->storage->txn_begin;
1816
1816
Lines 1824-1829 subtest '->store' => sub { Link Here
1824
    # Clear userid and check regeneration
1824
    # Clear userid and check regeneration
1825
    $patron_2->userid(undef)->store;
1825
    $patron_2->userid(undef)->store;
1826
    like( $patron_2->userid, qr/\w+\.\w+/, 'Userid regenerated' ); # old school userid
1826
    like( $patron_2->userid, qr/\w+\.\w+/, 'Userid regenerated' ); # old school userid
1827
    $patron_2->userid('')->store;
1828
    like( $patron_2->userid, qr/\w+\.\w+/, 'Userid regenerated' ); # old school userid
1829
    $patron_2->userid(0)->store;
1830
    like( $patron_2->userid, qr/\w+\.\w+/, 'Userid regenerated' ); # old school userid
1827
1831
1828
    # Test password
1832
    # Test password
1829
    t::lib::Mocks::mock_preference( 'RequireStrongPassword', 0 );
1833
    t::lib::Mocks::mock_preference( 'RequireStrongPassword', 0 );
(-)a/t/db_dependent/Members.t (-24 / +1 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 54;
20
use Test::More tests => 53;
21
use Test::MockModule;
21
use Test::MockModule;
22
use Test::Exception;
22
use Test::Exception;
23
23
Lines 154-181 is( $borrower->{debarred}, '2042-01-01', 'Koha::Patron->store should correctly s Link Here
154
is( $borrower->{dateexpiry}, '9999-12-31', 'Koha::Patron->store should correctly set dateexpiry if a valid date is given');
154
is( $borrower->{dateexpiry}, '9999-12-31', 'Koha::Patron->store should correctly set dateexpiry if a valid date is given');
155
is( $borrower->{dateenrolled}, '2015-09-06', 'Koha::Patron->store should correctly set dateenrolled if a valid date is given');
155
is( $borrower->{dateenrolled}, '2015-09-06', 'Koha::Patron->store should correctly set dateenrolled if a valid date is given');
156
156
157
subtest 'Koha::Patron->store should not update userid if not true' => sub {
158
    plan tests => 3;
159
160
    # TODO Move this to t/db_dependent/Koha/Patrons.t subtest ->store
161
162
    $data{ cardnumber } = "234567890";
163
    $data{userid} = 'a_user_id';
164
    $borrowernumber = Koha::Patron->new( \%data )->store->borrowernumber;
165
    my $patron = Koha::Patrons->find( $borrowernumber );
166
    my $borrower = $patron->unblessed;
167
168
    $patron->set( { firstname => 'Tomas', userid => '' } )->store;
169
    $borrower = Koha::Patrons->find( $borrowernumber )->unblessed;
170
    is ( $borrower->{userid}, $data{userid}, 'Koha::Patron->store should not update the userid with an empty string' );
171
    $patron->set( { firstname => 'Tomas', userid => 0 } )->store;
172
    $borrower = Koha::Patrons->find( $borrowernumber )->unblessed;
173
    is ( $borrower->{userid}, $data{userid}, 'Koha::Patron->store should not update the userid with an 0');
174
    $patron->set( { firstname => 'Tomas', userid => undef } )->store;
175
    $borrower = Koha::Patrons->find( $borrowernumber )->unblessed;
176
    is ( $borrower->{userid}, $data{userid}, 'Koha::Patron->store should not update the userid with an undefined value');
177
};
178
179
#Regression tests for bug 10612
157
#Regression tests for bug 10612
180
my $library3 = $builder->build({
158
my $library3 = $builder->build({
181
    source => 'Branch',
159
    source => 'Branch',
182
- 

Return to bug 32426