From d1a9e2b3f604e2d95ccf7f366676ce051706118a Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 2 Apr 2009 17:16:34 +0000 Subject: [PATCH] BUGFIX Fixed DateTest timestamp->date testing - was assuming a NZ timezone environment setting, hence failing in other timezones git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@74011 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- tests/fieldtypes/DateTest.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/fieldtypes/DateTest.php b/tests/fieldtypes/DateTest.php index 6d7c2a820..989eb623d 100644 --- a/tests/fieldtypes/DateTest.php +++ b/tests/fieldtypes/DateTest.php @@ -5,6 +5,23 @@ */ class DateTest extends SapphireTest { + protected $originalTZ; + + function setUp() { + // Set timezone to support timestamp->date conversion. + // We can't use date_default_timezone_set() as its not supported prior to PHP 5.2 + $this->originalTZ = ini_get('date.timezone'); + ini_set('date.timezone','Pacific/Auckland'); + + parent::setUp(); + } + + function tearDown() { + ini_set('date.timezone',$this->originalTZ); + + parent::tearDown(); + } + function testNiceDate() { $this->assertEquals('01/04/2008', DBField::create('Date', 1206968400)->Nice(), "Date->Nice() works with timestamp integers"