Lines 1204-1217
subtest 'generate_userid' => sub {
Link Here
|
1204 |
); |
1204 |
); |
1205 |
|
1205 |
|
1206 |
my $expected_userid_patron_1 = 'tomasito.none'; |
1206 |
my $expected_userid_patron_1 = 'tomasito.none'; |
1207 |
my $userid = C4::Members::Generate_Userid( undef, $data{firstname}, $data{surname} ); |
1207 |
my $new_patron = Koha::Patron->new({ firstname => $data{firstname}, surname => $data{surname} } ); |
1208 |
is( $userid, $expected_userid_patron_1, 'Generate_Userid should generate the userid we expect' ); |
1208 |
my $userid = $new_patron->generate_userid; |
|
|
1209 |
is( $userid, $expected_userid_patron_1, 'generate_userid should generate the userid we expect' ); |
1209 |
my $borrowernumber = AddMember(%data); |
1210 |
my $borrowernumber = AddMember(%data); |
1210 |
my $patron_1 = Koha::Patrons->find($borrowernumber); |
1211 |
my $patron_1 = Koha::Patrons->find($borrowernumber); |
1211 |
is ( $patron_1->userid, $expected_userid_patron_1, 'The userid generated should be the one we expect' ); |
1212 |
is ( $patron_1->userid, $expected_userid_patron_1, 'The userid generated should be the one we expect' ); |
1212 |
|
1213 |
|
1213 |
$userid = C4::Members::Generate_Userid( $borrowernumber, $data{firstname}, $data{surname} ); |
1214 |
$userid = $new_patron->generate_userid; |
1214 |
is( $userid, $expected_userid_patron_1 . '1', 'Generate_Userid should generate the userid we expect' ); |
1215 |
is( $userid, $expected_userid_patron_1 . '1', 'generate_userid should generate the userid we expect' ); |
1215 |
$data{cardnumber} = '987654321'; |
1216 |
$data{cardnumber} = '987654321'; |
1216 |
my $new_borrowernumber = AddMember(%data); |
1217 |
my $new_borrowernumber = AddMember(%data); |
1217 |
my $patron_2 = Koha::Patrons->find($new_borrowernumber); |
1218 |
my $patron_2 = Koha::Patrons->find($new_borrowernumber); |
Lines 1220-1227
subtest 'generate_userid' => sub {
Link Here
|
1220 |
is( $patron_2->userid, $expected_userid_patron_1 . '1', # TODO we could make that configurable |
1221 |
is( $patron_2->userid, $expected_userid_patron_1 . '1', # TODO we could make that configurable |
1221 |
"Patron with duplicate userid has new userid generated (1 is appened" ); |
1222 |
"Patron with duplicate userid has new userid generated (1 is appened" ); |
1222 |
|
1223 |
|
1223 |
$userid = C4::Members::Generate_Userid( $borrowernumber, $data{firstname}, $data{surname} ); |
1224 |
$userid = $new_patron->generate_userid; |
1224 |
is( $userid, $expected_userid_patron_1 . '2', 'Generate_Userid should generate the userid we expect' ); |
1225 |
is( $userid, $expected_userid_patron_1 . '2', 'generate_userid should generate the userid we expect' ); |
1225 |
|
1226 |
|
1226 |
# Cleanup |
1227 |
# Cleanup |
1227 |
$patron_1->delete; |
1228 |
$patron_1->delete; |
1228 |
- |
|
|