Bug 13502: Add tests to highlight the problem
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
parent
426a48dd19
commit
a43e6d26f6
1 changed files with 13 additions and 1 deletions
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
use Modern::Perl;
|
use Modern::Perl;
|
||||||
|
|
||||||
use Test::More tests => 70;
|
use Test::More tests => 72;
|
||||||
use Test::MockModule;
|
use Test::MockModule;
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
use C4::Context;
|
use C4::Context;
|
||||||
|
@ -304,6 +304,18 @@ $borrowernumber = AddMember( %data );
|
||||||
$borrower = GetMember( borrowernumber => $borrowernumber );
|
$borrower = GetMember( borrowernumber => $borrowernumber );
|
||||||
is( $borrower->{userid}, $data{userid}, 'AddMember should insert the given userid' );
|
is( $borrower->{userid}, $data{userid}, 'AddMember should insert the given userid' );
|
||||||
|
|
||||||
|
# Regression tests for BZ13502
|
||||||
|
## Remove all entries with userid='' (should be only 1 max)
|
||||||
|
$dbh->do(q|DELETE FROM borrowers WHERE userid = ''|);
|
||||||
|
## And create a patron with a userid=''
|
||||||
|
$borrowernumber = AddMember( categorycode => 'S', branchcode => 'MPL' );
|
||||||
|
$dbh->do(q|UPDATE borrowers SET userid = '' WHERE borrowernumber = ?|, undef, $borrowernumber);
|
||||||
|
# Create another patron and verify the userid has been generated
|
||||||
|
$borrowernumber = AddMember( categorycode => 'S', branchcode => 'MPL' );
|
||||||
|
ok( $borrowernumber > 0, 'AddMember should have inserted the patron even if no userid is given' );
|
||||||
|
$borrower = GetMember( borrowernumber => $borrowernumber );
|
||||||
|
ok( $borrower->{userid}, 'A userid should have been generated correctly' );
|
||||||
|
|
||||||
# Regression tests for BZ12226
|
# Regression tests for BZ12226
|
||||||
is( Check_Userid( C4::Context->config('user'), '' ), 0,
|
is( Check_Userid( C4::Context->config('user'), '' ), 0,
|
||||||
'Check_Userid should return 0 for the DB user (Bug 12226)');
|
'Check_Userid should return 0 for the DB user (Bug 12226)');
|
||||||
|
|
Loading…
Reference in a new issue