objectManagerHelper = new ObjectManagerHelper($this); $this->response = $this->createMock(HttpResponseInterface::class); $this->raw = $this->objectManagerHelper->getObject(\Magento\Framework\Controller\Result\Raw::class); } public function testSetContents() { $content = 'test'; $this->assertInstanceOf(\Magento\Framework\Controller\Result\Raw::class, $this->raw->setContents($content)); } public function testRender() { $content = 'test'; $this->raw->setContents($content); $this->response->expects($this->once())->method('setBody')->with($content); $this->assertSame($this->raw, $this->raw->renderResult($this->response)); } }