Skip to content

Commit b22b70b

Browse files
rizwankhgltranthienbinh1989
authored andcommitted
Merge pull request #368 from magento-commerce/2.4.6-develop
2.4.6-develop sync with mainline 2.4.6-develop
2 parents 9e5b41b + 22ecbcc commit b22b70b

File tree

237 files changed

+5689
-127351
lines changed

Some content is hidden

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

237 files changed

+5689
-127351
lines changed

app/code/Magento/Authorization/Test/Fixture/Role.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@
99

1010
use Magento\Authorization\Model\Acl\Role\Group;
1111
use Magento\Authorization\Model\ResourceModel\Role as RoleResource;
12+
use Magento\Authorization\Model\RoleFactory;
13+
use Magento\Authorization\Model\RulesFactory;
1214
use Magento\Authorization\Model\UserContextInterface;
1315
use Magento\Framework\DataObject;
14-
use Magento\SharedCatalog\Model\SharedCatalogFactory;
1516
use Magento\TestFramework\Fixture\Data\ProcessorInterface;
1617
use Magento\TestFramework\Fixture\RevertibleDataFixtureInterface;
17-
use Magento\Authorization\Model\RoleFactory;
18-
use Magento\Authorization\Model\RulesFactory;
19-
use Magento\User\Model\UserFactory;
2018

2119
/**
2220
* Creating a new admin role

app/code/Magento/Backend/Console/Command/AbstractCacheSetCommand.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66

77
namespace Magento\Backend\Console\Command;
88

9+
use Magento\Framework\Console\Cli;
910
use Symfony\Component\Console\Input\InputInterface;
1011
use Symfony\Component\Console\Output\OutputInterface;
1112

1213
/**
14+
* phpcs:disable Magento2.Classes.AbstractApi
1315
* @api
1416
* @since 100.0.2
1517
*/
@@ -23,7 +25,7 @@ abstract class AbstractCacheSetCommand extends AbstractCacheManageCommand
2325
abstract protected function isEnable();
2426

2527
/**
26-
* {@inheritdoc}
28+
* @inheritdoc
2729
*/
2830
protected function execute(InputInterface $input, OutputInterface $output)
2931
{
@@ -43,5 +45,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
4345
$output->writeln('Cleaned cache types:');
4446
$output->writeln(join(PHP_EOL, $changedTypes));
4547
}
48+
49+
return Cli::RETURN_SUCCESS;
4650
}
4751
}

app/code/Magento/Backend/Console/Command/AbstractCacheTypeManageCommand.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66

77
namespace Magento\Backend\Console\Command;
88

9+
use Magento\Framework\Console\Cli;
910
use Magento\Framework\Event\ManagerInterface as EventManagerInterface;
1011
use Symfony\Component\Console\Input\InputInterface;
1112
use Symfony\Component\Console\Output\OutputInterface;
1213
use Magento\Framework\App\Cache\Manager;
1314

1415
/**
16+
* phpcs:disable Magento2.Classes.AbstractApi
1517
* @api
1618
* @since 100.0.2
1719
*/
@@ -54,13 +56,15 @@ abstract protected function getDisplayMessage();
5456
*
5557
* @param InputInterface $input
5658
* @param OutputInterface $output
57-
* @return void
59+
* @return int
5860
*/
5961
protected function execute(InputInterface $input, OutputInterface $output)
6062
{
6163
$types = $this->getRequestedTypes($input);
6264
$this->performAction($types);
6365
$output->writeln($this->getDisplayMessage());
6466
$output->writeln(join(PHP_EOL, $types));
67+
68+
return Cli::RETURN_SUCCESS;
6569
}
6670
}

app/code/Magento/Backend/Console/Command/CacheStatusCommand.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
namespace Magento\Backend\Console\Command;
88

9+
use Magento\Framework\Console\Cli;
910
use Symfony\Component\Console\Input\InputInterface;
1011
use Symfony\Component\Console\Output\OutputInterface;
1112

@@ -18,7 +19,7 @@
1819
class CacheStatusCommand extends AbstractCacheCommand
1920
{
2021
/**
21-
* {@inheritdoc}
22+
* @inheritdoc
2223
*/
2324
protected function configure()
2425
{
@@ -28,13 +29,15 @@ protected function configure()
2829
}
2930

3031
/**
31-
* {@inheritdoc}
32+
* @inheritdoc
3233
*/
3334
protected function execute(InputInterface $input, OutputInterface $output)
3435
{
3536
$output->writeln('Current status:');
3637
foreach ($this->cacheManager->getStatus() as $cache => $status) {
3738
$output->writeln(sprintf('%30s: %d', $cache, $status));
3839
}
40+
41+
return Cli::RETURN_SUCCESS;
3942
}
4043
}

app/code/Magento/Backend/Model/Auth/Session.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public function refreshAcl($user = null)
130130
}
131131
if ($user->getReloadAclFlag()) {
132132
$user->unsetData('password');
133-
$user->setReloadAclFlag('0')->save();
133+
$user->setReloadAclFlag(0)->save();
134134
}
135135
return $this;
136136
}

app/code/Magento/Backend/etc/adminhtml/system.xml

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,14 +317,18 @@
317317
<label>Disable Email Communications</label>
318318
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
319319
</field>
320-
<field id="host" translate="label comment" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
320+
<field id="transport" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
321+
<label>Transport</label>
322+
<source_model>Magento\Email\Model\Config\Source\SmtpTransportType</source_model>
323+
</field>
324+
<field id="host" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
321325
<label>Host</label>
322-
<comment>For Windows server only.</comment>
326+
<comment>For SMTP and Windows server only.</comment>
323327
</field>
324-
<field id="port" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
328+
<field id="port" translate="label comment" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
325329
<label>Port (25)</label>
326330
<validate>validate-digits validate-digits-range digits-range-0-65535</validate>
327-
<comment>Please enter at least 0 and at most 65535 (For Windows server only).</comment>
331+
<comment>Please enter at least 0 and at most 65535 (For SMTP and Windows server only).</comment>
328332
</field>
329333
<field id="set_return_path" translate="label" type="select" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
330334
<label>Set Return-Path</label>
@@ -338,6 +342,34 @@
338342
<field id="set_return_path">2</field>
339343
</depends>
340344
</field>
345+
<field id="username" translate="label comment" type="text" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="1">
346+
<label>Username</label>
347+
<comment>Username</comment>
348+
<depends>
349+
<field id="transport">smtp</field>
350+
</depends>
351+
</field>
352+
<field id="password" translate="label comment" type="password" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
353+
<label>Password</label>
354+
<comment>Username</comment>
355+
<depends>
356+
<field id="transport">smtp</field>
357+
</depends>
358+
</field>
359+
<field id="auth" translate="label" type="select" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
360+
<label>Auth</label>
361+
<source_model>Magento\Email\Model\Config\Source\SmtpAuthType</source_model>
362+
<depends>
363+
<field id="transport">smtp</field>
364+
</depends>
365+
</field>
366+
<field id="ssl" translate="label" type="select" sortOrder="120" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
367+
<label>SSL</label>
368+
<source_model>Magento\Email\Model\Config\Source\SmtpSslType</source_model>
369+
<depends>
370+
<field id="transport">smtp</field>
371+
</depends>
372+
</field>
341373
</group>
342374
<group id="upload_configuration" translate="label" type="text" sortOrder="1000" showInDefault="1" showInWebsite="1" showInStore="1">
343375
<label>Images Upload Configuration</label>
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
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\Bundle\Test\Fixture;
9+
10+
use Magento\Bundle\Model\Product\Type;
11+
use Magento\Catalog\Api\ProductRepositoryInterface;
12+
use Magento\Framework\DataObject;
13+
use Magento\Framework\DataObjectFactory;
14+
use Magento\Quote\Api\CartRepositoryInterface;
15+
16+
class AddProductToCart extends \Magento\Quote\Test\Fixture\AddProductToCart
17+
{
18+
/**
19+
* @var ProductRepositoryInterface
20+
*/
21+
private ProductRepositoryInterface $productRepository;
22+
23+
/**
24+
* @var Type
25+
*/
26+
private Type $productType;
27+
28+
/**
29+
* @param CartRepositoryInterface $cartRepository
30+
* @param ProductRepositoryInterface $productRepository
31+
* @param DataObjectFactory $dataObjectFactory
32+
* @param Type $productType
33+
*/
34+
public function __construct(
35+
CartRepositoryInterface $cartRepository,
36+
ProductRepositoryInterface $productRepository,
37+
DataObjectFactory $dataObjectFactory,
38+
Type $productType
39+
) {
40+
parent::__construct($cartRepository, $productRepository, $dataObjectFactory);
41+
$this->productRepository = $productRepository;
42+
$this->productType = $productType;
43+
}
44+
45+
/**
46+
* {@inheritdoc}
47+
* @param array $data Parameters
48+
* $data['selections'] can be supplied in following formats:
49+
* - [["$product1.id$"], ["$product2.id$"]]
50+
* - [[{"product_id":"$product1.id$","qty":1}], [{"product_id":"$product2.id$","qty":1}]]
51+
* - To skip an option, pass empty array [["$product1.id$"], [], ["$product2.id$"]]
52+
* <pre>
53+
* $data = [
54+
* 'cart_id' => (int) Cart ID. Required.
55+
* 'product_id' => (int) Product ID. Required.
56+
* 'selections' => (array) array of options selections. Required.
57+
* 'qty' => (int) Quantity. Optional. Default: 1.
58+
* ]
59+
* </pre>
60+
*/
61+
public function apply(array $data = []): ?DataObject
62+
{
63+
$bundleProduct = $this->productRepository->getById($data['product_id']);
64+
$buyRequest = [
65+
'bundle_option' => [],
66+
'bundle_option_qty' => [],
67+
'qty' => $data['qty'] ?? 1,
68+
];
69+
$options = $this->productType->getOptionsCollection($bundleProduct);
70+
$selections = $this->productType->getSelectionsCollection([], $bundleProduct);
71+
$options->appendSelections($selections, true);
72+
$optionsList = array_values($options->getItems());
73+
foreach ($data['selections'] as $index => $selections) {
74+
if (!empty($selections)) {
75+
$option = $optionsList[$index];
76+
foreach ($selections as $item) {
77+
if (is_array($item)) {
78+
$productId = (int)$item['product_id'];
79+
$qty = $item['qty'] ?? 1;
80+
} else {
81+
$productId = (int)$item;
82+
$qty = 1;
83+
}
84+
foreach ($option->getSelections() as $selection) {
85+
if (((int)$selection->getProductId()) === $productId) {
86+
$buyRequest['bundle_option'][$option->getId()][] = $selection->getSelectionId();
87+
$buyRequest['bundle_option_qty'][$option->getId()][$selection->getSelectionId()] = $qty;
88+
break;
89+
}
90+
}
91+
}
92+
}
93+
}
94+
return parent::apply(
95+
[
96+
'cart_id' => $data['cart_id'],
97+
'product_id' => $data['product_id'],
98+
'buy_request' => $buyRequest
99+
]
100+
);
101+
}
102+
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,23 +105,23 @@
105105
<selectOption selector="{{StorefrontBundledSection.dropDownOptionOneProducts('Option One')}}" userInput="$$simpleProduct1.name$$ +$$$simpleProduct1.price$$.00" stepKey="selectOption0Product0"/>
106106
<seeOptionIsSelected selector="{{StorefrontBundledSection.dropDownOptionOneProducts('Option One')}}" userInput="$$simpleProduct1.name$$ +$$$simpleProduct1.price$$.00" stepKey="checkOption0Product0"/>
107107
<fillField selector="{{StorefrontBundledSection.dropDownOptionOneQuantity('Option One')}}" userInput="3" stepKey="fillQuantity00"/>
108-
<seeInField selector="{{StorefrontBundledSection.dropDownOptionOneQuantity('Option One')}}" userInput="3" stepKey="checkQuantity00"/>
108+
<seeInField selector="{{StorefrontBundledSection.dropDownOptionOneQuantity('Option One')}}" userInput="03" stepKey="checkQuantity00"/>
109109

110110
<selectOption selector="{{StorefrontBundledSection.dropDownOptionOneProducts('Option One')}}" userInput="$$simpleProduct2.name$$ +$$$simpleProduct2.price$$.00" stepKey="selectOption0Product1"/>
111111
<seeOptionIsSelected selector="{{StorefrontBundledSection.dropDownOptionOneProducts('Option One')}}" userInput="$$simpleProduct2.name$$ +$$$simpleProduct2.price$$.00" stepKey="checkOption0Product1"/>
112112
<fillField selector="{{StorefrontBundledSection.dropDownOptionOneQuantity('Option One')}}" userInput="3" stepKey="fillQuantity01"/>
113-
<seeInField selector="{{StorefrontBundledSection.dropDownOptionOneQuantity('Option One')}}" userInput="3" stepKey="checkQuantity01"/>
113+
<seeInField selector="{{StorefrontBundledSection.dropDownOptionOneQuantity('Option One')}}" userInput="03" stepKey="checkQuantity01"/>
114114

115115
<!--"Radio Buttons" type option-->
116116
<checkOption selector="{{StorefrontBundledSection.radioButtonOptionTwoProducts('Option Two', '1')}}" stepKey="selectOption1Product0"/>
117117
<seeCheckboxIsChecked selector="{{StorefrontBundledSection.radioButtonOptionTwoProducts('Option Two', '1')}}" stepKey="checkOption1Product0"/>
118118
<fillField selector="{{StorefrontBundledSection.radioButtonOptionTwoQuantity('Option Two')}}" userInput="3" stepKey="fillQuantity10"/>
119-
<seeInField selector="{{StorefrontBundledSection.radioButtonOptionTwoQuantity('Option Two')}}" userInput="3" stepKey="checkQuantity10"/>
119+
<seeInField selector="{{StorefrontBundledSection.radioButtonOptionTwoQuantity('Option Two')}}" userInput="03" stepKey="checkQuantity10"/>
120120

121121
<checkOption selector="{{StorefrontBundledSection.radioButtonOptionTwoProducts('Option Two', '2')}}" stepKey="selectOption1Product1"/>
122122
<seeCheckboxIsChecked selector="{{StorefrontBundledSection.radioButtonOptionTwoProducts('Option Two', '2')}}" stepKey="checkOption1Product1"/>
123123
<fillField selector="{{StorefrontBundledSection.radioButtonOptionTwoQuantity('Option Two')}}" userInput="3" stepKey="fillQuantity11"/>
124-
<seeInField selector="{{StorefrontBundledSection.radioButtonOptionTwoQuantity('Option Two')}}" userInput="3" stepKey="checkQuantity11"/>
124+
<seeInField selector="{{StorefrontBundledSection.radioButtonOptionTwoQuantity('Option Two')}}" userInput="03" stepKey="checkQuantity11"/>
125125

126126
<!--"Checkbox" type option-->
127127
<!--This option does not support user defined quantities-->

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
<!--"Drop-down" type option-->
8181
<selectOption selector="{{StorefrontBundledSection.dropDownOptionOneProducts('Option One')}}" userInput="$$createProduct1.name$$ +$$$createProduct1.price$$.00" stepKey="selectOption0Product0"/>
8282
<seeOptionIsSelected selector="{{StorefrontBundledSection.dropDownOptionOneProducts('Option One')}}" userInput="$$createProduct1.name$$ +$$$createProduct1.price$$.00" stepKey="checkOption0Product0"/>
83+
<fillField selector="{{StorefrontBundledSection.dropDownOptionOneQuantity('Option One')}}" userInput="-" stepKey="emptyDropdownQuantity"/>
8384
<fillField selector="{{StorefrontBundledSection.dropDownOptionOneQuantity('Option One')}}" userInput="-1" stepKey="fillQuantity00"/>
8485
<seeInField selector="{{StorefrontBundledSection.dropDownOptionOneQuantity('Option One')}}" userInput="-1" stepKey="checkQuantity00"/>
8586
<click selector="{{StorefrontBundledSection.addToCartConfigured}}" stepKey="clickAddToCartDropDown"/>
@@ -88,6 +89,7 @@
8889
<!--"Radio Buttons" type option-->
8990
<checkOption selector="{{StorefrontBundledSection.radioButtonOptionTwoProducts('Option Two', '1')}}" stepKey="selectOption1Product0"/>
9091
<seeCheckboxIsChecked selector="{{StorefrontBundledSection.radioButtonOptionTwoProducts('Option Two', '1')}}" stepKey="checkOption1Product0"/>
92+
<fillField selector="{{StorefrontBundledSection.radioButtonOptionTwoQuantity('Option Two')}}" userInput="-" stepKey="emptyRadioQuantity"/>
9193
<fillField selector="{{StorefrontBundledSection.radioButtonOptionTwoQuantity('Option Two')}}" userInput="-1" stepKey="fillQuantity10"/>
9294
<seeInField selector="{{StorefrontBundledSection.radioButtonOptionTwoQuantity('Option Two')}}" userInput="-1" stepKey="checkQuantity10"/>
9395
<click selector="{{StorefrontBundledSection.addToCartConfigured}}" stepKey="clickAddToCartRadioButton"/>

app/code/Magento/Bundle/ViewModel/ValidateQuantity.php

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
use Magento\Framework\Serialize\Serializer\Json;
1111
use Magento\Framework\View\Element\Block\ArgumentInterface;
12-
use Magento\Catalog\Block\Product\View as ProductView;
1312

1413
/**
1514
* ViewModel for Bundle Option Block
@@ -21,27 +20,24 @@ class ValidateQuantity implements ArgumentInterface
2120
*/
2221
private $serializer;
2322

24-
/**
25-
* @var ProductView
26-
*/
27-
private $productView;
28-
2923
/**
3024
* @param Json $serializer
31-
* @param ProductView $productView
3225
*/
3326
public function __construct(
34-
Json $serializer,
35-
ProductView $productView
27+
Json $serializer
3628
) {
3729
$this->serializer = $serializer;
38-
$this->productView = $productView;
3930
}
4031

32+
/**
33+
* Returns quantity validator.
34+
*
35+
* @return string
36+
*/
4137
public function getQuantityValidators(): string
4238
{
43-
return $this->serializer->serialize(
44-
$this->productView->getQuantityValidators()
45-
);
39+
$validators['validate-item-quantity'] = [];
40+
41+
return $this->serializer->serialize($validators);
4642
}
4743
}

0 commit comments

Comments
 (0)