Ejemplo n.º 1
0
 /**
  * Get request deserializer.
  *
  * @return \Magento\Framework\Webapi\Rest\Request\DeserializerInterface
  */
 protected function _getDeserializer()
 {
     if (null === $this->_deserializer) {
         $this->_deserializer = $this->_deserializerFactory->get($this->getContentType());
     }
     return $this->_deserializer;
 }
Ejemplo n.º 2
0
 /**
  * Prepare SUT for GetBodyParams() method mock.
  *
  * @param array $params
  */
 protected function _prepareSutForGetBodyParamsTest($params)
 {
     $content = 'rawBody';
     $this->_request->expects($this->exactly(2))->method('getContent')->will($this->returnValue($content));
     $contentType = 'contentType';
     $this->_request->expects($this->once())->method('getHeader')->with('Content-Type')->will($this->returnValue($contentType));
     $deserializer = $this->getMockBuilder('Magento\\Framework\\Webapi\\Rest\\Request\\Deserializer\\Json')->disableOriginalConstructor()->setMethods(['deserialize'])->getMock();
     $deserializer->expects($this->once())->method('deserialize')->with($content)->will($this->returnValue($params));
     $this->_deserializerFactory->expects($this->once())->method('get')->with($contentType)->will($this->returnValue($deserializer));
 }