From 3f5b2a08bcdf61398bc63791d46d1fa327aa4a03 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 12 Oct 2023 09:56:25 +0000 Subject: [PATCH] Bug 35042: Remove set datelastseen to null on table in Members.t Content-Type: text/plain; charset=utf-8 Non-trivial was adding the category_type <> S. Test plan: Run t/db_dependent/Members.t Signed-off-by: Marcel de Rooy --- t/db_dependent/Members.t | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/t/db_dependent/Members.t b/t/db_dependent/Members.t index 7dceafd1bb..1a314682c1 100755 --- a/t/db_dependent/Members.t +++ b/t/db_dependent/Members.t @@ -281,12 +281,17 @@ $patstodel = GetBorrowersToExpunge( {not_borrowed_since => '2016-01-02', patron_ is( scalar(@$patstodel),2,'Borrowers without issues deleted by last issue date'); # Test GetBorrowersToExpunge and TrackLastPatronActivity -$dbh->do(q|UPDATE borrowers SET lastseen=NULL|); +my $new_category = $builder->build_object( + { + class => 'Koha::Patron::Categories', + value => { category_type => 'A' }, # should not be S for GetBorrowersToExpunge + } +); $builder->build({ source => 'Borrower', value => { lastseen => '2016-01-01 01:01:01', - categorycode => 'CIVILIAN', + categorycode => $new_category->categorycode, flags => undef, } }); @@ -294,7 +299,7 @@ $builder->build({ source => 'Borrower', value => { lastseen => '2016-02-02 02:02:02', - categorycode => 'CIVILIAN', + categorycode => $new_category->categorycode, flags => undef, } }); @@ -302,15 +307,15 @@ $builder->build({ source => 'Borrower', value => { lastseen => '2016-03-03 03:03:03', - categorycode => 'CIVILIAN', + categorycode => $new_category->categorycode, flags => undef, } }); -$patstodel = GetBorrowersToExpunge( { last_seen => '1999-12-12' }); +$patstodel = GetBorrowersToExpunge( { category_code => $new_category->categorycode, last_seen => '1999-12-12' }); is( scalar @$patstodel, 0, 'TrackLastPatronActivity - 0 patrons must be deleted' ); -$patstodel = GetBorrowersToExpunge( { last_seen => '2016-02-15' }); +$patstodel = GetBorrowersToExpunge( { category_code => $new_category->categorycode, last_seen => '2016-02-15' }); is( scalar @$patstodel, 2, 'TrackLastPatronActivity - 2 patrons must be deleted' ); -$patstodel = GetBorrowersToExpunge( { last_seen => '2016-04-04' }); +$patstodel = GetBorrowersToExpunge( { category_code => $new_category->categorycode, last_seen => '2016-04-04' }); is( scalar @$patstodel, 3, 'TrackLastPatronActivity - 3 patrons must be deleted' ); my $patron2 = $builder->build({ source => 'Borrower', -- 2.30.2