Skip to content
Snippets Groups Projects
Commit 428ff5b0 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2349879 by damiankloip: Fixed Remove unnecessary call to serializer >...

Issue #2349879 by damiankloip: Fixed Remove unnecessary call to serializer > normalize in XmlEncoder::encode.
parent cbd36ff0
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -9,7 +9,6 @@
use Symfony\Component\Serializer\Encoder\EncoderInterface;
use Symfony\Component\Serializer\Encoder\DecoderInterface;
use Symfony\Component\Serializer\Encoder\SerializerAwareEncoder;
use Symfony\Component\Serializer\Encoder\XmlEncoder as BaseXmlEncoder;
/**
......@@ -18,7 +17,7 @@
* This acts as a wrapper class for Symfony's XmlEncoder so that it is not
* implementing NormalizationAwareInterface, and can be normalized externally.
*/
class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, DecoderInterface {
class XmlEncoder implements EncoderInterface, DecoderInterface {
/**
* The formats that this Encoder supports.
......@@ -61,8 +60,7 @@ public function setBaseEncoder($encoder) {
* Implements \Symfony\Component\Serializer\Encoder\EncoderInterface::encode().
*/
public function encode($data, $format, array $context = array()){
$normalized = $this->serializer->normalize($data, $format, $context);
return $this->getBaseEncoder()->encode($normalized, $format, $context);
return $this->getBaseEncoder()->encode($data, $format, $context);
}
/**
......
......@@ -61,17 +61,6 @@ public function testSupportsDecoding() {
* Tests the encode() method.
*/
public function testEncode() {
$serializer = $this->getMockBuilder('Symfony\Component\Serializer\Serializer')
->disableOriginalConstructor()
->setMethods(array('normalize'))
->getMock();
$serializer->expects($this->once())
->method('normalize')
->with($this->testArray, 'test', array())
->will($this->returnValue($this->testArray));
$this->encoder->setSerializer($serializer);
$this->baseEncoder->expects($this->once())
->method('encode')
->with($this->testArray, 'test', array())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment