예제 #1
0
 /**
  * Test GET method with wrong Renderer class.
  */
 public function testGetWithWrongRendererClass()
 {
     $acceptTypes = ['application/json'];
     /** Mock request getAcceptTypes method to return specified value. */
     $this->_requestMock->expects($this->once())->method('getAcceptTypes')->will($this->returnValue($acceptTypes));
     /** Mock object to return \Magento\Framework\Object */
     $this->_objectManagerMock->expects($this->once())->method('get')->with('Magento\\Webapi\\Controller\\Rest\\Response\\Renderer\\Json')->will($this->returnValue(new \Magento\Framework\Object()));
     $this->setExpectedException('LogicException', 'The renderer must implement "Magento\\Webapi\\Controller\\Rest\\Response\\RendererInterface".');
     $this->_factory->get();
 }
예제 #2
0
파일: Response.php 프로젝트: aiesh/magento2
 /**
  * Initialize dependencies.
  *
  * @param \Magento\Webapi\Controller\Rest\Response\Renderer\Factory $rendererFactory
  * @param \Magento\Webapi\Controller\ErrorProcessor $errorProcessor
  * @param \Magento\Framework\App\State $appState
  */
 public function __construct(\Magento\Webapi\Controller\Rest\Response\Renderer\Factory $rendererFactory, \Magento\Webapi\Controller\ErrorProcessor $errorProcessor, \Magento\Framework\App\State $appState)
 {
     $this->_renderer = $rendererFactory->get();
     $this->_errorProcessor = $errorProcessor;
     $this->_appState = $appState;
 }