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

(-)a/t/db_dependent/Koha/Patrons.t (-7 / +7 lines)
Lines 1141-1154 subtest 'generate_userid' => sub { Link Here
1141
    );
1141
    );
1142
1142
1143
    my $expected_userid_patron_1 = 'tomasito.none';
1143
    my $expected_userid_patron_1 = 'tomasito.none';
1144
    my $userid = C4::Members::Generate_Userid( undef, $data{firstname}, $data{surname} );
1144
    my $new_patron = Koha::Patron->new({ firstname => $data{firstname}, surname => $data{surname} } );
1145
    is( $userid, $expected_userid_patron_1, 'Generate_Userid should generate the userid we expect' );
1145
    my $userid = $new_patron->generate_userid;
1146
    is( $userid, $expected_userid_patron_1, 'generate_userid should generate the userid we expect' );
1146
    my $borrowernumber = AddMember(%data);
1147
    my $borrowernumber = AddMember(%data);
1147
    my $patron_1 = Koha::Patrons->find($borrowernumber);
1148
    my $patron_1 = Koha::Patrons->find($borrowernumber);
1148
    is ( $patron_1->userid, $expected_userid_patron_1, 'The userid generated should be the one we expect' );
1149
    is ( $patron_1->userid, $expected_userid_patron_1, 'The userid generated should be the one we expect' );
1149
1150
1150
    $userid = C4::Members::Generate_Userid( $borrowernumber, $data{firstname}, $data{surname} );
1151
    $userid = $new_patron->generate_userid;
1151
    is( $userid, $expected_userid_patron_1 . '1', 'Generate_Userid should generate the userid we expect' );
1152
    is( $userid, $expected_userid_patron_1 . '1', 'generate_userid should generate the userid we expect' );
1152
    $data{cardnumber} = '987654321';
1153
    $data{cardnumber} = '987654321';
1153
    my $new_borrowernumber = AddMember(%data);
1154
    my $new_borrowernumber = AddMember(%data);
1154
    my $patron_2 = Koha::Patrons->find($new_borrowernumber);
1155
    my $patron_2 = Koha::Patrons->find($new_borrowernumber);
Lines 1157-1164 subtest 'generate_userid' => sub { Link Here
1157
    is( $patron_2->userid, $expected_userid_patron_1 . '1', # TODO we could make that configurable
1158
    is( $patron_2->userid, $expected_userid_patron_1 . '1', # TODO we could make that configurable
1158
        "Patron with duplicate userid has new userid generated (1 is appened" );
1159
        "Patron with duplicate userid has new userid generated (1 is appened" );
1159
1160
1160
    $userid = C4::Members::Generate_Userid( $borrowernumber, $data{firstname}, $data{surname} );
1161
    $userid = $new_patron->generate_userid;
1161
    is( $userid, $expected_userid_patron_1 . '2', 'Generate_Userid should generate the userid we expect' );
1162
    is( $userid, $expected_userid_patron_1 . '2', 'generate_userid should generate the userid we expect' );
1162
1163
1163
    # Cleanup
1164
    # Cleanup
1164
    $patron_1->delete;
1165
    $patron_1->delete;
1165
- 

Return to bug 19936