Skip to content

Commit 9b1058f

Browse files
committed
Merge branch '2.4-develop' of github.com:magento-commerce/magento2ce into 2.4-develop-prs
Conflicts: lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/FilterProcessor.php
2 parents 0b816c2 + 88745a8 commit 9b1058f

File tree

80 files changed

+3175
-720
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+3175
-720
lines changed

app/code/Magento/AsynchronousOperations/Controller/Adminhtml/Notification/Dismiss.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
use Magento\AsynchronousOperations\Model\BulkNotificationManagement;
99
use Magento\Backend\App\Action\Context;
1010
use Magento\Backend\App\Action;
11+
use Magento\Framework\App\Action\HttpGetActionInterface;
1112
use Magento\Framework\Controller\ResultFactory;
1213

1314
/**
1415
* Class Bulk Notification Dismiss Controller
1516
*/
16-
class Dismiss extends Action
17+
class Dismiss extends Action implements HttpGetActionInterface
1718
{
1819
/**
1920
* @var BulkNotificationManagement
@@ -43,7 +44,7 @@ protected function _isAllowed()
4344
}
4445

4546
/**
46-
* {@inheritdoc}
47+
* @inheritdoc
4748
*/
4849
public function execute()
4950
{
@@ -55,7 +56,7 @@ public function execute()
5556
$isAcknowledged = $this->notificationManagement->acknowledgeBulks($bulkUuids);
5657

5758
/** @var \Magento\Framework\Controller\Result\Json $result */
58-
$result = $this->resultFactory->create(ResultFactory::TYPE_JSON);
59+
$result = $this->resultFactory->create(ResultFactory::TYPE_RAW);
5960
if (!$isAcknowledged) {
6061
$result->setHttpResponseCode(400);
6162
}

app/code/Magento/AsynchronousOperations/Test/Unit/Controller/Adminhtml/Notification/DismissTest.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\AsynchronousOperations\Model\BulkNotificationManagement;
1212
use Magento\Framework\App\RequestInterface;
1313
use Magento\Framework\Controller\Result\Json;
14+
use Magento\Framework\Controller\Result\Raw;
1415
use Magento\Framework\Controller\ResultFactory;
1516
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
1617
use PHPUnit\Framework\MockObject\MockObject;
@@ -43,6 +44,11 @@ class DismissTest extends TestCase
4344
*/
4445
private $jsonResultMock;
4546

47+
/**
48+
* @var MockObject
49+
*/
50+
private $rawResultMock;
51+
4652
protected function setUp(): void
4753
{
4854
$objectManager = new ObjectManager($this);
@@ -78,10 +84,10 @@ public function testExecute()
7884

7985
$this->resultFactoryMock->expects($this->once())
8086
->method('create')
81-
->with(ResultFactory::TYPE_JSON, [])
82-
->willReturn($this->jsonResultMock);
87+
->with(ResultFactory::TYPE_RAW, [])
88+
->willReturn($this->rawResultMock);
8389

84-
$this->assertEquals($this->jsonResultMock, $this->model->execute());
90+
$this->assertEquals($this->rawResultMock, $this->model->execute());
8591
}
8692

8793
public function testExecuteSetsBadRequestResponseStatusIfBulkWasNotAcknowledgedCorrectly()
@@ -95,7 +101,7 @@ public function testExecuteSetsBadRequestResponseStatusIfBulkWasNotAcknowledgedC
95101

96102
$this->resultFactoryMock->expects($this->once())
97103
->method('create')
98-
->with(ResultFactory::TYPE_JSON, [])
104+
->with(ResultFactory::TYPE_RAW, [])
99105
->willReturn($this->jsonResultMock);
100106

101107
$this->notificationManagementMock->expects($this->once())

app/code/Magento/Backend/Test/Mftf/Test/AdminLoginSuccessfulTest.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
<group value="example"/>
2020
<group value="login"/>
2121
</annotations>
22-
23-
2422
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
2523
<actionGroup ref="AssertAdminSuccessLoginActionGroup" stepKey="assertLoggedIn"/>
2624
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>

app/code/Magento/Bundle/Test/Mftf/ActionGroup/SetBundleProductAttributesActionGroup.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
<checkOption selector="{{AdminProductFormBundleSection.dynamicWeightToggle}}" stepKey="dynamicWeight"/>
6161

6262
<!--Weight-->
63+
<scrollTo selector="{{AdminProductFormBundleSection.weightFieldLabel}}" stepKey="scrollToWeight"/>
6364
<fillField selector="{{AdminProductFormBundleSection.weightField}}" userInput="{{weight}}" stepKey="fillIn"/>
6465

6566
<!--Visibility-->

app/code/Magento/Bundle/Test/Mftf/Section/AdminProductFormBundleSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,5 +124,6 @@
124124
<element name="customizableOptionPrice" type="input" selector=".//*[@name='product[options][0][price]']" />
125125
<element name="priceType" type="select" selector="[name='product[options][0][price_type]']" />
126126
<element name="priceTypeSelectPercent" type="select" selector="//*[@name='product[options][0][price_type]']/option[2]" />
127+
<element name="weightFieldLabel" type="input" selector="//div[@data-index='weight']/div/label/span"/>
127128
</section>
128129
</sections>

app/code/Magento/Catalog/Model/Category/AttributeRepository.php

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ class AttributeRepository implements CategoryAttributeRepositoryInterface
2929
*/
3030
private $eavConfig;
3131

32+
/**
33+
* @var array
34+
*/
35+
private $metadataCache;
36+
3237
/**
3338
* @param \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder
3439
* @param \Magento\Framework\Api\FilterBuilder $filterBuilder
@@ -48,7 +53,7 @@ public function __construct(
4853
}
4954

5055
/**
51-
* {@inheritdoc}
56+
* @inheritdoc
5257
*/
5358
public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria)
5459
{
@@ -59,7 +64,7 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCr
5964
}
6065

6166
/**
62-
* {@inheritdoc}
67+
* @inheritdoc
6368
*/
6469
public function get($attributeCode)
6570
{
@@ -70,23 +75,27 @@ public function get($attributeCode)
7075
}
7176

7277
/**
73-
* {@inheritdoc}
78+
* @inheritdoc
79+
*
7480
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
7581
*/
7682
public function getCustomAttributesMetadata($dataObjectClassName = null)
7783
{
78-
$defaultAttributeSetId = $this->eavConfig
79-
->getEntityType(\Magento\Catalog\Api\Data\CategoryAttributeInterface::ENTITY_TYPE_CODE)
80-
->getDefaultAttributeSetId();
81-
$searchCriteria = $this->searchCriteriaBuilder->addFilters(
82-
[
83-
$this->filterBuilder
84-
->setField('attribute_set_id')
85-
->setValue($defaultAttributeSetId)
86-
->create(),
87-
]
88-
);
89-
90-
return $this->getList($searchCriteria->create())->getItems();
84+
if (!isset($this->metadataCache[$dataObjectClassName])) {
85+
$defaultAttributeSetId = $this->eavConfig
86+
->getEntityType(\Magento\Catalog\Api\Data\CategoryAttributeInterface::ENTITY_TYPE_CODE)
87+
->getDefaultAttributeSetId();
88+
$searchCriteria = $this->searchCriteriaBuilder->addFilters(
89+
[
90+
$this->filterBuilder
91+
->setField('attribute_set_id')
92+
->setValue($defaultAttributeSetId)
93+
->create(),
94+
]
95+
);
96+
$this->metadataCache[$dataObjectClassName] = $this->getList($searchCriteria->create())
97+
->getItems();
98+
}
99+
return $this->metadataCache[$dataObjectClassName];
91100
}
92101
}

app/code/Magento/Catalog/Test/Fixture/Product.php

Lines changed: 50 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
use Magento\Catalog\Api\Data\ProductCustomOptionInterface;
1111
use Magento\Catalog\Api\Data\ProductInterface;
1212
use Magento\Catalog\Api\ProductRepositoryInterface;
13+
use Magento\Catalog\Model\Config\Source\ProductPriceOptionsInterface;
1314
use Magento\Catalog\Model\Product\Attribute\Source\Status;
15+
use Magento\Catalog\Model\Product\Option as CustomOption;
16+
use Magento\Catalog\Model\Product\Option\Value as CustomOptionValue;
1417
use Magento\Catalog\Model\Product\Type;
1518
use Magento\Catalog\Model\Product\Visibility;
1619
use Magento\Framework\DataObject;
@@ -198,21 +201,57 @@ private function prepareOptions(array $data): array
198201
{
199202
$options = [];
200203
$default = [
201-
'product_sku' => $data['sku'],
202-
'title' => 'customoption%order%%uniqid%',
203-
'type' => ProductCustomOptionInterface::OPTION_TYPE_FIELD,
204-
'is_require' => true,
205-
'price' => 10.0,
206-
'price_type' => 'fixed',
207-
'sku' => 'customoption%order%%uniqid%',
208-
'max_characters' => null,
204+
CustomOption::KEY_PRODUCT_SKU => $data['sku'],
205+
CustomOption::KEY_TITLE => 'customoption%order%%uniqid%',
206+
CustomOption::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_FIELD,
207+
CustomOption::KEY_IS_REQUIRE => true,
208+
CustomOption::KEY_PRICE => 10.0,
209+
CustomOption::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED,
210+
CustomOption::KEY_SKU => 'customoption%order%%uniqid%',
211+
CustomOption::KEY_MAX_CHARACTERS => null,
212+
CustomOption::KEY_SORT_ORDER => 1,
209213
'values' => null,
210214
];
215+
$defaultValue = [
216+
CustomOptionValue::KEY_TITLE => 'customoption%order%_%valueorder%%uniqid%',
217+
CustomOptionValue::KEY_PRICE => 1,
218+
CustomOptionValue::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED,
219+
CustomOptionValue::KEY_SKU => 'customoption%order%_%valueorder%%uniqid%',
220+
CustomOptionValue::KEY_SORT_ORDER => 1,
221+
];
211222
$sortOrder = 1;
212223
foreach ($data['options'] as $item) {
213-
$option = $item + ['sort_order' => $sortOrder++] + $default;
214-
$option['title'] = strtr($option['title'], ['%order%' => $option['sort_order']]);
215-
$option['sku'] = strtr($option['sku'], ['%order%' => $option['sort_order']]);
224+
$option = $item + [CustomOption::KEY_SORT_ORDER => $sortOrder++] + $default;
225+
$option[CustomOption::KEY_TITLE] = strtr(
226+
$option[CustomOption::KEY_TITLE],
227+
['%order%' => $option[CustomOption::KEY_SORT_ORDER]]
228+
);
229+
$option[CustomOption::KEY_SKU] = strtr(
230+
$option[CustomOption::KEY_SKU],
231+
['%order%' => $option[CustomOption::KEY_SORT_ORDER]]
232+
);
233+
if (isset($item['values'])) {
234+
$valueSortOrder = 1;
235+
$option['values'] = [];
236+
foreach ($item['values'] as $value) {
237+
$value += [CustomOptionValue::KEY_SORT_ORDER => $valueSortOrder++] + $defaultValue;
238+
$value[CustomOptionValue::KEY_TITLE] = strtr(
239+
$value[CustomOptionValue::KEY_TITLE],
240+
[
241+
'%order%' => $option[CustomOption::KEY_SORT_ORDER],
242+
'%valueorder%' => $value[CustomOptionValue::KEY_SORT_ORDER]
243+
]
244+
);
245+
$value[CustomOptionValue::KEY_SKU] = strtr(
246+
$value[CustomOptionValue::KEY_SKU],
247+
[
248+
'%order%' => $option[CustomOption::KEY_SORT_ORDER],
249+
'%valueorder%' => $value[CustomOptionValue::KEY_SORT_ORDER]
250+
]
251+
);
252+
$option['values'][] = $value;
253+
}
254+
}
216255
$options[] = $option;
217256
}
218257

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminToggleProductGridColumnByClickingItsNameActionGroup">
12+
<annotations>
13+
<description>Click on 'Columns' name from Columns dropdown menu in Admin Product Grid.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="optionName" type="string" defaultValue="Name"/>
17+
</arguments>
18+
<click selector="{{AdminProductGridFilterSection.viewColumnOptionName(optionName)}}" stepKey="clickOnTheColumnName"/>
19+
</actionGroup>
20+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridFilterSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
<element name="inputByCodeRangeFrom" type="input" selector="input.admin__control-text[name='{{code}}[from]']" parameterized="true"/>
4040
<element name="inputByCodeRangeTo" type="input" selector="input.admin__control-text[name='{{code}}[to]']" parameterized="true"/>
4141
<element name="storeViewOptions" type="text" selector=".admin__data-grid-outer-wrap select[name='store_id'] > option[value='{{value}}']" parameterized="true"/>
42+
<element name="viewColumnOptionName" type="text" selector="//div[contains(@class, '_active')]//div[contains(@class, 'admin__data-grid-action-columns-menu')]//div[@class='admin__field-option']//label[text()='{{col}}']" parameterized="true"/>
4243
<element name="customAttribute" type="text" selector="input.admin__control-text[name='{{var}}']" parameterized="true"/>
4344
</section>
4445
</sections>

app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryMainSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,6 @@
4343
<element name="searchStore" type="input" selector="//div/input[@id='search']" />
4444
<element name="productAttributeName" type="button" selector="//div[@class='filter-options-title' and contains(text(),'{{var1}}')]" parameterized="true"/>
4545
<element name="productAttributeOptionValue" type="button" selector="//div[@id='narrow-by-list']//a[contains(text(), '{{var1}}')]" parameterized="true"/>
46+
<element name="outOfStockProductCategoryPage" type="text" selector="//div[@class='stock unavailable']//span[text()='Out of stock']"/>
4647
</section>
4748
</sections>

0 commit comments

Comments
 (0)