Skip to content

Commit

Permalink
fixes timezone + tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Nightbr committed Nov 24, 2016
1 parent f3905ac commit b432375
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
```
Expand Down Expand Up @@ -61,7 +61,7 @@ welp_ical:
->setUid('event-uid');

//add an Attendee
$attendee = $icalFactory->createAttendee(new Formatter());
$attendee = $icalFactory->createAttendee();
$attendee->setValue('[email protected]')
->setName('Moe Smith');
$eventOne->addAttendee($attendee);
Expand Down
2 changes: 1 addition & 1 deletion src/Factory/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public function createRecurrenceRule()
*/
public function setTimezone($timezone)
{
$this->timezone = \DateTimeZone($timezone);
$this->timezone = new \DateTimeZone($timezone);
}

/**
Expand Down
14 changes: 14 additions & 0 deletions src/Tests/Factory/FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());

}

}

0 comments on commit b432375

Please sign in to comment.