diff options
author | Aleksander Machniak <alec@alec.pl> | 2013-10-28 15:28:58 +0100 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2013-10-28 15:28:58 +0100 |
commit | b1f3c3bee814ee9fadd4145ade9d9542211d2ee4 (patch) | |
tree | 3f0f859d2c31d9c825a7cacdf41992de0564244b /tests/Framework/Utils.php | |
parent | a23d446996909cf790f771c3702355591dd7664b (diff) |
Fixed saving contact birthday/anniversary dates before 01-01-1970
Diffstat (limited to 'tests/Framework/Utils.php')
-rw-r--r-- | 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 2f4aec32e..1f1e57b0e 100644 --- a/tests/Framework/Utils.php +++ b/tests/Framework/Utils.php @@ -294,6 +294,32 @@ class Framework_Utils extends PHPUnit_Framework_TestCase } /** + * 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() |