@@ -69,7 +69,7 @@ public function testReindexEntitiesForConfigurableProduct()
69
69
70
70
/** @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attr **/
71
71
$ attr = Bootstrap::getObjectManager ()->get (\Magento \Eav \Model \Config::class)
72
- ->getAttribute ('catalog_product ' , 'test_configurable ' );
72
+ ->getAttribute ('catalog_product ' , 'test_configurable ' );
73
73
$ attr ->setIsFilterable (1 )->save ();
74
74
75
75
$ this ->_eavIndexerProcessor ->reindexAll ();
@@ -133,28 +133,31 @@ public function testReindexMultiselectAttribute()
133
133
134
134
/** @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attr **/
135
135
$ attr = $ objectManager ->get (\Magento \Eav \Model \Config::class)
136
- ->getAttribute ('catalog_product ' , 'multiselect_attribute ' );
136
+ ->getAttribute ('catalog_product ' , 'multiselect_attribute ' );
137
137
138
138
/** @var $options \Magento\Eav\Model\ResourceModel\Entity\Attribute\Option\Collection */
139
139
$ options = $ objectManager ->create (\Magento \Eav \Model \ResourceModel \Entity \Attribute \Option \Collection::class);
140
140
$ options ->setAttributeFilter ($ attr ->getId ());
141
+ $ optionIds = $ options ->getAllIds ();
142
+ $ product1Id = $ optionIds [0 ] * 10 ;
143
+ $ product2Id = $ optionIds [1 ] * 10 ;
141
144
142
145
/** @var \Magento\Catalog\Model\Product $product1 **/
143
- $ product1 = $ productRepository ->get ( ' simple_ms_1 ' );
146
+ $ product1 = $ productRepository ->getById ( $ product1Id );
144
147
$ product1 ->setSpecialFromDate (date ('Y-m-d H:i:s ' ));
145
148
$ product1 ->setNewsFromDate (date ('Y-m-d H:i:s ' ));
146
149
$ productRepository ->save ($ product1 );
147
150
148
151
/** @var \Magento\Catalog\Model\Product $product2 **/
149
- $ product2 = $ productRepository ->get ( ' simple_ms_2 ' );
150
- $ product2 ->setSpecialFromDate (date ('Y-m-d H:i:s ' ));
151
- $ product2 ->setNewsFromDate (date ('Y-m-d H:i:s ' ));
152
+ $ product2 = $ productRepository ->getById ( $ product2Id );
153
+ $ product1 ->setSpecialFromDate (date ('Y-m-d H:i:s ' ));
154
+ $ product1 ->setNewsFromDate (date ('Y-m-d H:i:s ' ));
152
155
$ productRepository ->save ($ product2 );
153
156
154
157
$ this ->_eavIndexerProcessor ->reindexAll ();
155
158
$ connection = $ this ->productResource ->getConnection ();
156
159
$ select = $ connection ->select ()->from ($ this ->productResource ->getTable ('catalog_product_index_eav ' ))
157
- ->where ('entity_id in (?) ' , [$ product1 -> getId () , $ product2 -> getId () ])
160
+ ->where ('entity_id in (?) ' , [$ product1Id , $ product2Id ])
158
161
->where ('attribute_id = ? ' , $ attr ->getId ());
159
162
160
163
$ result = $ connection ->fetchAll ($ select );
@@ -210,13 +213,12 @@ public function testReindexMultiselectAttributeWithSourceModel()
210
213
211
214
/** @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attr **/
212
215
$ attr = $ objectManager ->get (\Magento \Eav \Model \Config::class)
213
- ->getAttribute ('catalog_product ' , 'multiselect_attr_with_source ' );
216
+ ->getAttribute ('catalog_product ' , 'multiselect_attr_with_source ' );
214
217
215
218
/** @var $sourceModel MultiselectSourceMock */
216
219
$ sourceModel = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ()->create (
217
220
MultiselectSourceMock::class
218
221
);
219
-
220
222
$ options = $ sourceModel ->getAllOptions ();
221
223
$ product1Id = $ options [0 ]['value ' ] * 10 ;
222
224
$ product2Id = $ options [1 ]['value ' ] * 10 ;
0 commit comments