private function _transferFromCustomer($custId, $value) { $req = new RequestTransferDebitFromCustomer(); $req->setConditionForceAll(true); $req->setFromCustomerId($custId); $req->setValue($value); $resp = $this->_callTransfer->debitFromCustomer($req); $this->assertTrue($resp->isSucceed()); }
public function test_debitFromCustomer() { /** === Test Data === */ $custIdFrom = 123; $custIdTo = 321; $value = '23.34'; $accTo = new Account([Account::ATTR_CUST_ID => $custIdTo]); /** === Mock object itself === */ $this->obj = \Mockery::mock(Call::class . '[betweenCustomers]', $this->objArgs); /** === Setup Mocks === */ // $respRepres = $this->_callAccount->getRepresentative($reqRepres); $this->mCallAccount->shouldReceive('getRepresentative')->once()->andReturn($accTo); // $respBetween = $this->betweenCustomers($reqBetween); $mRespBetween = new Response\BetweenCustomers(); $this->obj->shouldReceive('betweenCustomers')->once()->andReturn($mRespBetween); // if ($respBetween->isSucceed()) { $mRespBetween->markSucceed(); /** === Call and asserts === */ $req = new Request\DebitFromCustomer(); $req->setFromCustomerId($custIdFrom); $req->setValue($value); $res = $this->obj->debitFromCustomer($req); $this->assertTrue($res->isSucceed()); /* coverage for accessors */ $req->getFromCustomerId(); }