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()); }