示例#1
0
 public static function load($xml, $test_id)
 {
     if ($xml instanceof DOMElement) {
         $dom = $xml;
     } else {
         $dom = new DOMDocument();
         $dom->loadXML($xml);
     }
     $lst = $dom->getElementsByTagName('test_set_version');
     $col = array();
     foreach ($lst as $item) {
         $obj = new Litmus_Version();
         $obj->setTestId($test_id);
         foreach ($item->childNodes as $child) {
             $property = $child->nodeName;
             $obj->{$property} = $child;
         }
         array_push($col, $obj);
     }
     return $col;
 }
示例#2
0
文件: Test.php 项目: Natronick/Litmus
 /**
  * Set the Litmus_Test property from XML DOMElement
  *
  * @param string $property the property to set
  * @param mixed $value the Value or DOMElement
  * @return void
  */
 public function __set($property, $value)
 {
     switch ($property) {
         case 'created_at':
         case 'id':
         case 'updated_at':
         case 'name':
         case 'service':
         case 'state':
         case 'public_sharing':
         case 'url_or_guid':
             $this->{$property} = $value->nodeValue;
             break;
         case 'test_set_versions':
             $this->{$property} = Litmus_Version::load($value, $this->id);
             break;
     }
 }