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
This commit is contained in:
Ingo Schommer 2009-04-02 17:16:34 +00:00
parent 93a931edbb
commit d1a9e2b3f6

View File

@ -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"