/** * @expectedException \Exception */ public function test_add_rollback() { /** === Test Data === */ $assetIdDebit = 3; $assetIdCredit = 4; $accIdDebit = 12; $accIdCredit = 23; $operId = 543; $value = 32.54; $date = 'date applied'; /** === Mocks === */ // $def = $this->_manTrans->begin(); $mDef = $this->_mockTransactionDefinition(); $this->mManTrans->shouldReceive('begin')->once()->andReturn($mDef); // $debitAcc = $this->_repoAcc->getById($debitAccId); $this->mRepoAcc->shouldReceive('getById')->once()->andReturn(new Account([Account::ATTR_ASSET_TYPE_ID => $assetIdDebit])); // $creditAcc = $this->_repoAcc->getById($creditAccId); $this->mRepoAcc->shouldReceive('getById')->once()->andReturn(new Account([Account::ATTR_ASSET_TYPE_ID => $assetIdCredit])); /** === Call and asserts === */ $req = new Request\Add(); $req->setDebitAccId($accIdDebit); $req->setCreditAccId($accIdCredit); $req->setOperationId($operId); $req->setDateApplied($date); $req->setValue($value); $this->obj->add($req); }