You are here

public function XmlEncoderTest::testEncodeXmlAttributes in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/serializer/Tests/Encoder/XmlEncoderTest.php \Symfony\Component\Serializer\Tests\Encoder\XmlEncoderTest::testEncodeXmlAttributes()

File

vendor/symfony/serializer/Tests/Encoder/XmlEncoderTest.php, line 123

Class

XmlEncoderTest

Namespace

Symfony\Component\Serializer\Tests\Encoder

Code

public function testEncodeXmlAttributes() {
  $xml = simplexml_load_string('<firstname>Peter</firstname>');
  $array = array(
    'person' => $xml,
  );
  $expected = '<?xml version="1.1" encoding="utf-8" standalone="yes"?>' . "\n" . '<response><person><firstname>Peter</firstname></person></response>' . "\n";
  $context = array(
    'xml_version' => '1.1',
    'xml_encoding' => 'utf-8',
    'xml_standalone' => true,
  );
  $this
    ->assertSame($expected, $this->encoder
    ->encode($array, 'xml', $context));
}