You are here

public function SerializerTest::testSerialize in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/serializer/Tests/SerializerTest.php \Symfony\Component\Serializer\Tests\SerializerTest::testSerialize()

File

vendor/symfony/serializer/Tests/SerializerTest.php, line 96

Class

SerializerTest

Namespace

Symfony\Component\Serializer\Tests

Code

public function testSerialize() {
  $this->serializer = new Serializer(array(
    new GetSetMethodNormalizer(),
  ), array(
    'json' => new JsonEncoder(),
  ));
  $data = array(
    'title' => 'foo',
    'numbers' => array(
      5,
      3,
    ),
  );
  $result = $this->serializer
    ->serialize(Model::fromArray($data), 'json');
  $this
    ->assertEquals(json_encode($data), $result);
}