public function testExecute()
 {
     $date = $this->setupAggregate();
     $bestsellersMock = $this->getMockBuilder('Magento\\Sales\\Model\\Resource\\Report\\Bestsellers')->disableOriginalConstructor()->getMock();
     $bestsellersMock->expects($this->once())->method('aggregate')->with($date);
     $this->bestsellersFactoryMock->expects($this->once())->method('create')->will($this->returnValue($bestsellersMock));
     $this->observer->execute();
 }
 /**
  * Refresh bestsellers 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->bestsellersFactory->create()->aggregate($date);
     $this->localeResolver->revert();
 }
 /**
  * Refresh bestsellers report statistics for last day
  *
  * @return void
  */
 public function execute()
 {
     $this->localeResolver->emulate(0);
     $currentDate = $this->localeDate->date();
     $date = $currentDate->subHour(25);
     $this->bestsellersFactory->create()->aggregate($date);
     $this->localeResolver->revert();
 }
Exemplo n.º 4
0
 /**
  * Refresh bestsellers report statistics for last day
  *
  * @param \Magento\Cron\Model\Schedule $schedule
  * @return $this
  */
 public function aggregateSalesReportBestsellersData($schedule)
 {
     $this->_localeResolver->emulate(0);
     $currentDate = $this->_localeDate->date();
     $date = $currentDate->subHour(25);
     $this->_bestsellersFactory->create()->aggregate($date);
     $this->_localeResolver->revert();
     return $this;
 }