/** * @expectedException \Exception */ public function testSubscribeWithException() { $this->stateMock->expects($this->once())->method('getMode')->will($this->returnValue(\Magento\Framework\Mview\View\StateInterface::MODE_DISABLED)); $this->changelogMock->expects($this->once())->method('create')->will($this->returnCallback(function () { throw new \Exception(); })); $this->loadView(); $this->model->subscribe(); }