public function testExecute() { $date = $this->setupAggregate(); $invoicedMock = $this->getMockBuilder('Magento\\Sales\\Model\\ResourceModel\\Report\\Invoiced')->disableOriginalConstructor()->getMock(); $invoicedMock->expects($this->once())->method('aggregate')->with($date); $this->invoicedFactoryMock->expects($this->once())->method('create')->will($this->returnValue($invoicedMock)); $this->observer->execute(); }
/** * Refresh sales invoiced report statistics for last day * * @return void */ public function execute() { $this->localeResolver->emulate(0); $currentDate = $this->localeDate->date(); $date = $currentDate->sub(new \DateInterval('PT25H')); $this->invoicedFactory->create()->aggregate($date); $this->localeResolver->revert(); }