JsonApiDocumentTopLevelNormalizer example

$entity->id()->willReturn($uuid_to_id[$uuid]);
          $result[$uuid] = $entity->reveal();
        }
        return $result;
      });
    $entity_type_manager = $this->prophesize(EntityTypeManagerInterface::class);
    $entity_type_manager->getStorage('node')->willReturn($entity_storage->reveal());
    $entity_type = $this->prophesize(EntityTypeInterface::class);
    $entity_type->getKey('uuid')->willReturn('uuid');
    $entity_type_manager->getDefinition('node')->willReturn($entity_type->reveal());

    $this->normalizer = new JsonApiDocumentTopLevelNormalizer(
      $entity_type_manager->reveal(),
      $resource_type_repository->reveal()
    );

    $serializer = $this->prophesize(DenormalizerInterface::class);
    $serializer->willImplement(SerializerInterface::class);
    $serializer->denormalize(
      Argument::type('array'),
      Argument::type('string'),
      Argument::type('string'),
      Argument::type('array')
    )
Home | Imprint | This part of the site doesn't use cookies.