Bug 43069: Add tests
1) Set system preference 'PatronDuplicateMatchingAddFields' to empty (no fields ticked) 2) Go to <staff_url>/cgi-bin/koha/members/memberentry.pl?op=add and fill in the mandatory fields for a brand new patron (one that definitely doesn't exist yet) 3) Click 'Save' 4) Notice you get the 'Duplicate patron record?' dialog, even though no patron like this exists 5) Apply the patch. Restart plack 6) Repeat steps 2-3 with another new patron 7) Confirm the patron is created fine this time, no false duplicate error 8) Also try setting 'PatronDuplicateMatchingAddFields' to a field (e.g. 'city') and submit a new patron with that field left blank - confirm no false duplicate there either 9) Run: prove t/db_dependent/Koha/Patrons.t Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
8697929514
commit
ff6ee4057d
|
|
@ -3888,7 +3888,7 @@ subtest 'find_by_identifier() tests' => sub {
|
|||
};
|
||||
|
||||
subtest 'check_for_existing_matches' => sub {
|
||||
plan tests => 5;
|
||||
plan tests => 7;
|
||||
|
||||
$schema->storage->txn_begin;
|
||||
|
||||
|
|
@ -3896,9 +3896,22 @@ subtest 'check_for_existing_matches' => sub {
|
|||
{ class => 'Koha::Patrons', value => { firstname => 'John', surname => 'Smith', dateofbirth => '1980-01-01' } }
|
||||
);
|
||||
|
||||
t::lib::Mocks::mock_preference( 'PatronDuplicateMatchingAddFields', '' );
|
||||
my $match_result = Koha::Patrons->check_for_existing_matches(
|
||||
{ firstname => 'Someone', surname => 'Else', dateofbirth => '1999-09-09' } );
|
||||
is( $match_result->{duplicate_found}, 0, 'No duplicate found when PatronDuplicateMatchingAddFields is empty' );
|
||||
|
||||
t::lib::Mocks::mock_preference( 'PatronDuplicateMatchingAddFields', 'city' );
|
||||
$match_result = Koha::Patrons->check_for_existing_matches(
|
||||
{ firstname => 'Someone', surname => 'Else', dateofbirth => '1999-09-09' } );
|
||||
is(
|
||||
$match_result->{duplicate_found}, 0,
|
||||
'No duplicate found when none of the configured match fields are populated'
|
||||
);
|
||||
|
||||
t::lib::Mocks::mock_preference( 'PatronDuplicateMatchingAddFields', 'dateofbirth|firstname|surname' );
|
||||
|
||||
my $match_result = Koha::Patrons->check_for_existing_matches(
|
||||
$match_result = Koha::Patrons->check_for_existing_matches(
|
||||
{ firstname => 'John', surname => 'Smith', dateofbirth => '1980-01-01' } );
|
||||
is( $match_result->{duplicate_found}, 1, 'Duplicate found' );
|
||||
is( $match_result->{matching_patrons}->next->borrowernumber, $patron->borrowernumber, 'Matching patron' );
|
||||
|
|
|
|||
Loading…
Reference in New Issue