From a9d476f0123273b8ccd51ffb4669d6631a8b40d6 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli <thomas@roundcube.net> Date: Tue, 29 Oct 2013 04:12:44 -0400 Subject: [PATCH] Merge branch 'master' of github.com:roundcube/roundcubemail --- tests/Framework/Utils.php | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-) diff --git a/tests/Framework/Utils.php b/tests/Framework/Utils.php index 2f4aec3..1f1e57b 100644 --- a/tests/Framework/Utils.php +++ b/tests/Framework/Utils.php @@ -294,6 +294,32 @@ } /** + * rcube:utils::anytodatetime() + */ + function test_anytodatetime() + { + $test = array( + '2013-04-22' => '2013-04-22', + '2013/04/22' => '2013-04-22', + '2013.04.22' => '2013-04-22', + '22-04-2013' => '2013-04-22', + '22/04/2013' => '2013-04-22', + '22.04.2013' => '2013-04-22', + '04/22/2013' => '2013-04-22', + '22.4.2013' => '2013-04-22', + '20130422' => '2013-04-22', + '1900-10-10' => '1900-10-10', + '01-01-1900' => '1900-01-01', + '01/30/1960' => '1960-01-30' + ); + + foreach ($test as $datetime => $ts) { + $result = rcube_utils::anytodatetime($datetime); + $this->assertSame($ts, $result ? $result->format('Y-m-d') : '', "Error parsing date: $datetime"); + } + } + + /** * rcube:utils::normalize _string() */ function test_normalize_string() -- Gitblit v1.9.1