public function SerializerTest::testDeserialize

File

drupal/core/vendor/symfony/serializer/Symfony/Component/Serializer/Tests/SerializerTest.php, line 119

Class

SerializerTest

Namespace

Symfony\Component\Serializer\Tests

Code

public function testDeserialize() {
  $this->serializer = new Serializer(array(
    new GetSetMethodNormalizer(),
  ), array(
    'json' => new JsonEncoder(),
  ));
  $data = array(
    'title' => 'foo',
    'numbers' => array(
      5,
      3,
    ),
  );
  $result = $this->serializer
    ->deserialize(json_encode($data), '\\Symfony\\Component\\Serializer\\Tests\\Model', 'json');
  $this
    ->assertEquals($data, $result
    ->toArray());
}