当前位置: 首页>>代码示例>>PHP>>正文


PHP Call::shouldReceive方法代码示例

本文整理汇总了PHP中Call::shouldReceive方法的典型用法代码示例。如果您正苦于以下问题:PHP Call::shouldReceive方法的具体用法?PHP Call::shouldReceive怎么用?PHP Call::shouldReceive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Call的用法示例。


在下文中一共展示了Call::shouldReceive方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
 }
开发者ID:praxigento,项目名称:mobi_mod_mage2_accounting,代码行数:35,代码来源:Call_Test.php

示例2: test_productsFromOdoo_success

 public function test_productsFromOdoo_success()
 {
     /** === Test Data === */
     $PROD_ID_ODOO = 21;
     $BUNDLE = $this->_mock(\Praxigento\Odoo\Data\Odoo\Inventory::class);
     $BUNDLE->shouldReceive('getOption', 'getWarehouses', 'getLots');
     /** === Mock object itself === */
     $this->obj = \Mockery::mock(Call::class . '[_doProductReplication]', $this->objArgs);
     /** === Setup Mocks === */
     // $def = $this->_manTrans->begin();
     $mDef = $this->_mockTransactionDefinition();
     $this->mManTrans->shouldReceive('begin')->once()->andReturn($mDef);
     // $bundle = $this->_repoOdooInventory->get($ids);
     $this->mRepoOdooInventory->shouldReceive('get')->once()->andReturn($BUNDLE);
     // $this->_doProductReplication($bundle);
     $this->obj->shouldReceive('_doProductReplication')->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\ProductsFromOdoo();
     $req->setOdooIds($PROD_ID_ODOO);
     $res = $this->obj->productsFromOdoo($req);
     $this->assertTrue($res->isSucceed());
 }
开发者ID:praxigento,项目名称:mobi_mod_mage2_odoo,代码行数:26,代码来源:Call_Test.php

示例3: 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());
 }
开发者ID:praxigento,项目名称:mobi_mod_mage2_downline,代码行数:43,代码来源:Call_Test.php


注:本文中的Call::shouldReceive方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。