You are here

public function XmlEncoderTest::testContext 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::testContext()

File

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

Class

XmlEncoderTest

Namespace

Symfony\Component\Serializer\Tests\Encoder

Code

public function testContext() {
  $array = array(
    'person' => array(
      'name' => 'George Abitbol',
    ),
  );
  $expected = <<<XML
<?xml version="1.0"?>
<response>
  <person>
    <name>George Abitbol</name>
  </person>
</response>

XML;
  $context = array(
    'xml_format_output' => true,
  );
  $this
    ->assertSame($expected, $this->encoder
    ->encode($array, 'xml', $context));
}