/**
  * Refresh sales coupons report statistics for last day
  *
  * @return $this
  */
 public function aggregateSalesReportCouponsData()
 {
     $this->_localeResolver->emulate(0);
     $currentDate = $this->_localeDate->date();
     $date = $currentDate->modify('-25 hours');
     $this->_reportRule->aggregate($date);
     $this->_localeResolver->revert();
     return $this;
 }
 public function testAggregateSalesReportCouponsData()
 {
     $data = new \DateTime();
     $this->localeResolver->expects($this->once())->method('emulate')->with(0);
     $this->localeDate->expects($this->once())->method('date')->will($this->returnValue($data));
     $this->reportRule->expects($this->once())->method('aggregate')->with($data);
     $this->localeResolver->expects($this->once())->method('revert');
     $this->assertEquals($this->model, $this->model->aggregateSalesReportCouponsData());
 }
Exemple #3
0
 public function testAggregateSalesReportCouponsData()
 {
     $dateMock = $this->getMock('Magento\\Framework\\Stdlib\\DateTime\\DateInterface', [], [], '', false);
     $this->localeResolver->expects($this->once())->method('emulate')->with(0);
     $this->localeDate->expects($this->once())->method('date')->will($this->returnValue($dateMock));
     $dateMock->expects($this->once())->method('subHour')->with(25)->will($this->returnSelf());
     $this->reportRule->expects($this->once())->method('aggregate')->with($dateMock);
     $this->localeResolver->expects($this->once())->method('revert');
     $this->assertEquals($this->model, $this->model->aggregateSalesReportCouponsData());
 }