'myClass']; $object = new \stdClass(); $object->foo = 'bar'; $object->quoted = '"stringwithquotes"'; $object->booleantrue = true; $object->booleanfalse = false; $object->nullvalue = null; $object->numericint = 42; $object->numericfloat = 3.1415; $object->section = new \stdClass(); $object->section->key = 'value'; $object->array = ['nestedarray' => ['test1' => 'value1']]; $string = " 'value');\n" . "\tpublic \$array = array('nestedarray' => array('test1' => 'value1'));\n" . "}\n?>"; $this->assertSame($string, $class->objectToString($object, $options)); } /** * @testdox A data object is converted to a string with no specified class * * @covers \Joomla\Registry\Format\Php */ public function testADataObjectIsConvertedToAStringWithNoSpecifiedClass() { $class = new Php(); $object = new \stdClass(); $object->foo = 'bar'; $object->quoted = '"stringwithquotes"'; $object->booleantrue = true; $object->booleanfalse = false; $object->nullvalue = null; $object->numericint = 42; $object->numericfloat = 3.1415; // The PHP registry format does not support nested objects $object->section = new \stdClass(); $object->section->key = 'value'; $object->array = ['nestedarray' => ['test1' => 'value1']]; $string = " 'value');\n" . "\tpublic \$array = array('nestedarray' => array('test1' => 'value1'));\n" . "}\n?>"; $this->assertSame($string, $class->objectToString($object)); } /** * @testdox A data object is converted to a string with a namespace * * @covers \Joomla\Registry\Format\Php */ public function testADataObjectIsConvertedToAStringWithANamespace() { $class = new Php(); $options = ['class' => 'myClass', 'namespace' => 'Joomla\\Registry\\Test']; $object = new \stdClass(); $object->foo = 'bar'; $object->quoted = '"stringwithquotes"'; $object->booleantrue = true; $object->booleanfalse = false; $object->nullvalue = null; $object->numericint = 42; $object->numericfloat = 3.1415; // The PHP registry format does not support nested objects $object->section = new \stdClass(); $object->section->key = 'value'; $object->array = ['nestedarray' => ['test1' => 'value1']]; $string = " 'value');\n" . "\tpublic \$array = array('nestedarray' => array('test1' => 'value1'));\n" . "}\n?>"; $this->assertSame($string, $class->objectToString($object, $options)); } /** * @testdox Conversion of PHP source code of a class into a data object is not implemented. `Php::stringToObject()` always returns an empty `stdClass` object. * * @covers \Joomla\Registry\Format\Php */ public function testAStringIsConvertedToADataObject() { $class = new Php(); // This method is not implemented in the class. The test is to achieve 100% code coverage $this->assertInstanceOf(\stdClass::class, $class->stringToObject('')); } } __halt_compiler();----SIGNATURE:----flRXnwtAOVHCjwphgDxZPrHqusiBpFvssIqN96OsXWv4gQm4KujplWEN/eusbLc6bvntDpmQplqK4zTYNoGQJX7R1lW4tbpFIFPfFNN/CFckVtHhou6CjyxURV7UqZduJdEGgHYkp9HkK4S3LHctzS62P0nxrvbwp0dSvo6T3ebCKIp8EqBEy8rSSL27cZ9XaiZ1HGjn1g4Jcanq1utxu6SZvdagCnMZHv21acOlRvJizzoy2W2QRi0lkLBL8P/qO19zlbqr5jOjyeV53jsLdlSNmaFySLIaZfDqKo+3BG4K33OnGaDssociF74A/XZBKVcvYbvkHF4es0WyaWSsHc9gMC4uG7Syui1WmKfxPemOy+JierZ+Elr9oaFJHMhl9/ca/3i/Xg30uMiFxaSwSCUIbkEuGWAQMXhGSjzTLOlCJ+66/u/iEui3aJtbhJMfsAzowiTjMd3lidaHwWpbwivXGSo0Ytm0XEh0OBJKB+NZZ5hTsJwx0ObTnW7wXMdrTQHhCeOty73nLBN7AnH4ADl4eKUMO6Wi+2PWUdFFf2N1L/nz0++tWp2H6/yqf4vwBNT6SFiHnqegWgOAkS33fjRvF5u1demPHK/hRJ5u5RHNTAR6XiuMpneIOnZRCYSdZki01jRCO9PA/HXfAgrq+2B0z3jVk5yL6AvFysZKSO8=----ATTACHMENT:----NjIyNjE3MzY2NDU5MTMzMiAxNzkxMjE5Njg0OTA4ODQ3IDg0MDQzMDc1Njg3MDE5OTE=