/**
* Currently only works with timezoned localized values, not with UTC!!!
*
* @return void
*/
public function testIncrementDate()
{
$timezone = Configure::read('Config.timezone');
//$timezone = Date$this->Time->timezone();
Configure::write('Config.timezone', 'Europe/Berlin');
$phpTimezone = date_default_timezone_get();
date_default_timezone_set('Europe/Berlin');
$from = '2012-12-31';
$Date = $this->Time->incrementDate($from, 0, 0);
$this->assertSame($from, $Date->format(FORMAT_DB_DATE));
$from = '2012-12-31';
$Date = $this->Time->incrementDate($from, 0, 1);
$this->assertSame('2013-01-31', $Date->format(FORMAT_DB_DATE));
$from = '2012-12-31';
$Date = $this->Time->incrementDate($from, 0, 2);
$this->assertSame('2013-02-28', $Date->format(FORMAT_DB_DATE));
$from = '2012-12-31';
$Date = $this->Time->incrementDate($from, 0, 4);
$this->assertSame('2013-04-30', $Date->format(FORMAT_DB_DATE));
$from = '2012-12-31';
$Date = $this->Time->incrementDate($from, 1, 0);
$this->assertSame('2013-12-31', $Date->format(FORMAT_DB_DATE));
// from leap year
$from = '2008-02-29';
$Date = $this->Time->incrementDate($from, 1, 0);
$this->assertSame('2009-02-28', $Date->format(FORMAT_DB_DATE));
// into leap year
$from = '2007-02-28';
$Date = $this->Time->incrementDate($from, 1, 0);
$this->assertSame('2008-02-29', $Date->format(FORMAT_DB_DATE));
// other direction
$from = '2012-12-31';
$Date = $this->Time->incrementDate($from, 0, -1);
$this->assertSame('2012-11-30', $Date->format(FORMAT_DB_DATE));
$from = '2012-12-31';
$Date = $this->Time->incrementDate($from, -1, -1);
$this->assertSame('2011-11-30', $Date->format(FORMAT_DB_DATE));
// including days
$from = '2012-12-31';
$Date = $this->Time->incrementDate($from, 0, 1, 1);
$this->assertSame('2013-02-01', $Date->format(FORMAT_DB_DATE));
// including days
$from = '2012-12-31';
$Date = $this->Time->incrementDate($from, 0, 1, 5);
$this->assertSame('2013-02-05', $Date->format(FORMAT_DB_DATE));
Configure::write('Config.timezone', $timezone);
date_default_timezone_set($phpTimezone);
}