Loading core/modules/serialization/tests/src/Unit/Normalizer/EntityNormalizerTest.php +21 −34 Original line number Diff line number Diff line Loading @@ -94,18 +94,11 @@ public function testNormalize() { ->method('getFields') ->willReturn($definitions); $serializer = $this->getMockBuilder('Symfony\Component\Serializer\Serializer') ->disableOriginalConstructor() ->onlyMethods(['normalize']) ->getMock(); $serializer->expects($this->exactly(2)) ->method('normalize') ->withConsecutive( [$list_item_1, 'test_format'], [$list_item_2, 'test_format'], ); $serializer = $this->prophesize('Symfony\Component\Serializer\Serializer'); $serializer->normalize($list_item_1, 'test_format', [])->shouldBeCalled(); $serializer->normalize($list_item_2, 'test_format', [])->shouldBeCalled(); $this->entityNormalizer->setSerializer($serializer); $this->entityNormalizer->setSerializer($serializer->reveal()); $this->entityNormalizer->normalize($content_entity, 'test_format'); } Loading Loading @@ -224,18 +217,15 @@ public function testDenormalizeWithValidBundle() { // Setup expectations for the serializer. This will be called for each field // item. $serializer = $this->getMockBuilder('Symfony\Component\Serializer\Serializer') ->disableOriginalConstructor() ->onlyMethods(['denormalize']) ->getMock(); $serializer->expects($this->exactly(2)) ->method('denormalize') ->withConsecutive( ['value_1', get_class($key_1), NULL, ['target_instance' => $key_1, 'entity_type' => 'test']], ['value_2', get_class($key_2), NULL, ['target_instance' => $key_2, 'entity_type' => 'test']], ); $serializer = $this->prophesize('Symfony\Component\Serializer\Serializer'); $serializer->denormalize('value_1', get_class($key_1), NULL, ['target_instance' => $key_1, 'entity_type' => 'test']) ->willReturn(NULL) ->shouldBeCalled(); $serializer->denormalize('value_2', get_class($key_2), NULL, ['target_instance' => $key_2, 'entity_type' => 'test']) ->willReturn(NULL) ->shouldBeCalled(); $this->entityNormalizer->setSerializer($serializer); $this->entityNormalizer->setSerializer($serializer->reveal()); $this->assertNotNull($this->entityNormalizer->denormalize($test_data, 'Drupal\Core\Entity\ContentEntityBase', NULL, ['entity_type' => 'test'])); } Loading Loading @@ -377,18 +367,15 @@ public function testDenormalizeWithNoBundle() { // Setup expectations for the serializer. This will be called for each field // item. $serializer = $this->getMockBuilder('Symfony\Component\Serializer\Serializer') ->disableOriginalConstructor() ->onlyMethods(['denormalize']) ->getMock(); $serializer->expects($this->exactly(2)) ->method('denormalize') ->withConsecutive( ['value_1', get_class($key_1), NULL, ['target_instance' => $key_1, 'entity_type' => 'test']], ['value_2', get_class($key_2), NULL, ['target_instance' => $key_2, 'entity_type' => 'test']], ); $this->entityNormalizer->setSerializer($serializer); $serializer = $this->prophesize('Symfony\Component\Serializer\Serializer'); $serializer->denormalize('value_1', get_class($key_1), NULL, ['target_instance' => $key_1, 'entity_type' => 'test']) ->willReturn(NULL) ->shouldBeCalled(); $serializer->denormalize('value_2', get_class($key_2), NULL, ['target_instance' => $key_2, 'entity_type' => 'test']) ->willReturn(NULL) ->shouldBeCalled(); $this->entityNormalizer->setSerializer($serializer->reveal()); $this->assertNotNull($this->entityNormalizer->denormalize($test_data, 'Drupal\Core\Entity\ContentEntityBase', NULL, ['entity_type' => 'test'])); } Loading core/phpstan-baseline.neon +0 −5 Original line number Diff line number Diff line Loading @@ -2210,11 +2210,6 @@ parameters: count: 1 path: modules/serialization/src/Normalizer/EntityNormalizer.php - message: "#^Call to deprecated method withConsecutive\\(\\) of class PHPUnit\\\\Framework\\\\MockObject\\\\Builder\\\\InvocationMocker\\.$#" count: 3 path: modules/serialization/tests/src/Unit/Normalizer/EntityNormalizerTest.php - message: "#^Method Drupal\\\\shortcut\\\\Form\\\\SetCustomize\\:\\:save\\(\\) should return int but return statement is missing\\.$#" count: 1 Loading Loading
core/modules/serialization/tests/src/Unit/Normalizer/EntityNormalizerTest.php +21 −34 Original line number Diff line number Diff line Loading @@ -94,18 +94,11 @@ public function testNormalize() { ->method('getFields') ->willReturn($definitions); $serializer = $this->getMockBuilder('Symfony\Component\Serializer\Serializer') ->disableOriginalConstructor() ->onlyMethods(['normalize']) ->getMock(); $serializer->expects($this->exactly(2)) ->method('normalize') ->withConsecutive( [$list_item_1, 'test_format'], [$list_item_2, 'test_format'], ); $serializer = $this->prophesize('Symfony\Component\Serializer\Serializer'); $serializer->normalize($list_item_1, 'test_format', [])->shouldBeCalled(); $serializer->normalize($list_item_2, 'test_format', [])->shouldBeCalled(); $this->entityNormalizer->setSerializer($serializer); $this->entityNormalizer->setSerializer($serializer->reveal()); $this->entityNormalizer->normalize($content_entity, 'test_format'); } Loading Loading @@ -224,18 +217,15 @@ public function testDenormalizeWithValidBundle() { // Setup expectations for the serializer. This will be called for each field // item. $serializer = $this->getMockBuilder('Symfony\Component\Serializer\Serializer') ->disableOriginalConstructor() ->onlyMethods(['denormalize']) ->getMock(); $serializer->expects($this->exactly(2)) ->method('denormalize') ->withConsecutive( ['value_1', get_class($key_1), NULL, ['target_instance' => $key_1, 'entity_type' => 'test']], ['value_2', get_class($key_2), NULL, ['target_instance' => $key_2, 'entity_type' => 'test']], ); $serializer = $this->prophesize('Symfony\Component\Serializer\Serializer'); $serializer->denormalize('value_1', get_class($key_1), NULL, ['target_instance' => $key_1, 'entity_type' => 'test']) ->willReturn(NULL) ->shouldBeCalled(); $serializer->denormalize('value_2', get_class($key_2), NULL, ['target_instance' => $key_2, 'entity_type' => 'test']) ->willReturn(NULL) ->shouldBeCalled(); $this->entityNormalizer->setSerializer($serializer); $this->entityNormalizer->setSerializer($serializer->reveal()); $this->assertNotNull($this->entityNormalizer->denormalize($test_data, 'Drupal\Core\Entity\ContentEntityBase', NULL, ['entity_type' => 'test'])); } Loading Loading @@ -377,18 +367,15 @@ public function testDenormalizeWithNoBundle() { // Setup expectations for the serializer. This will be called for each field // item. $serializer = $this->getMockBuilder('Symfony\Component\Serializer\Serializer') ->disableOriginalConstructor() ->onlyMethods(['denormalize']) ->getMock(); $serializer->expects($this->exactly(2)) ->method('denormalize') ->withConsecutive( ['value_1', get_class($key_1), NULL, ['target_instance' => $key_1, 'entity_type' => 'test']], ['value_2', get_class($key_2), NULL, ['target_instance' => $key_2, 'entity_type' => 'test']], ); $this->entityNormalizer->setSerializer($serializer); $serializer = $this->prophesize('Symfony\Component\Serializer\Serializer'); $serializer->denormalize('value_1', get_class($key_1), NULL, ['target_instance' => $key_1, 'entity_type' => 'test']) ->willReturn(NULL) ->shouldBeCalled(); $serializer->denormalize('value_2', get_class($key_2), NULL, ['target_instance' => $key_2, 'entity_type' => 'test']) ->willReturn(NULL) ->shouldBeCalled(); $this->entityNormalizer->setSerializer($serializer->reveal()); $this->assertNotNull($this->entityNormalizer->denormalize($test_data, 'Drupal\Core\Entity\ContentEntityBase', NULL, ['entity_type' => 'test'])); } Loading
core/phpstan-baseline.neon +0 −5 Original line number Diff line number Diff line Loading @@ -2210,11 +2210,6 @@ parameters: count: 1 path: modules/serialization/src/Normalizer/EntityNormalizer.php - message: "#^Call to deprecated method withConsecutive\\(\\) of class PHPUnit\\\\Framework\\\\MockObject\\\\Builder\\\\InvocationMocker\\.$#" count: 3 path: modules/serialization/tests/src/Unit/Normalizer/EntityNormalizerTest.php - message: "#^Method Drupal\\\\shortcut\\\\Form\\\\SetCustomize\\:\\:save\\(\\) should return int but return statement is missing\\.$#" count: 1 Loading