Пример #1
0
 public function testExecute()
 {
     $date = $this->setupAggregate();
     $orderMock = $this->getMockBuilder('Magento\\Sales\\Model\\Resource\\Report\\Order')->disableOriginalConstructor()->getMock();
     $orderMock->expects($this->once())->method('aggregate')->with($date);
     $this->orderFactoryMock->expects($this->once())->method('create')->will($this->returnValue($orderMock));
     $this->observer->execute();
 }
Пример #2
0
 /**
  * @param int $useAggregatedData
  * @param string $mainTable
  * @param int $isFilter
  * @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $getIfNullSqlResult
  * @dataProvider useAggregatedDataDataProvider
  * @return void
  */
 public function testPrepareSummary($useAggregatedData, $mainTable, $isFilter, $getIfNullSqlResult)
 {
     $range = '';
     $customStart = 1;
     $customEnd = 10;
     $this->scopeConfigMock->expects($this->once())->method('getValue')->with('sales/dashboard/use_aggregated_data', \Magento\Store\Model\ScopeInterface::SCOPE_STORE)->willReturn($useAggregatedData);
     $orderMock = $this->getMockBuilder('Magento\\Sales\\Model\\Resource\\Report\\Order')->disableOriginalConstructor()->getMock();
     $this->orderFactoryMock->expects($this->any())->method('create')->willReturn($orderMock);
     $this->resourceMock->expects($this->at(0))->method('getTable')->with($mainTable);
     $this->dbMock->expects($getIfNullSqlResult)->method('getIfNullSql');
     $this->collection->prepareSummary($range, $customStart, $customEnd, $isFilter);
 }