@@ -59,6 +59,8 @@ protected function setUp()
59
59
{
60
60
$ objectManager = new ObjectManager ($ this );
61
61
62
+ $ attributeTable = 'catalog_product_entity_int ' ;
63
+ $ statusId = 22 ;
62
64
$ this ->connection = $ this ->createMock (\Magento \Framework \DB \Adapter \AdapterInterface::class);
63
65
$ this ->resource = $ this ->createMock (\Magento \Framework \App \ResourceConnection::class);
64
66
$ this ->resource ->expects ($ this ->any ())->method ('getConnection ' )
@@ -68,9 +70,9 @@ protected function setUp()
68
70
$ this ->store = $ this ->createMock (\Magento \Store \Model \Store::class);
69
71
$ this ->store ->expects ($ this ->any ())->method ('getId ' )->will ($ this ->returnValue ('store_id_1 ' ));
70
72
$ this ->storeManager ->expects ($ this ->any ())->method ('getStores ' )->will ($ this ->returnValue ([$ this ->store ]));
71
- $ this ->productIndexerHelper = $ this ->createMock (\Magento \Catalog \Helper \Product \Flat \Indexer::class);
72
73
$ this ->flatItemEraser = $ this ->createMock (\Magento \Catalog \Model \Indexer \Product \Flat \Action \Eraser::class);
73
74
$ this ->flatItemWriter = $ this ->createMock (\Magento \Catalog \Model \Indexer \Product \Flat \Action \Indexer::class);
75
+ <<<<<<< HEAD
74
76
$ this ->flatTableBuilder = $ this ->createMock (
75
77
\Magento \Catalog \Model \Indexer \Product \Flat \FlatTableBuilder::class
76
78
);
@@ -86,6 +88,46 @@ protected function setUp()
86
88
'flatTableBuilder ' => $ this ->flatTableBuilder
87
89
]
88
90
);
91
+ =======
92
+ $ this ->flatTableBuilder = $ this ->createMock (\Magento \Catalog \Model \Indexer \Product \Flat \FlatTableBuilder::class);
93
+ $ this ->productIndexerHelper = $ this ->createMock (\Magento \Catalog \Helper \Product \Flat \Indexer::class);
94
+ $ statusAttributeMock = $ this ->getMockBuilder (\Magento \Eav \Model \Entity \Attribute::class)
95
+ ->disableOriginalConstructor ()
96
+ ->getMock ();
97
+ $ this ->productIndexerHelper ->expects ($ this ->any ())->method ('getAttribute ' )
98
+ ->with ('status ' )
99
+ ->willReturn ($ statusAttributeMock );
100
+ $ backendMock = $ this ->getMockBuilder (\Magento \Eav \Model \Entity \Attribute \Backend \AbstractBackend::class)
101
+ ->disableOriginalConstructor ()
102
+ ->getMock ();
103
+ $ backendMock ->expects ($ this ->any ())->method ('getTable ' )->willReturn ($ attributeTable );
104
+ $ statusAttributeMock ->expects ($ this ->any ())->method ('getBackend ' )->willReturn (
105
+ $ backendMock
106
+ );
107
+ $ statusAttributeMock ->expects ($ this ->any ())->method ('getId ' )->willReturn ($ statusId );
108
+ $ selectMock = $ this ->getMockBuilder (\Magento \Framework \DB \Select::class)
109
+ ->disableOriginalConstructor ()
110
+ ->getMock ();
111
+ $ this ->connection ->expects ($ this ->any ())->method ('select ' )->willReturn ($ selectMock );
112
+ $ selectMock ->expects ($ this ->any ())->method ('from ' )->with (
113
+ $ attributeTable ,
114
+ ['value ' ]
115
+ )->willReturnSelf ();
116
+ $ selectMock ->expects ($ this ->any ())->method ('where ' )->willReturnSelf ();
117
+ $ pdoMock = $ this ->createMock (\Zend_Db_Statement_Pdo::class);
118
+ $ this ->connection ->expects ($ this ->any ())->method ('query ' )->with ($ selectMock )->will ($ this ->returnValue ($ pdoMock ));
119
+ $ pdoMock ->expects ($ this ->any ())->method ('fetch ' )->will ($ this ->returnValue (['value ' => 1 ]));
120
+
121
+ $ this ->model = $ objectManager ->getObject (
122
+ \Magento \Catalog \Model \Indexer \Product \Flat \Action \Row::class, [
123
+ 'resource ' => $ this ->resource ,
124
+ 'storeManager ' => $ this ->storeManager ,
125
+ 'productHelper ' => $ this ->productIndexerHelper ,
126
+ 'flatItemEraser ' => $ this ->flatItemEraser ,
127
+ 'flatItemWriter ' => $ this ->flatItemWriter ,
128
+ 'flatTableBuilder ' => $ this ->flatTableBuilder ,
129
+ ]);
130
+ >>>>>>> 38 bd9d381bc.. . [TASK ] Updated the Unit Test according to issue-14966
89
131
}
90
132
91
133
/**
0 commit comments