Skip to content

Commit c78a5a6

Browse files
author
Jakub Winkler
committed
#33486 - final test fix, fixing typo in SourceTest.php file
1 parent 82f040f commit c78a5a6

File tree

2 files changed

+12
-10
lines changed
  • app/code/Magento/Eav/Model/ResourceModel/Entity
  • dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Product/Indexer/Eav

2 files changed

+12
-10
lines changed

app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ private function clearSelectedOptionInEntities(AbstractModel $object, int $optio
523523
$where = $connection->quoteInto('attribute_id = ?', $attributeId);
524524
$update = [];
525525

526-
if ($object->getBackendType() === 'varchar') {
526+
if ($object->getBackendType() === 'text') {
527527
$where.= ' AND ' . $connection->prepareSqlCondition('value', ['finset' => $optionId]);
528528
$concat = $connection->getConcatSql(["','", 'value', "','"]);
529529
$expr = $connection->quoteInto(

dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Product/Indexer/Eav/SourceTest.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function testReindexEntitiesForConfigurableProduct()
6969

7070
/** @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attr **/
7171
$attr = Bootstrap::getObjectManager()->get(\Magento\Eav\Model\Config::class)
72-
->getAttribute('catalog_product', 'test_configurable');
72+
->getAttribute('catalog_product', 'test_configurable');
7373
$attr->setIsFilterable(1)->save();
7474

7575
$this->_eavIndexerProcessor->reindexAll();
@@ -133,28 +133,31 @@ public function testReindexMultiselectAttribute()
133133

134134
/** @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attr **/
135135
$attr = $objectManager->get(\Magento\Eav\Model\Config::class)
136-
->getAttribute('catalog_product', 'multiselect_attribute');
136+
->getAttribute('catalog_product', 'multiselect_attribute');
137137

138138
/** @var $options \Magento\Eav\Model\ResourceModel\Entity\Attribute\Option\Collection */
139139
$options = $objectManager->create(\Magento\Eav\Model\ResourceModel\Entity\Attribute\Option\Collection::class);
140140
$options->setAttributeFilter($attr->getId());
141+
$optionIds = $options->getAllIds();
142+
$product1Id = $optionIds[0] * 10;
143+
$product2Id = $optionIds[1] * 10;
141144

142145
/** @var \Magento\Catalog\Model\Product $product1 **/
143-
$product1 = $productRepository->get('simple_ms_1');
146+
$product1 = $productRepository->getById($product1Id);
144147
$product1->setSpecialFromDate(date('Y-m-d H:i:s'));
145148
$product1->setNewsFromDate(date('Y-m-d H:i:s'));
146149
$productRepository->save($product1);
147150

148151
/** @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'));
152155
$productRepository->save($product2);
153156

154157
$this->_eavIndexerProcessor->reindexAll();
155158
$connection = $this->productResource->getConnection();
156159
$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])
158161
->where('attribute_id = ?', $attr->getId());
159162

160163
$result = $connection->fetchAll($select);
@@ -210,13 +213,12 @@ public function testReindexMultiselectAttributeWithSourceModel()
210213

211214
/** @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attr **/
212215
$attr = $objectManager->get(\Magento\Eav\Model\Config::class)
213-
->getAttribute('catalog_product', 'multiselect_attr_with_source');
216+
->getAttribute('catalog_product', 'multiselect_attr_with_source');
214217

215218
/** @var $sourceModel MultiselectSourceMock */
216219
$sourceModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
217220
MultiselectSourceMock::class
218221
);
219-
220222
$options = $sourceModel->getAllOptions();
221223
$product1Id = $options[0]['value'] * 10;
222224
$product2Id = $options[1]['value'] * 10;

0 commit comments

Comments
 (0)