Skip to content

Commit 5ebfbba

Browse files
authored
Merge branch '2.4-develop' into api-changes-develop
2 parents 0648553 + 83f3d01 commit 5ebfbba

File tree

204 files changed

+4733
-1375
lines changed

Some content is hidden

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

204 files changed

+4733
-1375
lines changed
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
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\Authorization\Test\Fixture;
9+
10+
use Magento\Authorization\Model\Acl\Role\Group;
11+
use Magento\Authorization\Model\ResourceModel\Role as RoleResource;
12+
use Magento\Authorization\Model\UserContextInterface;
13+
use Magento\Framework\DataObject;
14+
use Magento\SharedCatalog\Model\SharedCatalogFactory;
15+
use Magento\TestFramework\Fixture\Data\ProcessorInterface;
16+
use Magento\TestFramework\Fixture\RevertibleDataFixtureInterface;
17+
use Magento\Authorization\Model\RoleFactory;
18+
use Magento\Authorization\Model\RulesFactory;
19+
use Magento\User\Model\UserFactory;
20+
21+
/**
22+
* Creating a new admin role
23+
*/
24+
class Role implements RevertibleDataFixtureInterface
25+
{
26+
private const DEFAULT_DATA = [
27+
'role_name' => 'Role Name %uniqid%',
28+
'role_type' => Group::ROLE_TYPE,
29+
'user_id' => 0,
30+
'user_type' => UserContextInterface::USER_TYPE_ADMIN
31+
];
32+
33+
private const DEFAULT_DATA_RULES = [
34+
'id' => null,
35+
'role_id' => null,
36+
'resources' => ['Magento_Backend::all']
37+
];
38+
39+
/**
40+
* @var RoleFactory
41+
*/
42+
private $roleFactory;
43+
44+
/**
45+
* @var ProcessorInterface
46+
*/
47+
private $dataProcessor;
48+
49+
/**
50+
* @var RoleResource
51+
*/
52+
private $roleResourceModel;
53+
54+
/**
55+
* @var RulesFactory
56+
*/
57+
private $rulesFactory;
58+
59+
/**
60+
* @param RoleFactory $roleFactory
61+
* @param RoleResource $roleResourceModel
62+
* @param RulesFactory $rulesFactory
63+
* @param ProcessorInterface $dataProcessor
64+
*/
65+
public function __construct(
66+
RoleFactory $roleFactory,
67+
RoleResource $roleResourceModel,
68+
RulesFactory $rulesFactory,
69+
ProcessorInterface $dataProcessor
70+
) {
71+
$this->roleFactory = $roleFactory;
72+
$this->roleResourceModel = $roleResourceModel;
73+
$this->rulesFactory = $rulesFactory;
74+
$this->dataProcessor = $dataProcessor;
75+
}
76+
77+
/**
78+
* @inheritdoc
79+
*/
80+
public function apply(array $data = []): ?DataObject
81+
{
82+
$role = $this->roleFactory->create();
83+
$role->setData($this->prepareData(array_diff_key($data, self::DEFAULT_DATA_RULES)));
84+
$this->roleResourceModel->save($role);
85+
86+
$rules = $this->rulesFactory->create();
87+
$rules->setRoleId($role->getId() ?? null);
88+
$rules->setResources($data['resources'] ?? self::DEFAULT_DATA_RULES['resources']);
89+
$rules->saveRel();
90+
91+
return $role;
92+
}
93+
94+
/**
95+
* @inheritdoc
96+
*/
97+
public function revert(DataObject $data): void
98+
{
99+
$role = $this->roleFactory->create();
100+
$role->load($data->getId());
101+
102+
if ($role->getId() !== null) {
103+
$role->delete();
104+
}
105+
}
106+
107+
/**
108+
* Prepare admin role data
109+
*
110+
* @param array $data
111+
* @return array
112+
*/
113+
private function prepareData(array $data): array
114+
{
115+
$data = array_merge(self::DEFAULT_DATA, $data);
116+
return $this->dataProcessor->process($this, $data);
117+
}
118+
}

app/code/Magento/Backend/etc/config.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@
4444
<seo>
4545
<use_rewrites>0</use_rewrites>
4646
</seo>
47+
<secure>
48+
<use_in_frontend>1</use_in_frontend>
49+
<use_in_adminhtml>1</use_in_adminhtml>
50+
</secure>
4751
</web>
4852
</default>
4953
<stores>

app/code/Magento/Bundle/Block/Sales/Order/Items/Renderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public function getValueHtml($item)
151151
{
152152
if ($attributes = $this->getSelectionAttributes($item)) {
153153
return sprintf('%d', $attributes['qty']) . ' x ' . $this->escapeHtml($item->getName()) . " "
154-
. $this->getOrder()->formatBasePrice($attributes['price']);
154+
. $this->getOrder()->formatPrice($attributes['price']);
155155
}
156156
return $this->escapeHtml($item->getName());
157157
}

app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundlePlaceOrderWithMultipleOptionsSuccessTest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<severity value="MAJOR"/>
1616
<testCaseId value="MC-37515"/>
1717
<group value="Bundle"/>
18+
<group value="cloud_smoke"/>
1819
</annotations>
1920
<before>
2021
<createData entity="_defaultCategory" stepKey="createPreReqCategory"/>

app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundlePlaceOrderWithVirtualAndSimpleChildrenTest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<testCaseId value="MC-38683"/>
1717
<useCaseId value="MC-37663"/>
1818
<group value="Bundle"/>
19+
<group value="cloud_smoke"/>
1920
</annotations>
2021
<before>
2122
<createData entity="CustomerEntityOne" stepKey="createCustomer"/>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare (strict_types=1);
8+
namespace Magento\Catalog\Model\ResourceModel;
9+
10+
use Magento\Catalog\Api\Data\ProductInterface;
11+
use Magento\Framework\App\ResourceConnection;
12+
13+
/**
14+
* Get product type ID by product ID.
15+
*/
16+
class GetProductTypeById
17+
{
18+
/**
19+
* @var ResourceConnection
20+
*/
21+
private $resource;
22+
23+
/**
24+
* @param ResourceConnection $resource
25+
*/
26+
public function __construct(
27+
ResourceConnection $resource
28+
) {
29+
$this->resource = $resource;
30+
}
31+
32+
/**
33+
* Retrieve product type by its product ID
34+
*
35+
* @param int $productId
36+
* @return string
37+
*/
38+
public function execute(int $productId): string
39+
{
40+
$connection = $this->resource->getConnection();
41+
$productTable = $this->resource->getTableName('catalog_product_entity');
42+
43+
$select = $connection->select()
44+
->from(
45+
$productTable,
46+
ProductInterface::TYPE_ID
47+
)->where('entity_id = ?', $productId);
48+
49+
$result = $connection->fetchOne($select);
50+
return $result ?: '';
51+
}
52+
}

app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckNewCategoryLevelAddedViaApiTest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<group value="catalog"/>
1919
<severity value="MAJOR"/>
2020
<group value="pr_exclude"/>
21+
<group value="cloud_smoke"/>
2122
</annotations>
2223
<before>
2324
<actionGroup ref="AdminLoginActionGroup" stepKey="loginToAdminPanel"/>

app/code/Magento/Catalog/Test/Mftf/Test/AdminFilterByNameByStoreViewOnProductGridTest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<testCaseId value="MC-28534"/>
1919
<useCaseId value="MC-37347"/>
2020
<group value="catalog"/>
21+
<group value="cloud_smoke"/>
2122
</annotations>
2223

2324
<before>

app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogAndSearchTest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<severity value="BLOCKER"/>
1818
<group value="catalog"/>
1919
<group value="mtf_migrated"/>
20+
<group value="cloud_smoke"/>
2021
</annotations>
2122
<before>
2223
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>

app/code/Magento/Catalog/view/adminhtml/web/catalog/product/composite/configure.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,9 @@ define([
230230
if (response.error) {
231231
this.blockMsg.show();
232232
this.blockMsgError.innerHTML = response.message;
233-
this.blockCancelBtn.hide();
233+
if(this.blockCancelBtn) {
234+
this.blockCancelBtn.hide();
235+
}
234236
this.setConfirmCallback(listType, null);
235237
this._showWindow();
236238
}
@@ -584,7 +586,9 @@ define([
584586
this.blockFormFields.update();
585587
this.blockMsg.hide();
586588
this.blockMsgError.update();
587-
this.blockCancelBtn.show();
589+
if(this.blockCancelBtn) {
590+
this.blockCancelBtn.show();
591+
}
588592
break;
589593
default:
590594
// search in list types for its cleaning
@@ -603,7 +607,9 @@ define([
603607
this.blockFormFields.update();
604608
this.blockMsg.hide();
605609
this.blockMsgError.update();
606-
this.blockCancelBtn.show();
610+
if(this.blockCancelBtn) {
611+
this.blockCancelBtn.show();
612+
}
607613
}
608614
break;
609615
}

0 commit comments

Comments
 (0)