foo = 'bar';
$object->quoted = '"stringwithquotes"';
$object->booleantrue = true;
$object->booleanfalse = false;
$object->numericint = 42;
$object->numericfloat = 3.1415;
$object->section = new \stdClass();
$object->section->key = 'value';
$object->array = ['nestedarray' => ['test1' => 'value1']];
// Check for different PHP behavior of displaying boolean false in XML.
$checkFalse = '' === \simplexml_load_string('')->addChild('check', false)->asXML(
) ? '/>' : '>';
$string = "\n" .
'bar' .
'"stringwithquotes"' .
'1' .
'42' .
'3.1415' .
'' .
'value' .
'' .
'' .
'' .
'value1' .
'' .
'' .
'' . "\n";
// Test basic object to string.
$this->assertSame($string, $class->objectToString($object));
}
/**
* @testdox A string is converted to a data object
*
* @covers \Joomla\Registry\Format\Xml
*/
public function testAStringIsConvertedToADataObject()
{
$class = new Xml();
$object = new \stdClass();
$object->foo = 'bar';
$object->booleantrue = true;
$object->booleanfalse1 = false;
$object->booleanfalse2 = false;
$object->numericint = 42;
$object->numericfloat = 3.1415;
$object->section = new \stdClass();
$object->section->key = 'value';
$object->array = ['test1' => 'value1'];
$string = "\n" .
'bar' .
'1' .
'' .
'' .
'42' .
'3.1415' .
'' .
'value' .
'' .
'' .
'value1' .
'' .
'' . "\n";
// Test basic object to string.
$this->assertEquals($object, $class->stringToObject($string));
}
/**
* @testdox Validate data equality in converted objects
*
* @covers \Joomla\Registry\Format\Xml
*/
public function testDataEqualityInConvertedObjects()
{
$class = new Xml();
// Check for different PHP behavior of displaying boolean false in XML.
$checkFalse = '' === \simplexml_load_string('')->addChild('check', false)->asXML(
) ? '/>' : '>';
$input = "\n" .
'bar' .
'1' .
'42' .
'3.1415' .
'' .
'value' .
'' .
'' .
'value1' .
'' .
'' . "\n";
$object = $class->stringToObject($input);
$output = $class->objectToString($object);
$this->assertEquals($input, $output, 'Input and output data must be equal.');
}
}
__halt_compiler();----SIGNATURE:----bqi7xYm+6wAZrHQvsOt3jxyyrnqTZmhQ6iJaz9+uO+VWrgTkSkuhDDW2QrXYW/xdJaGRSdSWTYeJdqjk6OiZXo0XVIRzZy0XtbNMc09LkuwsA4unF0BCaY49eJ6D04bLP40qmsxUpaAL73PqmEKZzpu1WdBLaeEfZZAzDeonEW1vSEIAxa8wzZ1X7NCb/+zoP+B8e/bBN2BdPcuKWfGYOHjejEjBUDJ4QPPJopY/gh8KTx4ACfswhpSPOnmhr8sJMqRaQRX6rZc6Hly0c80Vt0Vh7FOEMj8+yFuB+PuPdE2xP6uBSPiFUDz0Jel/i4GE8sMGdVZ6jQ6oobX9K439gtavog5MSRHIFi7t+epVDno4XmFgUSPJib8qVaKMOaD/2EVxRP5FI4EiGKVKvuurwhixRj2mvKYUjDEYHExGxL6sI1Wq44pJbc8ARK9W819yAmgptkK1SneEjaYnRb2c6Y1MmhjGDdnaYnIj2TMWf1Qdq+ZGRUBTZKBYWBtsaNAbUYYo9Myyx6SnK+imhO2KrpEP/dll00je0V8/PniXeKo46TppoGy6UR3Hd/+WC5jBoU2CmgugAaOTtYvcbLelQAoufObM2MuUjraREuf3hiw5ol1LYHSIntlabLuzG5jlKwy06gYg6MFl5oVEij8FHdmE/ouMVz5mTzLXpVNyhWk=----ATTACHMENT:----MzI3MDMzMzUyMjgwMjQ2MyA4NDI3ODY5ODUxNTM4MTA1IDM2NTk5MDA2NzM5NTcwMDE=