public function testgetInvoiceNotFound() { $validatorMock = $this->getMockBuilder('\\Box_Validate')->getMock(); $validatorMock->expects($this->atLeastOnce())->method('checkRequiredParamsForArray'); $dbMock = $this->getMockBuilder('\\Box_Database')->getMock(); $model = new \Model_Invoice(); $model->loadBean(new \RedBeanPHP\OODBBean()); $dbMock->expects($this->atLeastOnce())->method('findOne')->will($this->returnValue(null)); $di = new \Box_Di(); $di['validator'] = $validatorMock; $di['db'] = $dbMock; $this->api->setDi($di); $this->api->setIdentity(new \Model_Admin()); $data['hash'] = md5(1); $this->setExpectedException('\\Box_Exception', 'Invoice was not found'); $this->api->get($data); }