/**
  * @covers POI::createFromXML
  */
 function test_createFromXML()
 {
     $xml_source = '
         <poi id="1220108" gps="50.132656,14.451263" resource="acd546f0-83a1-42ed-9e15-c294e3b72fdd">
             <name locale="cs_CZ" text="Penny market"/>
             <name locale="en_US" text="Supermarket Penny"/>
             <name locale="ru_RU" text="супермаркет"/>
         </poi>
         ';
     $element = new \SimpleXMLElement($xml_source);
     $poi = POI::createFromXML($element);
     $this->assertInstanceOf('RealPadConnector\\CMS\\Project\\POI', $poi);
     $this->assertEquals(1220108, $poi->getID());
     $this->assertEquals(array(50.132656, 14.451263), $poi->getGPS());
     $this->assertEquals('acd546f0-83a1-42ed-9e15-c294e3b72fdd', $poi->getResourceID());
     $this->assertEquals(array('cs_CZ' => 'Penny market', 'en_US' => 'Supermarket Penny', 'ru_RU' => 'супермаркет'), $poi->getNames());
 }
 /**
  * @param \SimpleXMLElement $element
  * @return Project
  */
 public static function createFromXML(\SimpleXMLElement $element)
 {
     /** @var Project $project */
     $project = parent::createFromXML($element);
     if (isset($element->building)) {
         foreach ($element->building as $building_element) {
             $building = Building::createFromXML($building_element);
             $project->addBuilding($building);
         }
     }
     $project->email_headers = Utils::fetchChildAttributePairs($element, 'email-header', 'locale', 'text');
     $project->emails = Utils::fetchChildAttributePairs($element, 'email', 'locale', 'text');
     $project->email_footers = Utils::fetchChildAttributePairs($element, 'email-footer', 'locale', 'text');
     if (isset($element->gallery)) {
         foreach ($element->gallery as $gallery_element) {
             $gallery = Gallery::createFromXML($gallery_element);
             $project->addGallery($gallery);
         }
     }
     if (isset($element->poi)) {
         foreach ($element->poi as $poi_element) {
             $poi = POI::createFromXML($poi_element);
             $project->addPOI($poi);
         }
     }
     if (isset($element->{"flat-attribute-type"})) {
         foreach ($element->{"flat-attribute-type"} as $flat_attribute_element) {
             $flat_attribute = FlatAttribute::createFromXML($flat_attribute_element);
             $project->addFlatAttribute($flat_attribute);
         }
     }
     $attributes = Utils::fetchChildAttributePairs($element, 'project-attribute', 'key', 'value');
     foreach ($attributes as $attribute => $value) {
         $project->setParameter($attribute, $value);
     }
     return $project;
 }