本文整理汇总了PHP中Call::calc方法的典型用法代码示例。如果您正苦于以下问题:PHP Call::calc方法的具体用法?PHP Call::calc怎么用?PHP Call::calc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Call
的用法示例。
在下文中一共展示了Call::calc方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_calc
public function test_calc()
{
/** === Test Data === */
$ASSET_TYPE_ID = 21;
$DATESTAMP_TO = '20151123';
$DS = 'datestamp';
$DS_FROM = 'datestamp from';
$DS_TO = 'datestamp to';
$TRANS = 'transactions';
$UPDATES = 'updates';
$BALANCES = ['some balances data'];
/** === Mock object itself === */
$this->obj = \Mockery::mock(Call::class . '[getLastDate]', $this->objArgs);
/** === Setup Mocks === */
// $respLastDate = $this->getLastDate($reqLastDate);
$this->obj->shouldReceive('getLastDate')->once()->andReturn(new Response\GetLastDate([Response\GetLastDate::LAST_DATE => $DS]));
// $balances = $this->_repoMod->getBalancesOnDate($assetTypeId, $lastDate);
$this->mRepoMod->shouldReceive('getBalancesOnDate')->once()->andReturn($BALANCES);
// $dtFrom = $this->_toolPeriod->getTimestampFrom($lastDate, IPeriod::TYPE_DAY);
$this->mToolPeriod->shouldReceive('getTimestampFrom')->once()->andReturn($DS_FROM);
// $dtTo = $this->_toolPeriod->getTimestampTo($dateTo, IPeriod::TYPE_DAY);
$this->mToolPeriod->shouldReceive('getTimestampTo')->once()->andReturn($DS_TO);
// $trans = $this->_repoMod->getTransactionsForPeriod($assetTypeId, $dtFrom, $dtTo);
$this->mRepoMod->shouldReceive('getTransactionsForPeriod')->once()->andReturn($TRANS);
// $updates = $this->_subCalcSimple->calcBalances($balances, $trans);
$this->mSubCalcSimple->shouldReceive('calcBalances')->once()->andReturn($UPDATES);
// $this->_repoMod->updateBalances($updates);
$this->mRepoMod->shouldReceive('updateBalances')->once();
/** === Call and asserts === */
$req = new Request\Calc();
$req->setAssetTypeId($ASSET_TYPE_ID);
$req->setDateTo($DATESTAMP_TO);
$res = $this->obj->calc($req);
$this->assertTrue($res->isSucceed());
}
示例2: test_calc
public function test_calc()
{
/** === Test Data === */
$dsTo = '20151207';
$dsLast = 'the last datestamp';
$snapshot = 'snapshot';
$tsFrom = 'from';
$tsTo = 'to';
$changeLog = 'change log';
$updates = 'updates';
/** === Mock object itself === */
$this->obj = \Mockery::mock(Call::class . '[getLastDate]', $this->objArgs);
/** === Setup Mocks === */
// $def = $this->_manTrans->begin();
$mDef = $this->_mockTransactionDefinition();
$this->mManTrans->shouldReceive('begin')->once()->andReturn($mDef);
// $respLast = $this->getLastDate($reqLast);
$mRespLast = new \Praxigento\Downline\Service\Snap\Response\GetLastDate();
$this->obj->shouldReceive('getLastDate')->once()->andReturn($mRespLast);
// $lastDatestamp = $respLast->getLastDate();
$mRespLast->setLastDate($dsLast);
// $snapshot = $this->_repoSnap->getStateOnDate($lastDatestamp);
$this->mRepoSnap->shouldReceive('getStateOnDate')->once()->andReturn($snapshot);
// $tsFrom = $this->_toolPeriod->getTimestampNextFrom($lastDatestamp);
$this->mToolPeriod->shouldReceive('getTimestampNextFrom')->once()->andReturn($tsFrom);
// $tsTo = $this->_toolPeriod->getTimestampTo($periodTo);
$this->mToolPeriod->shouldReceive('getTimestampTo')->once()->andReturn($tsTo);
// $changelog = $this->_repoChange->getChangesForPeriod($tsFrom, $tsTo);
$this->mRepoChange->shouldReceive('getChangesForPeriod')->once()->andReturn($changeLog);
// $updates = $this->_subCalc->calcSnapshots($snapshot, $changelog);
$this->mSubCalc->shouldReceive('calcSnapshots')->once()->andReturn($updates);
// $this->_repoSnap->saveCalculatedUpdates($updates);
$this->mRepoSnap->shouldReceive('saveCalculatedUpdates')->once();
// $this->_manTrans->commit($def);
$this->mManTrans->shouldReceive('commit')->once();
// $this->_manTrans->end($def);
$this->mManTrans->shouldReceive('end')->once();
/** === Call and asserts === */
$req = new Request\Calc();
$req->setDatestampTo($dsTo);
$resp = $this->obj->calc($req);
$this->assertTrue($resp->isSucceed());
}