public function XmlEncoderTest::testDecodeRootAttributes

File

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

Class

XmlEncoderTest

Namespace

Symfony\Component\Serializer\Tests\Encoder

Code

public function testDecodeRootAttributes() {
  $source = '<?xml version="1.0"?>' . "\n" . '<person gender="M"><firstname>Peter</firstname><lastname>Mac Calloway</lastname></person>' . "\n";
  $expected = array(
    'firstname' => 'Peter',
    'lastname' => 'Mac Calloway',
    '@gender' => 'M',
  );
  $this
    ->assertEquals($expected, $this->encoder
    ->decode($source, 'xml'));
}