Bugzilla – Attachment 153948 Details for
Bug 33837
Objects->filter_by_last_update: Does not allow time comparison
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33837: Add unit test
Bug-33837-Add-unit-test.patch (text/plain), 1.78 KB, created by
Jonathan Druart
on 2023-07-27 09:10:42 UTC
(
hide
)
Description:
Bug 33837: Add unit test
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-07-27 09:10:42 UTC
Size:
1.78 KB
patch
obsolete
>From eae067351e5e1e994bd9816e3849bd3e86bbc6eb Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 25 May 2023 14:25:32 +0000 >Subject: [PATCH] Bug 33837: Add unit test > >Test plan: >Run t/db_dependent/Koha/Objects.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > t/db_dependent/Koha/Objects.t | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > >diff --git a/t/db_dependent/Koha/Objects.t b/t/db_dependent/Koha/Objects.t >index a64f9007eb9..c8b70efb4f3 100755 >--- a/t/db_dependent/Koha/Objects.t >+++ b/t/db_dependent/Koha/Objects.t >@@ -1188,6 +1188,19 @@ subtest "filter_by_last_update" => sub { > ); > }; > >+ subtest 'Parameter datetime' => sub { >+ my $now = dt_from_string(); >+ my $rs = Koha::Patrons->search({ borrowernumber => { -in => \@borrowernumbers } } ); >+ $rs->update({ updated_on => $now->clone->subtract( hours => 25 ) }); >+ is( $rs->filter_by_last_update({ timestamp_column_name => 'updated_on', from => $now })->count, 0, 'All updated yesterday' ); >+ is( $rs->filter_by_last_update({ timestamp_column_name => 'updated_on', from => $now->clone->subtract( days => 1 ) })->count, >+ 6, 'Yesterday, truncated from is inclusive' ); >+ is( $rs->filter_by_last_update({ timestamp_column_name => 'updated_on', from => $now->clone->subtract( days => 1 ), >+ datetime => 1 })->count, 0, 'Yesterday, not truncated, one hour too late' ); >+ is( $rs->filter_by_last_update({ timestamp_column_name => 'updated_on', from => $now->clone->subtract( hours => 25 ), >+ datetime => 1 })->count, 6, 'Yesterday - 1h, not truncated, within time frame' ); >+ }; >+ > $schema->storage->txn_rollback; > }; > >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33837
:
151720
|
151721
|
151722
|
151723
|
153778
|
153898
|
153900
|
153915
|
153916
|
153917
|
153918
|
153919
|
153920
|
153947
| 153948 |
153949
|
153950
|
153951