You are here

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

File

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

Class

XmlEncoderTest

Namespace

Symfony\Component\Serializer\Tests\Encoder

Code

public function testDecodeWithoutItemHash() {
  $obj = new ScalarDummy();
  $obj->xmlFoo = array(
    'foo-bar' => array(
      '@key' => 'value',
      'item' => array(
        '@key' => 'key',
        'key-val' => 'val',
      ),
    ),
    'Foo' => array(
      'Bar' => 'Test',
      '@Type' => 'test',
    ),
    'föo_bär' => 'a',
    'Bar' => array(
      1,
      2,
      3,
    ),
    'a' => 'b',
  );
  $expected = array(
    'foo-bar' => array(
      '@key' => 'value',
      'key' => array(
        '@key' => 'key',
        'key-val' => 'val',
      ),
    ),
    'Foo' => array(
      'Bar' => 'Test',
      '@Type' => 'test',
    ),
    'föo_bär' => 'a',
    'Bar' => array(
      1,
      2,
      3,
    ),
    'a' => 'b',
  );
  $xml = $this->encoder
    ->encode($obj, 'xml');
  $this
    ->assertEquals($expected, $this->encoder
    ->decode($xml, 'xml'));
}