[Koha-bugs] [Bug 19176] Dates comparison fails on slow server
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Mon Oct 16 15:24:31 CEST 2017
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19176
--- Comment #11 from M. Tompsett <mtompset at hotmail.com> ---
Comment on attachment 68082
--> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=68082
Bug 19176: Compare the number of seconds when comparing dates in tests
Review of attachment 68082:
--> (https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=19176&attachment=68082)
-----------------------------------------------------------------
::: t/Test/Dates.pm
@@ +10,5 @@
> +
> +is( t::lib::Dates::compare( $dt_1, $dt_2 ), -1, '2017 is before 2018' );
> +is( t::lib::Dates::compare( $dt_2, $dt_1 ), 1, '2018 is after 2017' );
> +
> +is( t::lib::Dates::compare( $date_1, $date_2 ), -1, '2017 is before 2018 (strings comparaison)' );
Typo: comparison.
::: t/lib/Dates.pm
@@ +19,5 @@
> + my $dt_expected = dt_from_string($expected);
> + $dt_got->set_time_zone('floating');
> + $dt_expected->set_time_zone('floating');
> + my $diff = $dt_got->epoch - $dt_expected->epoch;
> + if ( abs($diff) < 60 ) { return 0 }
A slow server isn't going to have a 15+ second gap, I believe this 60 could be
smaller.
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list