From 76a135f2560e0aded3b4cfbf9dbfa7e11ccd70eb Mon Sep 17 00:00:00 2001 From: Michael J Rubinsky Date: Tue, 11 Feb 2014 11:13:55 -0500 Subject: [PATCH] Move tests to timezonesTest. --- framework/Icalendar/package.xml | 2 - .../test/Horde/Icalendar/DateTest.php | 50 ------------------- .../test/Horde/Icalendar/TimezonesTest.php | 37 ++++++++++++++ 3 files changed, 37 insertions(+), 52 deletions(-) delete mode 100644 framework/Icalendar/test/Horde/Icalendar/DateTest.php diff --git a/framework/Icalendar/package.xml b/framework/Icalendar/package.xml index 24f5e3dac1b..12f1124a9f6 100644 --- a/framework/Icalendar/package.xml +++ b/framework/Icalendar/package.xml @@ -406,7 +406,6 @@ - @@ -598,7 +597,6 @@ - diff --git a/framework/Icalendar/test/Horde/Icalendar/DateTest.php b/framework/Icalendar/test/Horde/Icalendar/DateTest.php deleted file mode 100644 index bef1cacaa36..00000000000 --- a/framework/Icalendar/test/Horde/Icalendar/DateTest.php +++ /dev/null @@ -1,50 +0,0 @@ -parsevCalendar(file_get_contents(__DIR__ . '/fixtures/bug12843.ics')); - foreach ($ical->getComponents() as $component) { - if ($component->getType() != 'vEvent') { - continue; - } - $date_params = $component->getAttribute('DTSTART', true); - $date = $component->getAttribute('DTSTART'); - $start = new Horde_Date($date, $date_params[0]['TZID']); - $this->assertEquals(18, $start->hour); - } - date_default_timezone_set($tz); - } - - public function testDatesLocalTimezoneTheSame() - { - $tz = date_default_timezone_get(); - date_default_timezone_set('Europe/Berlin'); - $ical = new Horde_Icalendar(); - $ical->parsevCalendar(file_get_contents(__DIR__ . '/fixtures/bug12843.ics')); - foreach ($ical->getComponents() as $component) { - if ($component->getType() != 'vEvent') { - continue; - } - $date_params = $component->getAttribute('DTSTART', true); - $date = $component->getAttribute('DTSTART'); - $start = new Horde_Date($date, $date_params[0]['TZID']); - $this->assertEquals(18, $start->hour); - } - date_default_timezone_set($tz); - } -} diff --git a/framework/Icalendar/test/Horde/Icalendar/TimezonesTest.php b/framework/Icalendar/test/Horde/Icalendar/TimezonesTest.php index 72a2ce3ea3c..b1951a5a82d 100644 --- a/framework/Icalendar/test/Horde/Icalendar/TimezonesTest.php +++ b/framework/Icalendar/test/Horde/Icalendar/TimezonesTest.php @@ -42,4 +42,41 @@ public function testFiles() 'Failed parsing file ' . basename($file)); } } + + public function testBug12843LocalTimezoneNotTheSame() + { + $tz = date_default_timezone_get(); + date_default_timezone_set('America/New_York'); + $ical = new Horde_Icalendar(); + $ical->parsevCalendar(file_get_contents(__DIR__ . '/fixtures/bug12843.ics')); + foreach ($ical->getComponents() as $component) { + if ($component->getType() != 'vEvent') { + continue; + } + $date_params = $component->getAttribute('DTSTART', true); + $date = $component->getAttribute('DTSTART'); + $start = new Horde_Date($date, $date_params[0]['TZID']); + $this->assertEquals(18, $start->hour); + } + date_default_timezone_set($tz); + } + + public function testBug12843LocalTimezoneTheSame() + { + $tz = date_default_timezone_get(); + date_default_timezone_set('Europe/Berlin'); + $ical = new Horde_Icalendar(); + $ical->parsevCalendar(file_get_contents(__DIR__ . '/fixtures/bug12843.ics')); + foreach ($ical->getComponents() as $component) { + if ($component->getType() != 'vEvent') { + continue; + } + $date_params = $component->getAttribute('DTSTART', true); + $date = $component->getAttribute('DTSTART'); + $start = new Horde_Date($date, $date_params[0]['TZID']); + $this->assertEquals(18, $start->hour); + } + date_default_timezone_set($tz); + } + }