Lines 18-24
Link Here
|
18 |
|
18 |
|
19 |
use Modern::Perl; |
19 |
use Modern::Perl; |
20 |
|
20 |
|
21 |
use Test::More tests => 7; |
21 |
use Test::More tests => 8; |
22 |
use Test::Warn; |
22 |
use Test::Warn; |
23 |
|
23 |
|
24 |
use t::lib::TestBuilder; |
24 |
use t::lib::TestBuilder; |
Lines 260-265
subtest 'get_saved_reports' => sub {
Link Here
|
260 |
"get_report_areas returns the correct array of report areas"); |
260 |
"get_report_areas returns the correct array of report areas"); |
261 |
}; |
261 |
}; |
262 |
|
262 |
|
|
|
263 |
subtest 'Ensure last_run is populated' => sub { |
264 |
plan tests => 3; |
265 |
|
266 |
my $rs = Koha::Database->new()->schema()->resultset('SavedSql'); |
267 |
|
268 |
my $report = $rs->new( |
269 |
{ |
270 |
report_name => 'Test Report', |
271 |
savedsql => 'SELECT * FROM branches', |
272 |
notes => undef, |
273 |
} |
274 |
)->insert(); |
275 |
|
276 |
is( $report->last_run, undef, 'Newly created report has null last_run ' ); |
277 |
|
278 |
execute_query( $report->savedsql, undef, undef, undef, $report->id ); |
279 |
$report->discard_changes(); |
280 |
|
281 |
isnt( $report->last_run, undef, 'First run of report populates last_run' ); |
282 |
|
283 |
my $previous_last_run = $report->last_run; |
284 |
sleep(1); # last_run is stored to the second, so we need to ensure at least one second has passed between runs |
285 |
execute_query( $report->savedsql, undef, undef, undef, $report->id ); |
286 |
$report->discard_changes(); |
287 |
|
288 |
isnt( $report->last_run, $previous_last_run, 'Second run of report updates last_run' ); |
289 |
}; |
290 |
|
263 |
$schema->storage->txn_rollback; |
291 |
$schema->storage->txn_rollback; |
264 |
|
292 |
|
265 |
sub trim { |
293 |
sub trim { |
266 |
- |
|
|