public function testValid() { $arr = array(); $element = new SimpleXMLElement("<string/>"); $arr[] = $element; try { $iterator = new Xinc_Config_Element_Iterator($arr); $hasNext = $iterator->hasNext(); $this->assertTrue($hasNext, 'Should be true'); $count = $iterator->count(); $this->assertEquals($count, 1, 'Should have 1 entry but has: ' . $count); $next = $iterator->next(); $this->assertEquals($element, $next, 'Elements should be equal'); $iterator->rewind(); $hasNext = $iterator->hasNext(); $this->assertTrue($hasNext, 'Should be true'); $count = $iterator->count(); $this->assertEquals($count, 1, 'Should have 1 entry but has: ' . $count); $next = $iterator->next(); } catch (Xinc_Config_Exception_InvalidElement $invalid) { $this->assertTrue(false, 'Expected result'); } catch (Exception $e) { $this->assertTrue(false, 'Not expected'); } }