Commit 428ff5b0 authored by alexpott's avatar alexpott

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
......@@ -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())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment