/**
  * @param Request\GetForDependentCalc $request
  *
  * @return Response\GetForDependentCalc
  */
 public function getForDependentCalc(Request\GetForDependentCalc $request)
 {
     // $result = new Response\GetForDependentCalc();
     $depCalcTypeCode = $request->getDependentCalcTypeCode();
     $baseCalcTypeCode = $request->getBaseCalcTypeCode();
     $this->_logger->info("'Get latest period for Dependent Calculation' operation is started " . "(dependent={$depCalcTypeCode}, base={$baseCalcTypeCode}).");
     $result = $this->_subBasedCalcs->getDependentCalcData($depCalcTypeCode, $baseCalcTypeCode);
     $this->_logger->info("'Get latest period for Dependent Calculation' operation is completed.");
     return $result;
 }
 public function test_getDependentCalcData_noBasePeriod()
 {
     /** === Test Data === */
     $CALC_CODE_BASE = Cfg::CODE_TYPE_CALC_VALUE_TV;
     $CALC_CODE_DEPEND = Cfg::CODE_TYPE_CALC_BONUS_TEAM_DEF;
     $CALC_ID_BASE = 4;
     $CALC_ID_DEPEND = 16;
     /** === Mocks === */
     $mLogger = $this->_mockLogger();
     $mToolbox = $this->_mockToolbox();
     $mSubDb = $this->_mockFor('\\Praxigento\\Bonus\\Hybrid\\Lib\\Service\\Period\\Sub\\Db');
     // $dependentCalcTypeId = $this->_subDb->getCalcIdByCode($dependentCalcTypeCode);
     $mSubDb->expects($this->at(0))->method('getCalcIdByCode')->willReturn($CALC_ID_DEPEND);
     // $baseCalcTypeId = $this->_subDb->getCalcIdByCode($baseCalcTypeCode);
     $mSubDb->expects($this->at(1))->method('getCalcIdByCode')->willReturn($CALC_ID_BASE);
     // $respBasePeriod = $this->_subDb->getLastPeriodData($baseCalcTypeId);
     $mRespBasePeriod = new BasePeriodGetLatestResponse();
     $mSubDb->expects($this->once())->method('getLastPeriodData')->with($CALC_ID_BASE)->willReturn($mRespBasePeriod);
     /**
      * Prepare request and perform call.
      */
     /** @var  $sub BasedCalcs */
     $sub = new BasedCalcs($mLogger, $mToolbox, $mSubDb);
     $resp = $sub->getDependentCalcData($CALC_CODE_DEPEND, $CALC_CODE_BASE);
     $this->assertFalse($resp->isSucceed());
 }