Skip to content

Commit d08080b

Browse files
author
Magento CICD
authored
merge magento/2.3-develop into magento-tsg/2.3-develop-pr8
2 parents bacc5b0 + 5a7c3bd commit d08080b

File tree

9 files changed

+152
-18
lines changed

9 files changed

+152
-18
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/Catalog/Section/AdminProductFormSection.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
<element name="productQuantity" type="input" selector=".admin__field[data-index=qty] input"/>
1818
<element name="productStockStatus" type="select" selector="select[name='product[quantity_and_stock_status][is_in_stock]']"/>
1919
<element name="productWeight" type="input" selector=".admin__field[data-index=weight] input"/>
20-
<element name="contentTab" type="button" selector="//strong[@class='admin__collapsible-title']/span[text()='Content']"/>
20+
<element name="contentTab" type="button" selector="//strong[contains(@class, 'admin__collapsible-title')]/span[text()='Content']"/>
2121
<element name="fieldError" type="text" selector="//input[@name='product[{{fieldName}}]']/following-sibling::label[@class='admin__field-error']" parameterized="true"/>
2222
<element name="priceFieldError" type="text" selector="//input[@name='product[price]']/parent::div/parent::div/label[@class='admin__field-error']"/>
2323
<element name="addAttributeBtn" type="button" selector="#addAttribute"/>
2424
<element name="createNewAttributeBtn" type="button" selector="button[data-index='add_new_attribute_button']"/>
2525
<element name="save" type="button" selector="#save"/>
26-
<element name="attributeTab" type="button" selector="//strong[@class='admin__collapsible-title']/span[text()='Attributes']"/>
26+
<element name="attributeTab" type="button" selector="//strong[contains(@class, 'admin__collapsible-title')]/span[text()='Attributes']"/>
2727
<element name="attributeLabel" type="input" selector="//input[@name='frontend_label[0]']"/>
2828
<element name="frontendInput" type="select" selector="select[name = 'frontend_input']"/>
2929
<element name="productFormTab" type="button" selector="//strong[@class='admin__collapsible-title']/span[contains(text(), '{{tabName}}')]" parameterized="true"/>

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,43 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\CatalogSearch\Model\Indexer\Fulltext\Action;
9+
10+
class DataProviderTest extends \PHPUnit\Framework\TestCase
11+
{
12+
/**
13+
* @magentoDataFixture Magento/CatalogSearch/_files/product_for_search.php
14+
* @magentoDbIsolation disabled
15+
*/
16+
public function testSearchProductByAttribute()
17+
{
18+
/** @var $objectManager \Magento\TestFramework\ObjectManager */
19+
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
20+
21+
$config = $objectManager->create(\Magento\Framework\Search\Request\Config::class);
22+
/** @var \Magento\Framework\Search\Request\Builder $requestBuilder */
23+
$requestBuilder = $objectManager->create(
24+
\Magento\Framework\Search\Request\Builder::class,
25+
['config' => $config]
26+
);
27+
$requestBuilder->bind('search_term', 'VALUE1');
28+
$requestBuilder->setRequestName('quick_search_container');
29+
$queryRequest = $requestBuilder->create();
30+
/** @var \Magento\Framework\Search\Adapter\Mysql\Adapter $adapter */
31+
$adapter = $objectManager->create(\Magento\Framework\Search\Adapter\Mysql\Adapter::class);
32+
$queryResponse = $adapter->query($queryRequest);
33+
$actualIds = [];
34+
foreach ($queryResponse as $document) {
35+
/** @var \Magento\Framework\Api\Search\Document $document */
36+
$actualIds[] = $document->getId();
37+
}
38+
39+
/** @var \Magento\Catalog\Model\Product $product */
40+
$product = $objectManager->create(\Magento\Catalog\Model\ProductRepository::class)->get('simple');
41+
$this->assertContains($product->getId(), $actualIds, 'Product not found by searchable attribute.');
42+
}
43+
}

dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Indexer/FulltextTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\CatalogSearch\Model\Indexer;
79

810
use Magento\Catalog\Model\Product;
@@ -183,7 +185,7 @@ public function testReindexRowAfterDelete()
183185
* @param string $text
184186
* @return Product[]
185187
*/
186-
protected function search($text)
188+
protected function search($text): array
187189
{
188190
$query = $this->queryFactory->get();
189191
$query->unsetData();
@@ -209,7 +211,7 @@ protected function search($text)
209211
* @param string $sku
210212
* @return Product
211213
*/
212-
protected function getProductBySku($sku)
214+
protected function getProductBySku($sku): Product
213215
{
214216
/** @var Product $product */
215217
$product = Bootstrap::getObjectManager()->get(
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
require 'searchable_attribute.php';
9+
require __DIR__ . '/../../../Magento/Catalog/_files/product_simple.php';
10+
11+
/** @var $objectManager \Magento\TestFramework\ObjectManager */
12+
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
13+
14+
/** @var \Magento\Store\Model\StoreManager $storeManager */
15+
$storeManager = $objectManager->get(\Magento\Store\Model\StoreManager::class);
16+
$storeManager->setIsSingleStoreModeAllowed(false);
17+
/** @var \Magento\Store\Model\Store $store */
18+
$store = $storeManager->getStore('default');
19+
20+
/** @var \Magento\Catalog\Model\Product $product */
21+
$product = $objectManager->create(\Magento\Catalog\Model\ProductRepository::class)->get('simple');
22+
/** @var \Magento\Catalog\Model\Product\Action $productAction */
23+
$productAction = $objectManager->create(\Magento\Catalog\Model\Product\Action::class);
24+
$productAction->updateAttributes([$product->getId()], ['test_searchable_attribute' => 'VALUE1'], $store->getId());
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
/** @var $objectManager \Magento\TestFramework\ObjectManager */
9+
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
10+
$registry = $objectManager->get(\Magento\Framework\Registry::class);
11+
12+
$registry->unregister('isSecureArea');
13+
$registry->register('isSecureArea', true);
14+
15+
/** @var \Magento\Catalog\Model\Product $product */
16+
$product = $objectManager->create(\Magento\Catalog\Model\ProductRepository::class)->get('simple');
17+
/** @var \Magento\Catalog\Model\ResourceModel\Product $productResource */
18+
$productResource = $objectManager->create(\Magento\Catalog\Model\ResourceModel\Product::class);
19+
$productResource->delete($product);
20+
21+
$eavSetupFactory = $objectManager->create(\Magento\Eav\Setup\EavSetupFactory::class);
22+
/** @var \Magento\Eav\Setup\EavSetup $eavSetup */
23+
$eavSetup = $eavSetupFactory->create();
24+
$eavSetup->removeAttribute(\Magento\Catalog\Model\Product::ENTITY, 'test_searchable_attribute');
25+
26+
$registry->unregister('isSecureArea');
27+
$registry->register('isSecureArea', false);
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
9+
$eavSetupFactory = $objectManager->create(\Magento\Eav\Setup\EavSetupFactory::class);
10+
/** @var \Magento\Eav\Setup\EavSetup $eavSetup */
11+
$eavSetup = $eavSetupFactory->create();
12+
$eavSetup->addAttribute(
13+
\Magento\Catalog\Model\Product::ENTITY,
14+
'test_searchable_attribute',
15+
[
16+
'label' => 'Test-attribute',
17+
'global' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_STORE,
18+
'required' => 0,
19+
'user_defined' => 1,
20+
'searchable' => 1,
21+
'visible_on_front' => 1,
22+
'filterable_in_search' => 1,
23+
'used_in_product_listing' => 1,
24+
'is_used_in_grid' => 1,
25+
'is_filterable_in_grid' => 1,
26+
]
27+
);

0 commit comments

Comments
 (0)