Skip to content

Commit

Permalink
MINOR Removed PHP 5.2 check in DateTest
Browse files Browse the repository at this point in the history
  • Loading branch information
halkyon authored and Sean Harvey committed Apr 2, 2012
1 parent a2979f0 commit db65704
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions tests/model/DateTest.php
Expand Up @@ -6,31 +6,19 @@
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

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');
}
$this->originalTZ = date_default_timezone_get();
date_default_timezone_set('Pacific/Auckland');
parent::setUp();
}

function tearDown() {
if(version_compare(PHP_VERSION, '5.2.0', '<') ){
ini_set('date.timezone',$this->originalTZ);
} else {
date_default_timezone_set($this->originalTZ);
}

date_default_timezone_set($this->originalTZ);
parent::tearDown();
}

function testNiceDate() {
$this->assertEquals('31/03/2008', DBField::create('Date', 1206968400)->Nice(),
"Date->Nice() works with timestamp integers"
Expand Down

0 comments on commit db65704

Please sign in to comment.