ElementListTest.php 633 B

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