/** * Convert the raw XML into an object * * @param \SimpleXMLElement $xml * @return Phone */ public static function createFromXML(\SimpleXMLElement $xml) { $phone = new Phone(); $attributes = $xml->attributes(); if (isset($attributes['type'])) { $phone->setType((string) $attributes['type']); } $phone->setValue((string) $xml); return $phone; }
/** * Tests Phone->setNumber() */ public function testSetNumber() { $this->Phone->setValue('NUMBER'); $this->assertEquals('NUMBER', $this->Phone->getValue()); }