예제 #1
0
 public function testupdateInvoiceIsPaid()
 {
     $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());
     $model->status = 'paid';
     $dbMock->expects($this->atLeastOnce())->method('findOne')->will($this->returnValue($model));
     $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', 'Paid Invoice can not be modified');
     $this->api->update($data);
 }