Bug 17502: Add type check to output_pref
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Thu, 27 Oct 2016 07:11:03 +0000 (09:11 +0200)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 21 Apr 2017 11:36:25 +0000 (07:36 -0400)
commitf14d03b5a3d1e953da700c9379c1bd5c9ab79334
tree5c2c24c210dc4b48fe4cb5f7ea84b7b3b8d4619b
parentd51538cb824387230b3e2cab955d3c16475bedde
Bug 17502: Add type check to output_pref

This patch makes the following changes:
[1] In Koha/DateUtils.pm, sub output_pref:
    Add a test if $dt is really a DateTime before calling method ymd.
    Preventing a crash like:
    Can't locate object method "ymd" via package "dateonly".
    See also BZ 17502/15822.
[2] Adds a few unit tests in t/DateUtils.t.

Test plan:
[1] Run the adjusted unit test t/DateUtils.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Koha/DateUtils.pm
t/DateUtils.t