/** * Prepare SUT for GetBodyParams() method mock. * * @param array $params */ protected function _prepareSutForGetBodyParamsTest($params) { $rawBody = 'rawBody'; $this->_request->expects($this->once())->method('getRawBody')->will($this->returnValue($rawBody)); $contentType = 'contentType'; $this->_request->expects($this->once())->method('getHeader')->with('Content-Type')->will($this->returnValue($contentType)); $deserializer = $this->getMockBuilder('Magento\\Webapi\\Controller\\Rest\\Request\\Deserializer\\Json')->disableOriginalConstructor()->setMethods(array('deserialize'))->getMock(); $deserializer->expects($this->once())->method('deserialize')->with($rawBody)->will($this->returnValue($params)); $this->_deserializerFactory->expects($this->once())->method('get')->with($contentType)->will($this->returnValue($deserializer)); }