You are here

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

File

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

Class

XmlEncoderTest

Namespace

Symfony\Component\Serializer\Tests\Encoder

Code

public function testDecodeArray() {
  $source = '<?xml version="1.0"?>' . "\n" . '<response>' . '<people>' . '<person><firstname>Benjamin</firstname><lastname>Alexandre</lastname></person>' . '<person><firstname>Damien</firstname><lastname>Clay</lastname></person>' . '</people>' . '</response>' . "\n";
  $expected = array(
    'people' => array(
      'person' => array(
        array(
          'firstname' => 'Benjamin',
          'lastname' => 'Alexandre',
        ),
        array(
          'firstname' => 'Damien',
          'lastname' => 'Clay',
        ),
      ),
    ),
  );
  $this
    ->assertEquals($expected, $this->encoder
    ->decode($source, 'xml'));
}