public function XmlEncoderTest::testEncodeRootAttributes

File

drupal/core/vendor/symfony/serializer/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php, line 134

Class

XmlEncoderTest

Namespace

Symfony\Component\Serializer\Tests\Encoder

Code

public function testEncodeRootAttributes() {
  $array = array(
    'firstname' => 'Paul',
    '@gender' => 'm',
  );
  $expected = '<?xml version="1.0"?>' . "\n" . '<response gender="m"><firstname>Paul</firstname></response>' . "\n";
  $this
    ->assertEquals($expected, $this->encoder
    ->encode($array, 'xml'));
}