Skip to content

Commit 0f778c7

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-72863' into PANDA-FIXES-2.3
2 parents 2f6cb7d + 631c7be commit 0f778c7

File tree

7 files changed

+141
-14
lines changed

7 files changed

+141
-14
lines changed

app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/DataProvider.php

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -414,28 +414,40 @@ public function getProductAttributes($storeId, array $productIds, array $attribu
414414
foreach ($attributeTypes as $backendType => $attributeIds) {
415415
if ($attributeIds) {
416416
$tableName = $this->getTable('catalog_product_entity_' . $backendType);
417-
$selects[] = $this->connection->select()->from(
418-
['t_default' => $tableName],
419-
[$linkField, 'attribute_id']
417+
418+
$select = $this->connection->select()->from(
419+
['t' => $tableName],
420+
[
421+
$linkField => 't.' . $linkField,
422+
'attribute_id' => 't.attribute_id',
423+
'value' => $this->unifyField($ifStoreValue, $backendType),
424+
]
420425
)->joinLeft(
421426
['t_store' => $tableName],
422427
$this->connection->quoteInto(
423-
't_default.' . $linkField . '=t_store.' . $linkField .
424-
' AND t_default.attribute_id=t_store.attribute_id' .
428+
't.' . $linkField . '=t_store.' . $linkField .
429+
' AND t.attribute_id=t_store.attribute_id' .
425430
' AND t_store.store_id = ?',
426431
$storeId
427432
),
428-
['value' => $this->unifyField($ifStoreValue, $backendType)]
429-
)->where(
430-
't_default.store_id = ?',
431-
0
433+
[]
434+
)->joinLeft(
435+
['t_default' => $tableName],
436+
$this->connection->quoteInto(
437+
't.' . $linkField . '=t_default.' . $linkField .
438+
' AND t.attribute_id=t_default.attribute_id' .
439+
' AND t_default.store_id = ?',
440+
0
441+
),
442+
[]
432443
)->where(
433-
't_default.attribute_id IN (?)',
444+
't.attribute_id IN (?)',
434445
$attributeIds
435446
)->where(
436-
't_default.' . $linkField . ' IN (?)',
447+
't.' . $linkField . ' IN (?)',
437448
array_keys($productLinkFieldsToEntityIdMap)
438-
);
449+
)->distinct();
450+
$selects[] = $select;
439451
}
440452
}
441453

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/ActionGroup/VerifyTinyMCEActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
99
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
1010
<actionGroup name="VerifyTinyMCEActionGroup">
11-
<waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE" />
11+
<waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE" time="30" />
1212
<seeElement selector="{{TinyMCESection.TinyMCE4}}" stepKey="seeTinyMCE4" />
1313
<seeElement selector="{{TinyMCESection.Style}}" stepKey="assertInfo2"/>
1414
<seeElement selector="{{TinyMCESection.Bold}}" stepKey="assertInfo3"/>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterCest.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
<fillField selector="{{BasicFieldNewsletterSection.templateSubject}}" userInput="{{_defaultNewsletter.subject}}" stepKey="fillTemplateSubject" />
2929
<fillField selector="{{BasicFieldNewsletterSection.senderName}}" userInput="{{_defaultNewsletter.senderName}}" stepKey="fillSenderName" />
3030
<fillField selector="{{BasicFieldNewsletterSection.senderEmail}}" userInput="{{_defaultNewsletter.senderEmail}}" stepKey="fillSenderEmail" />
31-
<waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE" />
3231
<actionGroup ref="VerifyTinyMCEActionGroup" stepKey="verifyTinyMCE4"/>
3332
<actionGroup ref="VerifyMagentoEntityActionGroup" stepKey="verifyMagentoEntities"/>
3433
<executeJS function="tinyMCE.get('text').setContent('Hello World From Newsletter Template!');" stepKey="executeJSFillContent"/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\CatalogSearch\Model\Indexer\Fulltext\Action;
7+
8+
class DataProviderTest extends \PHPUnit\Framework\TestCase
9+
{
10+
/**
11+
* @magentoDataFixture Magento/CatalogSearch/_files/product_for_search.php
12+
* @magentoDbIsolation disabled
13+
*/
14+
public function testSearchProductByAttribute()
15+
{
16+
/** @var $objectManager \Magento\TestFramework\ObjectManager */
17+
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
18+
19+
$config = $objectManager->create(\Magento\Framework\Search\Request\Config::class);
20+
/** @var \Magento\Framework\Search\Request\Builder $requestBuilder */
21+
$requestBuilder = $objectManager->create(
22+
\Magento\Framework\Search\Request\Builder::class,
23+
['config' => $config]
24+
);
25+
$requestBuilder->bind('search_term', 'VALUE1');
26+
$requestBuilder->setRequestName('quick_search_container');
27+
$queryRequest = $requestBuilder->create();
28+
/** @var \Magento\Framework\Search\Adapter\Mysql\Adapter $adapter */
29+
$adapter = $objectManager->create(\Magento\Framework\Search\Adapter\Mysql\Adapter::class);
30+
$queryResponse = $adapter->query($queryRequest);
31+
$actualIds = [];
32+
foreach ($queryResponse as $document) {
33+
/** @var \Magento\Framework\Api\Search\Document $document */
34+
$actualIds[] = $document->getId();
35+
}
36+
37+
/** @var \Magento\Catalog\Model\Product $product */
38+
$product = $objectManager->create(\Magento\Catalog\Model\ProductRepository::class)->get('simple');
39+
$this->assertContains($product->getId(), $actualIds, 'Product not found by searchable attribute.');
40+
}
41+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
require 'searchable_attribute.php';
8+
require __DIR__ . '/../../../Magento/Catalog/_files/product_simple.php';
9+
10+
/** @var $objectManager \Magento\TestFramework\ObjectManager */
11+
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
12+
13+
/** @var \Magento\Store\Model\StoreManager $storeManager */
14+
$storeManager = $objectManager->get(\Magento\Store\Model\StoreManager::class);
15+
$storeManager->setIsSingleStoreModeAllowed(false);
16+
/** @var \Magento\Store\Model\Store $store */
17+
$store = $storeManager->getStore('default');
18+
19+
/** @var \Magento\Catalog\Model\Product $product */
20+
$product = $objectManager->create(\Magento\Catalog\Model\ProductRepository::class)->get('simple');
21+
/** @var \Magento\Catalog\Model\Product\Action $productAction */
22+
$productAction = $objectManager->create(\Magento\Catalog\Model\Product\Action::class);
23+
$productAction->updateAttributes([$product->getId()], ['test_searchable_attribute' => 'VALUE1'], $store->getId());
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
/** @var $objectManager \Magento\TestFramework\ObjectManager */
8+
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
9+
$registry = $objectManager->get(\Magento\Framework\Registry::class);
10+
11+
$registry->unregister('isSecureArea');
12+
$registry->register('isSecureArea', true);
13+
14+
/** @var \Magento\Catalog\Model\Product $product */
15+
$product = $objectManager->create(\Magento\Catalog\Model\ProductRepository::class)->get('simple');
16+
/** @var \Magento\Catalog\Model\ResourceModel\Product $productResource */
17+
$productResource = $objectManager->create(\Magento\Catalog\Model\ResourceModel\Product::class);
18+
$productResource->delete($product);
19+
20+
$eavSetupFactory = $objectManager->create(\Magento\Eav\Setup\EavSetupFactory::class);
21+
/** @var \Magento\Eav\Setup\EavSetup $eavSetup */
22+
$eavSetup = $eavSetupFactory->create();
23+
$eavSetup->removeAttribute(\Magento\Catalog\Model\Product::ENTITY, 'test_searchable_attribute');
24+
25+
$registry->unregister('isSecureArea');
26+
$registry->register('isSecureArea', false);
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
8+
$eavSetupFactory = $objectManager->create(\Magento\Eav\Setup\EavSetupFactory::class);
9+
/** @var \Magento\Eav\Setup\EavSetup $eavSetup */
10+
$eavSetup = $eavSetupFactory->create();
11+
$eavSetup->addAttribute(
12+
\Magento\Catalog\Model\Product::ENTITY,
13+
'test_searchable_attribute',
14+
[
15+
'label' => 'Test-attribute',
16+
'global' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_STORE,
17+
'required' => 0,
18+
'user_defined' => 1,
19+
'searchable' => 1,
20+
'visible_on_front' => 1,
21+
'filterable_in_search' => 1,
22+
'used_in_product_listing' => 1,
23+
'is_used_in_grid' => 1,
24+
'is_filterable_in_grid' => 1,
25+
]
26+
);

0 commit comments

Comments
 (0)