Skip to content

Commit

Permalink
#33486 - final test fix, fixing typo in SourceTest.php file
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Winkler committed Sep 18, 2021
1 parent 82f040f commit c78a5a6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Expand Up @@ -523,7 +523,7 @@ private function clearSelectedOptionInEntities(AbstractModel $object, int $optio
$where = $connection->quoteInto('attribute_id = ?', $attributeId);
$update = [];

if ($object->getBackendType() === 'varchar') {
if ($object->getBackendType() === 'text') {
$where.= ' AND ' . $connection->prepareSqlCondition('value', ['finset' => $optionId]);
$concat = $connection->getConcatSql(["','", 'value', "','"]);
$expr = $connection->quoteInto(
Expand Down
Expand Up @@ -69,7 +69,7 @@ public function testReindexEntitiesForConfigurableProduct()

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

$this->_eavIndexerProcessor->reindexAll();
Expand Down Expand Up @@ -133,28 +133,31 @@ public function testReindexMultiselectAttribute()

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

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

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

/** @var \Magento\Catalog\Model\Product $product2 **/
$product2 = $productRepository->get('simple_ms_2');
$product2->setSpecialFromDate(date('Y-m-d H:i:s'));
$product2->setNewsFromDate(date('Y-m-d H:i:s'));
$product2 = $productRepository->getById($product2Id);
$product1->setSpecialFromDate(date('Y-m-d H:i:s'));
$product1->setNewsFromDate(date('Y-m-d H:i:s'));
$productRepository->save($product2);

$this->_eavIndexerProcessor->reindexAll();
$connection = $this->productResource->getConnection();
$select = $connection->select()->from($this->productResource->getTable('catalog_product_index_eav'))
->where('entity_id in (?)', [$product1->getId(), $product2->getId()])
->where('entity_id in (?)', [$product1Id, $product2Id])
->where('attribute_id = ?', $attr->getId());

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

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

/** @var $sourceModel MultiselectSourceMock */
$sourceModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
MultiselectSourceMock::class
);

$options = $sourceModel->getAllOptions();
$product1Id = $options[0]['value'] * 10;
$product2Id = $options[1]['value'] * 10;
Expand Down

0 comments on commit c78a5a6

Please sign in to comment.