public function showXMLAction() { $persona = Persona::get($this->params['id']); YuppLoader::load('core.persistent.serialize', 'XMLPO'); return $this->renderString(XMLPO::toXML($persona, true)); //return $this->renderString( $persona->toXML(true) ); }
public function test1() { $mano = new Mano(array("tamanio" => "grande", "dedos" => array(new Dedo(array("uniaLarga" => true)), new Dedo(array("uniaLarga" => true)), new Dedo(array("uniaLarga" => false))))); $dedos = $mano->getDedos(); foreach ($dedos as $dedo) { $dedo->setMano($mano); } //Logger::getInstance()->on(); $this->assert($mano->save(), 'TestCaseM003: Test salvar mano y dedos ' . print_r($mano->getErrors(), true), array('mano' => print_r($mano, true))); //Logger::getInstance()->off(); // Debe fallar el save porque hay datos erroneos $this->assert(true, 'TestCaseM003: Test generar XML ' . print_r(XMLPO::toXML($mano, true, true), true)); $this->assert(true, 'TestCaseM003: Test generar JSON ' . print_r(JSONPO::toJSON($mano, true), true)); }
public function testXML() { $cara = new Cara(array("color" => "blanco", "nariz" => new Nariz(array("tamanio" => "mediana")))); YuppLoader::load('core.persistent.serialize', 'XMLPO'); echo XMLPO::toXML($cara, true, true); }