/**
  * @param $file
  *
  * @param $withOperatorOperation
  * @param $transactionRegex
  * @param $debitedAmounts
  * @return array
  */
 protected function setOrderTestAssertion($file, $withOperatorOperation = true, $transactionRegex = null, $debitedAmounts = array(2001 => 5000))
 {
     $this->setOrderTestProphecy($file, $withOperatorOperation);
     $operations = $this->cashoutInitializer->handlePaymentVoucher("000001", $debitedAmounts, new DateTime(), $transactionRegex);
     $this->assertInternalType("array", $operations);
     $this->assertContainsOnly("\\HiPay\\Wallet\\Mirakl\\Cashout\\Model\\Operation\\OperationInterface", $operations);
     return $operations;
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $cronDate = new DateTime($input->getOption(self::CRON_DATE));
     $cronDate->setTime($this->cycleHour, $this->cycleMinute);
     $transactionFilterRegex = $input->getOption(self::TRANSACTION_FILTER_REGEX);
     $cycleDate = $input->getArgument(self::CYCLE_DATE);
     $cycleDate = $cycleDate ? new DateTime($cycleDate) : $this->getCycleDate($this->cycleDays, $cronDate);
     $cycleStartDate = clone $cycleDate;
     $intervalBefore = DateInterval::createFromDateString($input->getOption(self::INTERVAL_BEFORE));
     $cycleStartDate->sub($intervalBefore);
     $cycleEndDate = clone $cycleDate;
     $intervalAfter = DateInterval::createFromDateString($input->getOption(self::INTERVAL_AFTER));
     $cycleEndDate->add($intervalAfter);
     $format = '%y years %m months %d days %h hours %m minutes %i seconds';
     $this->logger->debug("Arguments : \n" . "Cycle date : {$cycleDate->format('Y-m-d H:i')}\n" . "Interval before : {$intervalBefore->format($format)}\n" . "Interval after : {$intervalAfter->format($format)}\n", array('cycleDate' => $cycleDate, 'intervalBefore' => $intervalBefore, 'intervalAfter' => $intervalAfter));
     try {
         $this->processor->process($cycleStartDate, $cycleEndDate, $cycleDate, $transactionFilterRegex);
     } catch (Exception $e) {
         $this->logger->critical($e->getMessage());
     }
 }