Bug 18169: Add test without before parameter for search_patrons_to_anonymise
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
ff647be07c
commit
19cbebc9b6
1 changed files with 12 additions and 1 deletions
|
@ -688,7 +688,7 @@ subtest 'search_patrons_to_anonymise & anonymise_issue_history' => sub {
|
||||||
t::lib::Mocks::mock_preference( 'AnonymousPatron', $anonymous->{borrowernumber} );
|
t::lib::Mocks::mock_preference( 'AnonymousPatron', $anonymous->{borrowernumber} );
|
||||||
|
|
||||||
subtest 'patron privacy is 1 (default)' => sub {
|
subtest 'patron privacy is 1 (default)' => sub {
|
||||||
plan tests => 6;
|
plan tests => 8;
|
||||||
|
|
||||||
t::lib::Mocks::mock_preference('IndependentBranches', 0);
|
t::lib::Mocks::mock_preference('IndependentBranches', 0);
|
||||||
my $patron = $builder->build(
|
my $patron = $builder->build(
|
||||||
|
@ -753,6 +753,17 @@ subtest 'search_patrons_to_anonymise & anonymise_issue_history' => sub {
|
||||||
($borrowernumber_used_to_anonymised) = $sth->fetchrow_array;
|
($borrowernumber_used_to_anonymised) = $sth->fetchrow_array;
|
||||||
is( $borrowernumber_used_to_anonymised, $anonymous->{borrowernumber}, 'The issue should have been anonymised, the returned date is before' );
|
is( $borrowernumber_used_to_anonymised, $anonymous->{borrowernumber}, 'The issue should have been anonymised, the returned date is before' );
|
||||||
|
|
||||||
|
my $sth_reset = $dbh->prepare(q|UPDATE old_issues SET borrowernumber = ? WHERE itemnumber = ?|);
|
||||||
|
$sth_reset->execute( $patron->{borrowernumber}, $item_1->{itemnumber} );
|
||||||
|
$sth_reset->execute( $patron->{borrowernumber}, $item_2->{itemnumber} );
|
||||||
|
$rows_affected = Koha::Patrons->search_patrons_to_anonymise->anonymise_issue_history;
|
||||||
|
$sth->execute($item_1->{itemnumber});
|
||||||
|
($borrowernumber_used_to_anonymised) = $sth->fetchrow_array;
|
||||||
|
is( $borrowernumber_used_to_anonymised, $anonymous->{borrowernumber}, 'The issue 1 should have been anonymised, before parameter was not passed' );
|
||||||
|
$sth->execute($item_2->{itemnumber});
|
||||||
|
($borrowernumber_used_to_anonymised) = $sth->fetchrow_array;
|
||||||
|
is( $borrowernumber_used_to_anonymised, $anonymous->{borrowernumber}, 'The issue 2 should have been anonymised, before parameter was not passed' );
|
||||||
|
|
||||||
Koha::Patrons->find( $patron->{borrowernumber})->delete;
|
Koha::Patrons->find( $patron->{borrowernumber})->delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue