mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
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:
parent
93a931edbb
commit
d1a9e2b3f6
@ -5,6 +5,23 @@
|
|||||||
*/
|
*/
|
||||||
class DateTest extends SapphireTest {
|
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() {
|
function testNiceDate() {
|
||||||
$this->assertEquals('01/04/2008', DBField::create('Date', 1206968400)->Nice(),
|
$this->assertEquals('01/04/2008', DBField::create('Date', 1206968400)->Nice(),
|
||||||
"Date->Nice() works with timestamp integers"
|
"Date->Nice() works with timestamp integers"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user