41 $this->gridAggregatorMock = $this->getMockBuilder(\
Magento\Sales\Model\
ResourceModel\GridInterface::class)
42 ->getMockForAbstractClass();
43 $this->eventObserverMock = $this->getMockBuilder(\
Magento\Framework\Event\Observer::class)
44 ->disableOriginalConstructor()
52 $this->salesModelMock = $this->getMockBuilder(\
Magento\Sales\Model\AbstractModel::class)
53 ->disableOriginalConstructor()
59 ->getMockForAbstractClass();
60 $this->scopeConfigurationMock = $this->getMockBuilder(\
Magento\Framework\
App\Config\ScopeConfigInterface::class)
61 ->getMockForAbstractClass();
63 $this->unit = new \Magento\Sales\Observer\GridSyncInsertObserver(
64 $this->gridAggregatorMock,
65 $this->scopeConfigurationMock
71 $this->eventObserverMock->expects($this->once())
73 ->willReturn($this->salesModelMock);
74 $this->salesModelMock->expects($this->once())
76 ->willReturn(
'sales-id-value');
77 $this->scopeConfigurationMock->expects($this->once())
79 ->with(
'dev/grid/async_indexing',
'default',
null)
81 $this->gridAggregatorMock->expects($this->once())
83 ->with(
'sales-id-value');
84 $this->unit->execute($this->eventObserverMock);
89 $this->scopeConfigurationMock->expects($this->once())
91 ->with(
'dev/grid/async_indexing',
'default',
null)
93 $this->gridAggregatorMock->expects($this->never())
95 ->with(
'sales-id-value');
96 $this->unit->execute($this->eventObserverMock);