From 8ebd4449669b0a039977e5e0a6df12f9208ee631 Mon Sep 17 00:00:00 2001 From: beberlei Date: Wed, 13 Jan 2010 18:17:36 +0000 Subject: [PATCH] DDC-179 - One more test for possible summer-time crazyness --- tests/Doctrine/Tests/DBAL/Types/DateTest.php | 22 +++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/tests/Doctrine/Tests/DBAL/Types/DateTest.php b/tests/Doctrine/Tests/DBAL/Types/DateTest.php index 9f9903a0f..3368a6c93 100644 --- a/tests/Doctrine/Tests/DBAL/Types/DateTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/DateTest.php @@ -11,12 +11,19 @@ class DateTest extends \Doctrine\Tests\DbalTestCase { protected $_platform, - $_type; + $_type, + $_tz; protected function setUp() { $this->_platform = new \Doctrine\Tests\DBAL\Mocks\MockPlatform(); $this->_type = Type::getType('date'); + $this->_tz = date_default_timezone_get(); + } + + public function tearDown() + { + date_default_timezone_set($this->_tz); } public function testDateConvertsToDatabaseValue() @@ -41,4 +48,17 @@ class DateTest extends \Doctrine\Tests\DbalTestCase $this->assertEquals('00:00:00', $date->format('H:i:s')); } + + public function testDateRests_SummerTimeAffection() + { + date_default_timezone_set('Europe/Berlin'); + + $date = $this->_type->convertToPHPValue('2009-08-01', $this->_platform); + $this->assertEquals('00:00:00', $date->format('H:i:s')); + $this->assertEquals('2009-08-01', $date->format('Y-m-d')); + + $date = $this->_type->convertToPHPValue('2009-11-01', $this->_platform); + $this->assertEquals('00:00:00', $date->format('H:i:s')); + $this->assertEquals('2009-11-01', $date->format('Y-m-d')); + } } \ No newline at end of file