/** * Refresh sales coupons report statistics for last day * * @return $this */ public function execute() { $this->_localeResolver->emulate(0); $currentDate = $this->_localeDate->date(); $date = $currentDate->modify('-25 hours'); $this->_reportRule->aggregate($date); $this->_localeResolver->revert(); return $this; }
public function testExecute() { $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'); $scheduleMock = $this->getMock('Magento\\Cron\\Model\\Schedule', [], [], '', false); $this->assertEquals($this->model, $this->model->execute($scheduleMock)); }