Example #1
0
    function testRFC6321Example2()
    {
        $xml = <<<XML
<?xml version="1.0" encoding="UTF-8" ?>
<icalendar xmlns="urn:ietf:params:xml:ns:icalendar-2.0">
  <vcalendar>
    <properties>
      <prodid>
        <text>-//Example Inc.//Example Client//EN</text>
      </prodid>
      <version>
        <text>2.0</text>
      </version>
    </properties>
    <components>
      <vtimezone>
        <properties>
          <last-modified>
            <date-time>2004-01-10T03:28:45Z</date-time>
          </last-modified>
          <tzid><text>US/Eastern</text></tzid>
        </properties>
        <components>
          <daylight>
            <properties>
              <dtstart>
                <date-time>2000-04-04T02:00:00</date-time>
              </dtstart>
              <rrule>
                <recur>
                  <freq>YEARLY</freq>
                  <byday>1SU</byday>
                  <bymonth>4</bymonth>
                </recur>
              </rrule>
              <tzname>
                <text>EDT</text>
              </tzname>
              <tzoffsetfrom>
                <utc-offset>-05:00</utc-offset>
              </tzoffsetfrom>
              <tzoffsetto>
                <utc-offset>-04:00</utc-offset>
              </tzoffsetto>
            </properties>
          </daylight>
          <standard>
            <properties>
              <dtstart>
                <date-time>2000-10-26T02:00:00</date-time>
              </dtstart>
              <rrule>
                <recur>
                  <freq>YEARLY</freq>
                  <byday>-1SU</byday>
                  <bymonth>10</bymonth>
                </recur>
              </rrule>
              <tzname>
                <text>EST</text>
              </tzname>
              <tzoffsetfrom>
                <utc-offset>-04:00</utc-offset>
              </tzoffsetfrom>
              <tzoffsetto>
                <utc-offset>-05:00</utc-offset>
              </tzoffsetto>
            </properties>
          </standard>
        </components>
      </vtimezone>
      <vevent>
        <properties>
          <dtstamp>
            <date-time>2006-02-06T00:11:21Z</date-time>
          </dtstamp>
          <dtstart>
            <parameters>
              <tzid><text>US/Eastern</text></tzid>
            </parameters>
            <date-time>2006-01-02T12:00:00</date-time>
          </dtstart>
          <duration>
            <duration>PT1H</duration>
          </duration>
          <rrule>
            <recur>
              <freq>DAILY</freq>
              <count>5</count>
            </recur>
          </rrule>
          <rdate>
            <parameters>
              <tzid><text>US/Eastern</text></tzid>
            </parameters>
            <period>
              <start>2006-01-02T15:00:00</start>
              <duration>PT2H</duration>
            </period>
          </rdate>
          <summary>
            <text>Event #2</text>
          </summary>
          <description>
            <text>We are having a meeting all this week at 12
pm for one hour, with an additional meeting on the first day
2 hours long.&#x0a;Please bring your own lunch for the 12 pm
meetings.</text>
          </description>
          <uid>
            <text>00959BC664CA650E933C892C@example.com</text>
          </uid>
        </properties>
      </vevent>
      <vevent>
        <properties>
          <dtstamp>
            <date-time>2006-02-06T00:11:21Z</date-time>
          </dtstamp>
          <dtstart>
            <parameters>
              <tzid><text>US/Eastern</text></tzid>
            </parameters>
            <date-time>2006-01-04T14:00:00</date-time>
          </dtstart>
          <duration>
            <duration>PT1H</duration>
          </duration>
          <recurrence-id>
            <parameters>
              <tzid><text>US/Eastern</text></tzid>
            </parameters>
            <date-time>2006-01-04T12:00:00</date-time>
          </recurrence-id>
          <summary>
            <text>Event #2 bis</text>
          </summary>
          <uid>
            <text>00959BC664CA650E933C892C@example.com</text>
          </uid>
        </properties>
      </vevent>
    </components>
  </vcalendar>
</icalendar>
XML;
        $component = VObject\Reader::readXML($xml);
        $this->assertVObjectEqualsVObject('BEGIN:VCALENDAR' . "\n" . 'VERSION:2.0' . "\n" . 'PRODID:-//Example Inc.//Example Client//EN' . "\n" . 'BEGIN:VTIMEZONE' . "\n" . 'LAST-MODIFIED:20040110T032845Z' . "\n" . 'TZID:US/Eastern' . "\n" . 'BEGIN:DAYLIGHT' . "\n" . 'DTSTART:20000404T020000' . "\n" . 'RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4' . "\n" . 'TZNAME:EDT' . "\n" . 'TZOFFSETFROM:-0500' . "\n" . 'TZOFFSETTO:-0400' . "\n" . 'END:DAYLIGHT' . "\n" . 'BEGIN:STANDARD' . "\n" . 'DTSTART:20001026T020000' . "\n" . 'RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10' . "\n" . 'TZNAME:EST' . "\n" . 'TZOFFSETFROM:-0400' . "\n" . 'TZOFFSETTO:-0500' . "\n" . 'END:STANDARD' . "\n" . 'END:VTIMEZONE' . "\n" . 'BEGIN:VEVENT' . "\n" . 'DTSTAMP:20060206T001121Z' . "\n" . 'DTSTART;TZID=US/Eastern:20060102T120000' . "\n" . 'DURATION:PT1H' . "\n" . 'RRULE:FREQ=DAILY;COUNT=5' . "\n" . 'RDATE;TZID=US/Eastern;VALUE=PERIOD:20060102T150000/PT2H' . "\n" . 'SUMMARY:Event #2' . "\n" . 'DESCRIPTION:We are having a meeting all this week at 12\\npm for one hour\\, ' . "\n" . ' with an additional meeting on the first day\\n2 hours long.\\nPlease bring y' . "\n" . ' our own lunch for the 12 pm\\nmeetings.' . "\n" . 'UID:00959BC664CA650E933C892C@example.com' . "\n" . 'END:VEVENT' . "\n" . 'BEGIN:VEVENT' . "\n" . 'DTSTAMP:20060206T001121Z' . "\n" . 'DTSTART;TZID=US/Eastern:20060104T140000' . "\n" . 'DURATION:PT1H' . "\n" . 'RECURRENCE-ID;TZID=US/Eastern:20060104T120000' . "\n" . 'SUMMARY:Event #2 bis' . "\n" . 'UID:00959BC664CA650E933C892C@example.com' . "\n" . 'END:VEVENT' . "\n" . 'END:VCALENDAR' . "\n", VObject\Writer::write($component));
    }
Example #2
0
 /**
  * Check this equality:
  *     XML -> object model -> MIME Dir.
  */
 protected function assertXMLEqualsToMimeDir($xml, $mimedir)
 {
     $component = VObject\Reader::readXML($xml);
     $this->assertEquals($mimedir, VObject\Writer::write($component));
 }