annotate vendor/sabre/vobject/tests/VObject/ElementListTest.php @ 7:430dbd5346f7

vendor sabre as distributed
author Charlie Root
date Sat, 13 Jan 2018 09:06:10 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
1 <?php
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
2
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
3 namespace Sabre\VObject;
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
4
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
5 class ElementListTest extends \PHPUnit_Framework_TestCase {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
6
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
7 function testIterate() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
8
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
9 $cal = new Component\VCalendar();
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
10 $sub = $cal->createComponent('VEVENT');
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
11
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
12 $elems = array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
13 $sub,
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
14 clone $sub,
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
15 clone $sub
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
16 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
17
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
18 $elemList = new ElementList($elems);
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
19
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
20 $count = 0;
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
21 foreach($elemList as $key=>$subcomponent) {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
22
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
23 $count++;
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
24 $this->assertInstanceOf('Sabre\\VObject\\Component',$subcomponent);
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
25
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
26 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
27 $this->assertEquals(3,$count);
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
28 $this->assertEquals(2,$key);
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
29
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
30 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
31
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
32
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
33 }