@@ -107,32 +107,42 @@ protected function setUp()
107
107
108
108
public function testBuild ()
109
109
{
110
- list ($ storeId , $ changedIds , $ valueFieldSuffix , $ tableDropSuffix , $ fillTmpTables ) = [1 , [], '' , '' , true ];
110
+ $ storeId = 1 ;
111
+ $ changedIds = [];
112
+ $ valueFieldSuffix = '_value ' ;
113
+ $ tableDropSuffix = '' ;
114
+ $ fillTmpTables = true ;
111
115
$ tableName = 'catalog_product_entity ' ;
112
116
$ attributeTable = 'catalog_product_entity_int ' ;
113
117
$ temporaryTableName = 'catalog_product_entity_int_tmp_indexer ' ;
114
- $ temporaryValueTableName = 'catalog_product_entity_int_tmp_indexer ' ;
118
+ $ temporaryValueTableName = 'catalog_product_entity_int_tmp_indexer_value ' ;
115
119
$ linkField = 'entity_id ' ;
116
120
$ statusId = 22 ;
121
+ $ eavCustomField = 'space_weight ' ;
122
+ $ eavCustomValueField = $ eavCustomField . $ valueFieldSuffix ;
117
123
$ this ->flatIndexerMock ->expects ($ this ->once ())->method ('getAttributes ' )->willReturn ([]);
118
124
$ this ->flatIndexerMock ->expects ($ this ->exactly (3 ))->method ('getFlatColumns ' )
119
125
->willReturnOnConsecutiveCalls (
120
126
[],
121
- [$ linkField => []],
122
- [$ linkField => []]
127
+ [$ eavCustomValueField => []],
128
+ [$ eavCustomValueField => []]
123
129
);
124
130
$ this ->flatIndexerMock ->expects ($ this ->once ())->method ('getFlatIndexes ' )->willReturn ([]);
125
131
$ statusAttributeMock = $ this ->getMockBuilder (\Magento \Eav \Model \Entity \Attribute::class)
126
132
->disableOriginalConstructor ()
127
133
->getMock ();
134
+ $ eavCustomAttributeMock = $ this ->getMockBuilder (\Magento \Eav \Model \Entity \Attribute::class)
135
+ ->disableOriginalConstructor ()
136
+ ->getMock ();
128
137
$ this ->flatIndexerMock ->expects ($ this ->once ())->method ('getTablesStructure ' )
129
138
->willReturn (
130
139
[
131
140
'catalog_product_entity ' => [
132
141
$ linkField => $ statusAttributeMock
133
142
],
134
143
'catalog_product_entity_int ' => [
135
- $ linkField => $ statusAttributeMock
144
+ $ linkField => $ statusAttributeMock ,
145
+ $ eavCustomField => $ eavCustomAttributeMock
136
146
]
137
147
]
138
148
);
@@ -155,6 +165,9 @@ public function testBuild()
155
165
$ statusAttributeMock ->expects ($ this ->atLeastOnce ())->method ('getBackend ' )->willReturn (
156
166
$ backendMock
157
167
);
168
+ $ eavCustomAttributeMock ->expects ($ this ->atLeastOnce ())->method ('getBackend ' )->willReturn (
169
+ $ backendMock
170
+ );
158
171
$ statusAttributeMock ->expects ($ this ->atLeastOnce ())->method ('getId ' )->willReturn ($ statusId );
159
172
$ tableMock = $ this ->getMockBuilder (\Magento \Framework \DB \Ddl \Table::class)
160
173
->disableOriginalConstructor ()
@@ -185,12 +198,12 @@ public function testBuild()
185
198
[
186
199
$ temporaryTableName ,
187
200
"e. {$ linkField } = {$ temporaryTableName }. {$ linkField }" ,
188
- [$ linkField ]
201
+ [$ linkField, $ eavCustomField ]
189
202
],
190
203
[
191
204
$ temporaryValueTableName ,
192
- "e. {$ linkField } = " . $ temporaryValueTableName . " . {$ linkField }" ,
193
- [$ linkField ]
205
+ "e. {$ linkField } = { $ temporaryValueTableName} . {$ linkField }" ,
206
+ [$ eavCustomValueField ]
194
207
]
195
208
)->willReturnSelf ();
196
209
$ this ->metadataPoolMock ->expects ($ this ->atLeastOnce ())->method ('getMetadata ' )->with (ProductInterface::class)
0 commit comments