summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-08-24 18:08:54 +0200
committerAleksander Machniak <alec@alec.pl>2013-08-24 18:20:03 +0200
commit4db26a430b0a2fb9b5c725aef373c6b79e27f100 (patch)
treed8113c0b2bddc53cb5393840da2f49368d5bc850 /tests
parent6e14fcf9bfb0bf3ee237dc7516655f55c8436a3a (diff)
Fix handling of non-default date formats (#1489294)
- remove ambiguous m/d/Y format from default config Conflicts: CHANGELOG config/main.inc.php.dist program/lib/Roundcube/rcube_utils.php tests/Framework/Utils.php
Diffstat (limited to 'tests')
-rw-r--r--tests/Framework/Utils.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/Framework/Utils.php b/tests/Framework/Utils.php
index 7c1e92ac8..2e0d3cf4d 100644
--- a/tests/Framework/Utils.php
+++ b/tests/Framework/Utils.php
@@ -229,4 +229,43 @@ class Framework_Utils extends PHPUnit_Framework_TestCase
}
}
+ /**
+ * rcube:utils::strtotime()
+ */
+ function test_strtotime()
+ {
+ $test = array(
+ '1' => 1,
+ '' => 0,
+ '2013-04-22' => 1366581600,
+ '2013/04/22' => 1366581600,
+ '2013.04.22' => 1366581600,
+ '22-04-2013' => 1366581600,
+ '22/04/2013' => 1366581600,
+ '22.04.2013' => 1366581600,
+ '22.4.2013' => 1366581600,
+ '20130422' => 1366581600,
+ );
+
+ foreach ($test as $datetime => $ts) {
+ $result = rcube_utils::strtotime($datetime);
+ $this->assertSame($ts, $result, "Error parsing date: $datetime");
+ }
+ }
+
+ /**
+ * rcube:utils::normalize _string()
+ */
+ function test_normalize_string()
+ {
+ $test = array(
+ '' => '',
+ 'abc def' => 'abc def',
+ );
+
+ foreach ($test as $input => $output) {
+ $result = rcube_utils::normalize_string($input);
+ $this->assertSame($output, $result);
+ }
+ }
}