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

(-)a/t/db_dependent/Koha/Patrons.t (-7 / +7 lines)
Lines 1041-1054 subtest 'generate_userid' => sub { Link Here
1041
    );
1041
    );
1042
1042
1043
    my $expected_userid_patron_1 = 'tomasito.none';
1043
    my $expected_userid_patron_1 = 'tomasito.none';
1044
    my $userid = C4::Members::Generate_Userid( undef, $data{firstname}, $data{surname} );
1044
    my $new_patron = Koha::Patron->new({ firstname => $data{firstname}, surname => $data{surname} } );
1045
    is( $userid, $expected_userid_patron_1, 'Generate_Userid should generate the userid we expect' );
1045
    my $userid = $new_patron->generate_userid;
1046
    is( $userid, $expected_userid_patron_1, 'generate_userid should generate the userid we expect' );
1046
    my $borrowernumber = AddMember(%data);
1047
    my $borrowernumber = AddMember(%data);
1047
    my $patron_1 = Koha::Patrons->find($borrowernumber);
1048
    my $patron_1 = Koha::Patrons->find($borrowernumber);
1048
    is ( $patron_1->userid, $expected_userid_patron_1, 'The userid generated should be the one we expect' );
1049
    is ( $patron_1->userid, $expected_userid_patron_1, 'The userid generated should be the one we expect' );
1049
1050
1050
    $userid = C4::Members::Generate_Userid( $borrowernumber, $data{firstname}, $data{surname} );
1051
    $userid = $new_patron->generate_userid;
1051
    is( $userid, $expected_userid_patron_1 . '1', 'Generate_Userid should generate the userid we expect' );
1052
    is( $userid, $expected_userid_patron_1 . '1', 'generate_userid should generate the userid we expect' );
1052
    $data{cardnumber} = '987654321';
1053
    $data{cardnumber} = '987654321';
1053
    my $new_borrowernumber = AddMember(%data);
1054
    my $new_borrowernumber = AddMember(%data);
1054
    my $patron_2 = Koha::Patrons->find($new_borrowernumber);
1055
    my $patron_2 = Koha::Patrons->find($new_borrowernumber);
Lines 1057-1064 subtest 'generate_userid' => sub { Link Here
1057
    is( $patron_2->userid, $expected_userid_patron_1 . '1', # TODO we could make that configurable
1058
    is( $patron_2->userid, $expected_userid_patron_1 . '1', # TODO we could make that configurable
1058
        "Patron with duplicate userid has new userid generated (1 is appened" );
1059
        "Patron with duplicate userid has new userid generated (1 is appened" );
1059
1060
1060
    $userid = C4::Members::Generate_Userid( $borrowernumber, $data{firstname}, $data{surname} );
1061
    $userid = $new_patron->generate_userid;
1061
    is( $userid, $expected_userid_patron_1 . '2', 'Generate_Userid should generate the userid we expect' );
1062
    is( $userid, $expected_userid_patron_1 . '2', 'generate_userid should generate the userid we expect' );
1062
1063
1063
    # Cleanup
1064
    # Cleanup
1064
    $patron_1->delete;
1065
    $patron_1->delete;
1065
- 

Return to bug 19936