assertInstanceOf('Sabre\\VObject\\Component\\VCalendar', $vcal); $vcal = $vcal->expand(new DateTime('2015-01-01'), new DateTime('2015-12-01')); $result = iterator_to_array($vcal->VEVENT); $this->assertEquals(5, count($result)); $utc = new DateTimeZone('UTC'); $expected = [ new DateTimeImmutable("2015-10-12", $utc), new DateTimeImmutable("2015-10-15", $utc), new DateTimeImmutable("2015-10-17", $utc), new DateTimeImmutable("2015-10-18", $utc), new DateTimeImmutable("2015-10-20", $utc), ]; $result = array_map(function($ev) {return $ev->DTSTART->getDateTime();}, $result); $this->assertEquals($expected, $result); } }