private function _transferToCustomer($custId, $value) { $req = new RequestTransferCreditToCustomer(); $req->setConditionForceAll(true); $req->setToCustomerId($custId); $req->setValue($value); $resp = $this->_callTransfer->creditToCustomer($req); $this->assertTrue($resp->isSucceed()); }
public function test_creditToCustomer() { /** === Test Data === */ $custIdFrom = 123; $custIdTo = 321; $value = '23.34'; $accFrom = new Account([Account::ATTR_CUST_ID => $custIdFrom]); /** === 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($accFrom); // $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\CreditToCustomer(); $req->setToCustomerId($custIdTo); $req->setValue($value); $res = $this->obj->creditToCustomer($req); $this->assertTrue($res->isSucceed()); /* coverage for accessors */ $req->getToCustomerId(); }