1<?php
2
3namespace Sabre\VObject;
4
5class ElementListTest extends \PHPUnit_Framework_TestCase {
6
7    function testIterate() {
8
9        $cal = new Component\VCalendar();
10        $sub = $cal->createComponent('VEVENT');
11
12        $elems = array(
13            $sub,
14            clone $sub,
15            clone $sub
16        );
17
18        $elemList = new ElementList($elems);
19
20        $count = 0;
21        foreach($elemList as $key=>$subcomponent) {
22
23           $count++;
24           $this->assertInstanceOf('Sabre\\VObject\\Component',$subcomponent);
25
26        }
27        $this->assertEquals(3,$count);
28        $this->assertEquals(2,$key);
29
30    }
31
32
33}
34