Skip to content

Commit

Permalink
Removing tests that were using the old Time::format() method
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Apr 21, 2014
1 parent 0ced653 commit e6abaeb
Showing 1 changed file with 0 additions and 42 deletions.
42 changes: 0 additions & 42 deletions tests/TestCase/Utility/TimeTest.php
Expand Up @@ -378,33 +378,6 @@ public function testToUnix() {
$this->assertEquals('1639206001', $time->toUnixString());
}

/**
* testFormat method
*
* @return void
*/
public function testFormat() {
$format = 'D-M-Y';
$tz = date_default_timezone_get();
$arr = array(time(), strtotime('+1 days'), strtotime('+1 days'), strtotime('+0 days'));
foreach ($arr as $val) {
$this->assertEquals(date($format, $val), $this->Time->format($format, $val));
$this->assertEquals(date($format, $val), $this->Time->format($format, $val, false, $tz));
}

$result = $this->Time->format('Y-m-d', null, 'never');
$this->assertEquals('never', $result);

$result = $this->Time->format('2012-01-13', '%d-%m-%Y', 'invalid');
$this->assertEquals('13-01-2012', $result);

$result = $this->Time->format('nonsense', '%d-%m-%Y', 'invalid', 'UTC');
$this->assertEquals('invalid', $result);

$result = $this->Time->format('0000-00-00', '%d-%m-%Y', 'invalid');
$this->assertEquals('invalid', $result);
}

/**
* testIsThisWeek method
*
Expand Down Expand Up @@ -588,19 +561,4 @@ public function testListTimezones() {
$this->assertFalse(isset($return['Asia/Bangkok']));
}

/**
* Tests that using Cake\Utility\Time::format() with the correct sytax actually converts
* from one timezone to the other correctly
*
* @return void
*/
public function testCorrectTimezoneConversion() {
date_default_timezone_set('UTC');
$date = '2012-01-01 10:00:00';
$converted = Time::format($date, '%Y-%m-%d %H:%M', '', 'Europe/Copenhagen');
$expected = new \DateTime($date);
$expected->setTimezone(new \DateTimeZone('Europe/Copenhagen'));
$this->assertEquals($expected->format('Y-m-d H:i'), $converted);
}

}

0 comments on commit e6abaeb

Please sign in to comment.