Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Introducing failing test case to prove issue in CakeTime

  • Loading branch information...
commit b0822d2246b6bad7dfb0c52b996dd8d5ea3ee036 1 parent fe5b49e
@lorenzo lorenzo authored
Showing with 15 additions and 0 deletions.
  1. +15 −0 lib/Cake/Test/Case/Utility/CakeTimeTest.php
View
15 lib/Cake/Test/Case/Utility/CakeTimeTest.php
@@ -1049,4 +1049,19 @@ public function testListTimezones() {
}
}
+/**
+ * Tests that using CakeTime::format() with the correct sytax actually converts
+ * from one timezone to the other correctly
+ *
+ * @return void
+ **/
+ public function testCorrectTimezoneConversion() {
+ date_default_timezone_set('UTC');
+ $date = '2012-01-01 10:00:00';
+ $converted = CakeTime::format($date, '%Y-%m-%d %H:%M:%S', '', 'Europe/Copenhagen');
+ $expected = new DateTime($date);
+ $expected->setTimezone(new DateTimeZone('Europe/Copenhagen'));
+ $this->assertEquals($expected->format('Y-m-d H:i:s'), $converted);
+ }
+
}
Please sign in to comment.
Something went wrong with that request. Please try again.