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

(-)a/t/db_dependent/Members.t (-2 / +13 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 70;
20
use Test::More tests => 72;
21
use Test::MockModule;
21
use Test::MockModule;
22
use Data::Dumper;
22
use Data::Dumper;
23
use C4::Context;
23
use C4::Context;
Lines 304-309 $borrowernumber = AddMember( %data ); Link Here
304
$borrower = GetMember( borrowernumber => $borrowernumber );
304
$borrower = GetMember( borrowernumber => $borrowernumber );
305
is( $borrower->{userid}, $data{userid}, 'AddMember should insert the given userid' );
305
is( $borrower->{userid}, $data{userid}, 'AddMember should insert the given userid' );
306
306
307
# Regression tests for BZ13502
308
## Remove all entries with userid='' (should be only 1 max)
309
$dbh->do(q|DELETE FROM borrowers WHERE userid = ''|);
310
## And create a patron with a userid=''
311
$borrowernumber = AddMember( categorycode => 'S', branchcode => 'MPL' );
312
$dbh->do(q|UPDATE borrowers SET userid = '' WHERE borrowernumber = ?|, undef, $borrowernumber);
313
# Create another patron and verify the userid has been generated
314
$borrowernumber = AddMember( categorycode => 'S', branchcode => 'MPL' );
315
ok( $borrowernumber > 0, 'AddMember should have inserted the patron even if no userid is given' );
316
$borrower = GetMember( borrowernumber => $borrowernumber );
317
ok( $borrower->{userid},  'A userid should have been generated correctly' );
318
307
# Regression tests for BZ12226
319
# Regression tests for BZ12226
308
is( Check_Userid( C4::Context->config('user'), '' ), 0,
320
is( Check_Userid( C4::Context->config('user'), '' ), 0,
309
    'Check_Userid should return 0 for the DB user (Bug 12226)');
321
    'Check_Userid should return 0 for the DB user (Bug 12226)');
310
- 

Return to bug 13502