denormalize() public method

public denormalize ( $data, $class, $format = null, array $context = [] )
$context array
コード例 #1
0
 /**
  * @expectedException \ApiPlatform\Core\Exception\InvalidArgumentException
  * @expectedExceptionMessage Update is not allowed for this operation.
  */
 public function testDenormalizeWithIdAndUpdateNotAllowed()
 {
     $context = ['resource_class' => Dummy::class, 'api_allow_update' => false];
     $propertyNameCollectionFactoryProphecy = $this->prophesize(PropertyNameCollectionFactoryInterface::class);
     $propertyMetadataFactoryProphecy = $this->prophesize(PropertyMetadataFactoryInterface::class);
     $iriConverterProphecy = $this->prophesize(IriConverterInterface::class);
     $resourceClassResolverProphecy = $this->prophesize(ResourceClassResolverInterface::class);
     $serializerProphecy = $this->prophesize(SerializerInterface::class);
     $serializerProphecy->willImplement(DenormalizerInterface::class);
     $normalizer = new ItemNormalizer($propertyNameCollectionFactoryProphecy->reveal(), $propertyMetadataFactoryProphecy->reveal(), $iriConverterProphecy->reveal(), $resourceClassResolverProphecy->reveal());
     $normalizer->setSerializer($serializerProphecy->reveal());
     $normalizer->denormalize(['id' => '/dummies/12', 'name' => 'hello'], Dummy::class, null, $context);
 }