You are here

public function PropertyNormalizerTest::testCircularReferenceHandler in Zircon Profile 8

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

File

vendor/symfony/serializer/Tests/Normalizer/PropertyNormalizerTest.php, line 390

Class

PropertyNormalizerTest

Namespace

Symfony\Component\Serializer\Tests\Normalizer

Code

public function testCircularReferenceHandler() {
  $serializer = new Serializer(array(
    $this->normalizer,
  ));
  $this->normalizer
    ->setSerializer($serializer);
  $this->normalizer
    ->setCircularReferenceHandler(function ($obj) {
    return get_class($obj);
  });
  $obj = new PropertyCircularReferenceDummy();
  $expected = array(
    'me' => 'Symfony\\Component\\Serializer\\Tests\\Fixtures\\PropertyCircularReferenceDummy',
  );
  $this
    ->assertEquals($expected, $this->normalizer
    ->normalize($obj));
}