Beispiel #1
0
 /**
  * Public parse function
  * 
  * @param  Xinc_Config_Element_Iterator $iterator
  *
  * @throws Xinc_Plugin_Task_Exception
  * @throws Xinc_Plugin_Exception_FileNotFound
  * @throws Xinc_Plugin_Exception_Invalid
  * @throws Xinc_Plugin_Exception_ClassNotFound
  */
 public static function parse(Xinc_Config_Element_Iterator $iterator)
 {
     while ($iterator->hasNext()) {
         try {
             self::loadPlugin($iterator->next());
         } catch (Exception $e) {
             Xinc_Logger::getInstance()->error('Plugins: ' . $e->getMessage());
         }
     }
 }
 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');
     }
 }