public function test_betweenCustomers() { /** === Test Data === */ $custIdFrom = 123; $custIdTo = 321; $countryFrom = 'lv'; $countryTo = 'ru'; $pathTo = '/1/2/5/'; $dateApplied = '2015-06-23 13:23:34'; $value = '23.34'; $accIdFrom = 43; $accIdTo = 65; $custDebit = new Customer([Customer::ATTR_CUSTOMER_ID => $custIdFrom, Customer::ATTR_COUNTRY_CODE => $countryFrom]); $custCredit = new Customer([Customer::ATTR_CUSTOMER_ID => $custIdTo, Customer::ATTR_COUNTRY_CODE => $countryTo, Customer::ATTR_PATH => $pathTo]); $accFrom = new Account([Account::ATTR_ID => $accIdFrom]); $accTo = new Account([Account::ATTR_ID => $accIdTo]); /** === Setup Mocks === */ // $date = $this->_toolDate->getUtcNowForDb(); $this->mToolDate->shouldReceive('getUtcNowForDb')->once()->andReturn($dateApplied); // $downDebit = $this->_repoMod->getDownlineCustomerById($custIdDebit); $this->mRepoMod->shouldReceive('getDownlineCustomerById')->once()->with($custIdFrom)->andReturn($custDebit); // $downCredit = $this->_repoMod->getDownlineCustomerById($custIdCredit); $this->mRepoMod->shouldReceive('getDownlineCustomerById')->once()->with($custIdTo)->andReturn($custCredit); // $respAccDebit = $this->_callAccount->get($reqAccGet); $this->mCallAccount->shouldReceive('get')->once()->andReturn($accFrom); // $respAccCredit = $this->_callAccount->get($reqAccGet); $this->mCallAccount->shouldReceive('get')->once()->andReturn($accTo); // $respAddOper = $this->_callOperation->add($reqAddOper); $mRespAddOper = new \Praxigento\Accounting\Service\Operation\Response\Add(); $mRespAddOper->markSucceed(); $this->mCallOperation->shouldReceive('add')->once()->andReturn($mRespAddOper); /** === Call and asserts === */ $req = new Request\BetweenCustomers(); $req->setFromCustomerId($custIdFrom); $req->setToCustomerId($custIdTo); $req->setValue($value); $req->setConditionForceCountry(true); $req->setConditionForceDownline(true); $resp = $this->obj->betweenCustomers($req); $this->assertTrue($resp->isSucceed()); /* code coverage */ $req->setConditionForceAll(true); $req->setDateApplied(null); }