From b432375bb024e9245581e9775032f4d2b48e9966 Mon Sep 17 00:00:00 2001 From: Titouan BENOIT Date: Thu, 24 Nov 2016 17:44:13 +0100 Subject: [PATCH] fixes timezone + tests --- README.md | 4 ++-- src/Factory/Factory.php | 2 +- src/Tests/Factory/FactoryTest.php | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e0b6aee..1b73e0d 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ In your `config.yml`: ```yaml welp_ical: - default_timezone: "Europe\\Paris" + default_timezone: "Europe/Paris" default_prodid: "-//WelpIcalBundle//Calendar App//FR" ``` @@ -61,7 +61,7 @@ welp_ical: ->setUid('event-uid'); //add an Attendee - $attendee = $icalFactory->createAttendee(new Formatter()); + $attendee = $icalFactory->createAttendee(); $attendee->setValue('moe@example.com') ->setName('Moe Smith'); $eventOne->addAttendee($attendee); diff --git a/src/Factory/Factory.php b/src/Factory/Factory.php index f79f497..8e89dcf 100644 --- a/src/Factory/Factory.php +++ b/src/Factory/Factory.php @@ -173,7 +173,7 @@ public function createRecurrenceRule() */ public function setTimezone($timezone) { - $this->timezone = \DateTimeZone($timezone); + $this->timezone = new \DateTimeZone($timezone); } /** diff --git a/src/Tests/Factory/FactoryTest.php b/src/Tests/Factory/FactoryTest.php index 0049d2a..ecc3d04 100644 --- a/src/Tests/Factory/FactoryTest.php +++ b/src/Tests/Factory/FactoryTest.php @@ -139,4 +139,18 @@ public function testCreateRecurrenceRule() $this->assertInstanceOf('Jsvrcek\ICS\Model\Recurrence\RecurrenceRule', $recurrenceRule); } + /** + * Test timezone + * + */ + public function testTimezone() + { + $this->factory->setTimezone('Europe/Paris'); + $calendar = $this->factory->createCalendar(); + $this->assertCalendar($calendar); + $this->assertInstanceOf('\DateTimeZone', $calendar->getTimezone()); + $this->assertEquals('Europe/Paris', $calendar->getTimezone()->getName()); + + } + }