Bug 30129: Add test

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Jonathan Druart 2022-02-21 12:59:40 +01:00 committed by Fridolin Somers
parent e30efbd0bd
commit f8ca2d733c

View file

@ -24,6 +24,7 @@ use Test::Warn;
use t::lib::TestBuilder;
use C4::Context;
use Koha::Database;
use Koha::DateUtils qw( dt_from_string );
use Koha::Items;
use Koha::Reports;
use Koha::Notice::Messages;
@ -185,7 +186,7 @@ subtest 'GetParametersFromSQL+ValidateSQLParameters' => sub {
};
subtest 'get_saved_reports' => sub {
plan tests => 17;
plan tests => 18;
my $dbh = C4::Context->dbh;
$dbh->do(q|DELETE FROM saved_sql|);
$dbh->do(q|DELETE FROM saved_reports|);
@ -220,6 +221,8 @@ subtest 'get_saved_reports' => sub {
ok( 0 < scalar @{ get_saved_reports( $report_ids[0] ) }, "filter takes report id" );
ok( 0 < scalar @{ get_saved_reports({date => dt_from_string->ymd }) }, "filter takes date" );
my $r1 = Koha::Reports->find($report_ids[0]);
$r1 = update_sql($r1->id, { %{$r1->unblessed}, borrowernumber => $r1->borrowernumber, name => 'Just another report' });
is( $r1->cache_expiry, 300, 'cache_expiry has the correct default value, from DBMS' );