mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR Removed PHP 5.2 check in DateTest
This commit is contained in:
parent
a2979f0551
commit
db65704639
@ -6,31 +6,19 @@
|
|||||||
class DateTest extends SapphireTest {
|
class DateTest extends SapphireTest {
|
||||||
|
|
||||||
protected $originalTZ;
|
protected $originalTZ;
|
||||||
|
|
||||||
function setUp() {
|
function setUp() {
|
||||||
// Set timezone to support timestamp->date conversion.
|
// 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 = date_default_timezone_get();
|
||||||
|
date_default_timezone_set('Pacific/Auckland');
|
||||||
if (version_compare(PHP_VERSION, '5.2.0', '<')) {
|
|
||||||
$this->originalTZ = ini_get('date.timezone');
|
|
||||||
ini_set('date.timezone', 'Pacific/Auckland');
|
|
||||||
} else {
|
|
||||||
$this->originalTZ = date_default_timezone_get();
|
|
||||||
date_default_timezone_set('Pacific/Auckland');
|
|
||||||
}
|
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
function tearDown() {
|
function tearDown() {
|
||||||
if(version_compare(PHP_VERSION, '5.2.0', '<') ){
|
date_default_timezone_set($this->originalTZ);
|
||||||
ini_set('date.timezone',$this->originalTZ);
|
|
||||||
} else {
|
|
||||||
date_default_timezone_set($this->originalTZ);
|
|
||||||
}
|
|
||||||
|
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
function testNiceDate() {
|
function testNiceDate() {
|
||||||
$this->assertEquals('31/03/2008', DBField::create('Date', 1206968400)->Nice(),
|
$this->assertEquals('31/03/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