Lines 1283-1296
subtest 'generate_userid' => sub {
Link Here
|
1283 |
); |
1283 |
); |
1284 |
|
1284 |
|
1285 |
my $expected_userid_patron_1 = 'tomasito.none'; |
1285 |
my $expected_userid_patron_1 = 'tomasito.none'; |
1286 |
my $userid = C4::Members::Generate_Userid( undef, $data{firstname}, $data{surname} ); |
1286 |
my $new_patron = Koha::Patron->new({ firstname => $data{firstname}, surname => $data{surname} } ); |
1287 |
is( $userid, $expected_userid_patron_1, 'Generate_Userid should generate the userid we expect' ); |
1287 |
my $userid = $new_patron->generate_userid; |
|
|
1288 |
is( $userid, $expected_userid_patron_1, 'generate_userid should generate the userid we expect' ); |
1288 |
my $borrowernumber = AddMember(%data); |
1289 |
my $borrowernumber = AddMember(%data); |
1289 |
my $patron_1 = Koha::Patrons->find($borrowernumber); |
1290 |
my $patron_1 = Koha::Patrons->find($borrowernumber); |
1290 |
is ( $patron_1->userid, $expected_userid_patron_1, 'The userid generated should be the one we expect' ); |
1291 |
is ( $patron_1->userid, $expected_userid_patron_1, 'The userid generated should be the one we expect' ); |
1291 |
|
1292 |
|
1292 |
$userid = C4::Members::Generate_Userid( $borrowernumber, $data{firstname}, $data{surname} ); |
1293 |
$userid = $new_patron->generate_userid; |
1293 |
is( $userid, $expected_userid_patron_1 . '1', 'Generate_Userid should generate the userid we expect' ); |
1294 |
is( $userid, $expected_userid_patron_1 . '1', 'generate_userid should generate the userid we expect' ); |
1294 |
$data{cardnumber} = '987654321'; |
1295 |
$data{cardnumber} = '987654321'; |
1295 |
my $new_borrowernumber = AddMember(%data); |
1296 |
my $new_borrowernumber = AddMember(%data); |
1296 |
my $patron_2 = Koha::Patrons->find($new_borrowernumber); |
1297 |
my $patron_2 = Koha::Patrons->find($new_borrowernumber); |
Lines 1299-1306
subtest 'generate_userid' => sub {
Link Here
|
1299 |
is( $patron_2->userid, $expected_userid_patron_1 . '1', # TODO we could make that configurable |
1300 |
is( $patron_2->userid, $expected_userid_patron_1 . '1', # TODO we could make that configurable |
1300 |
"Patron with duplicate userid has new userid generated (1 is appened" ); |
1301 |
"Patron with duplicate userid has new userid generated (1 is appened" ); |
1301 |
|
1302 |
|
1302 |
$userid = C4::Members::Generate_Userid( $borrowernumber, $data{firstname}, $data{surname} ); |
1303 |
$userid = $new_patron->generate_userid; |
1303 |
is( $userid, $expected_userid_patron_1 . '2', 'Generate_Userid should generate the userid we expect' ); |
1304 |
is( $userid, $expected_userid_patron_1 . '2', 'generate_userid should generate the userid we expect' ); |
1304 |
|
1305 |
|
1305 |
# Cleanup |
1306 |
# Cleanup |
1306 |
$patron_1->delete; |
1307 |
$patron_1->delete; |
1307 |
- |
|
|