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 @@ ...@@ -9,7 +9,6 @@
use Symfony\Component\Serializer\Encoder\EncoderInterface; use Symfony\Component\Serializer\Encoder\EncoderInterface;
use Symfony\Component\Serializer\Encoder\DecoderInterface; use Symfony\Component\Serializer\Encoder\DecoderInterface;
use Symfony\Component\Serializer\Encoder\SerializerAwareEncoder;
use Symfony\Component\Serializer\Encoder\XmlEncoder as BaseXmlEncoder; use Symfony\Component\Serializer\Encoder\XmlEncoder as BaseXmlEncoder;
/** /**
...@@ -18,7 +17,7 @@ ...@@ -18,7 +17,7 @@
* This acts as a wrapper class for Symfony's XmlEncoder so that it is not * This acts as a wrapper class for Symfony's XmlEncoder so that it is not
* implementing NormalizationAwareInterface, and can be normalized externally. * 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. * The formats that this Encoder supports.
...@@ -61,8 +60,7 @@ public function setBaseEncoder($encoder) { ...@@ -61,8 +60,7 @@ public function setBaseEncoder($encoder) {
* Implements \Symfony\Component\Serializer\Encoder\EncoderInterface::encode(). * Implements \Symfony\Component\Serializer\Encoder\EncoderInterface::encode().
*/ */
public function encode($data, $format, array $context = array()){ public function encode($data, $format, array $context = array()){
$normalized = $this->serializer->normalize($data, $format, $context); return $this->getBaseEncoder()->encode($data, $format, $context);
return $this->getBaseEncoder()->encode($normalized, $format, $context);
} }
/** /**
......
...@@ -61,17 +61,6 @@ public function testSupportsDecoding() { ...@@ -61,17 +61,6 @@ public function testSupportsDecoding() {
* Tests the encode() method. * Tests the encode() method.
*/ */
public function testEncode() { 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()) $this->baseEncoder->expects($this->once())
->method('encode') ->method('encode')
->with($this->testArray, 'test', array()) ->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