Exemplo n.º 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();
 }
Exemplo n.º 2
0
 /**
  * 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;
 }