From 6dbbbef3e9481d611c616e3af12f16316ea608e6 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 Non-trivial was adding the category_type <> S. Test plan: Run t/db_dependent/Members.t Signed-off-by: Marcel de Rooy Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi (cherry picked from commit f08fc018670a356103a80a41ea83aa67e33476fa) Signed-off-by: Fridolin Somers --- 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 7d9852af57..12fb44180d 100755 --- a/t/db_dependent/Members.t +++ b/t/db_dependent/Members.t @@ -300,12 +300,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, } }); @@ -313,7 +318,7 @@ $builder->build({ source => 'Borrower', value => { lastseen => '2016-02-02 02:02:02', - categorycode => 'CIVILIAN', + categorycode => $new_category->categorycode, flags => undef, } }); @@ -321,15 +326,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.20.1