Skip to content

Commit d2a4054

Browse files
author
Anna Bukatar
committed
Merge branch '2.4-develop' of https://github.com/magento-l3/magento2ce into ACP2E-963
2 parents e76a7b6 + 2125a21 commit d2a4054

File tree

63 files changed

+1512
-655
lines changed

Some content is hidden

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

63 files changed

+1512
-655
lines changed

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>

app/code/Magento/Catalog/Model/CategoryManagement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public function move($categoryId, $parentId, $afterId = null)
128128
$afterId = ($afterId === null || $afterId > $lastId) ? $lastId : $afterId;
129129
}
130130
$parentPath = $parentCategory->getPath() ?? '';
131-
$path = $model->getPath();
131+
$path = $model->getPath() . '/';
132132
if ($path && strpos($parentPath, $path) === 0) {
133133
throw new \Magento\Framework\Exception\LocalizedException(
134134
__('Operation do not allow to move a parent category to any of children category')

app/code/Magento/Catalog/Test/Unit/Model/CategoryManagementTest.php

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ public function testGetTreeForAllScope()
201201

202202
public function testMove()
203203
{
204-
$categoryId = 2;
205-
$parentId = 1;
204+
$categoryId = 4;
205+
$parentId = 40;
206206
$afterId = null;
207207
$categoryMock = $this->getMockBuilder(Category::class)
208208
->setMockClassName('categoryMock')
@@ -214,18 +214,25 @@ public function testMove()
214214
->getMock();
215215

216216
$this->categoryRepositoryMock
217-
->expects($this->exactly(2))
217+
->expects($this->exactly(6))
218218
->method('get')
219219
->willReturnMap([
220220
[$categoryId, null, $categoryMock],
221221
[$parentId, null, $parentCategoryMock],
222222
]);
223-
$parentCategoryMock->expects($this->once())->method('hasChildren')->willReturn(true);
223+
$parentCategoryMock->expects($this->exactly(3))->method('hasChildren')
224+
->willReturn(true, false, false);
224225
$parentCategoryMock->expects($this->once())->method('getChildren')->willReturn('5,6,7');
225-
$categoryMock->expects($this->once())->method('getPath');
226-
$parentCategoryMock->expects($this->once())->method('getPath');
227-
$categoryMock->expects($this->once())->method('move')->with($parentId, '7');
226+
$categoryMock->expects($this->exactly(3))->method('getPath')
227+
->willReturnOnConsecutiveCalls('2/4', '2/3/4', '2/3/4');
228+
$parentCategoryMock->expects($this->exactly(3))->method('getPath')
229+
->willReturnOnConsecutiveCalls('2/40', '2/3/40', '2/3/44/40');
230+
$categoryMock->expects($this->exactly(3))->method('move')
231+
->withConsecutive([$parentId, '7'], [$parentId, null], [$parentId, null]);
232+
228233
$this->assertTrue($this->model->move($categoryId, $parentId, $afterId));
234+
$this->assertTrue($this->model->move($categoryId, $parentId));
235+
$this->assertTrue($this->model->move($categoryId, $parentId));
229236
}
230237

231238
public function testMoveWithException()
@@ -251,8 +258,8 @@ public function testMoveWithException()
251258
[$categoryId, null, $categoryMock],
252259
[$parentId, null, $parentCategoryMock],
253260
]);
254-
$categoryMock->expects($this->once())->method('getPath')->willReturn('test');
255-
$parentCategoryMock->expects($this->once())->method('getPath')->willReturn('test');
261+
$categoryMock->expects($this->once())->method('getPath')->willReturn('test/2');
262+
$parentCategoryMock->expects($this->once())->method('getPath')->willReturn('test/2/1');
256263
$this->model->move($categoryId, $parentId, $afterId);
257264
}
258265

app/code/Magento/Cron/Console/Command/CronCommand.php

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,35 @@
66

77
namespace Magento\Cron\Console\Command;
88

9-
use Symfony\Component\Console\Command\Command;
10-
use Symfony\Component\Console\Input\InputInterface;
11-
use Symfony\Component\Console\Output\OutputInterface;
12-
use Symfony\Component\Console\Input\InputOption;
13-
use Magento\Framework\App\ObjectManager;
14-
use Magento\Framework\App\ObjectManagerFactory;
15-
use Magento\Store\Model\Store;
16-
use Magento\Store\Model\StoreManager;
179
use Magento\Cron\Observer\ProcessCronQueueObserver;
10+
use Magento\Framework\App\Cron;
1811
use Magento\Framework\App\DeploymentConfig;
12+
use Magento\Framework\App\ObjectManager;
13+
use Magento\Framework\App\ObjectManagerFactory;
1914
use Magento\Framework\Console\Cli;
15+
use Magento\Framework\Exception\FileSystemException;
16+
use Magento\Framework\Exception\RuntimeException;
2017
use Magento\Framework\Shell\ComplexParameter;
18+
use Magento\Store\Model\Store;
19+
use Magento\Store\Model\StoreManager;
20+
use Symfony\Component\Console\Command\Command;
21+
use Symfony\Component\Console\Input\InputInterface;
22+
use Symfony\Component\Console\Input\InputOption;
23+
use Symfony\Component\Console\Output\OutputInterface;
2124

2225
/**
2326
* Command for executing cron jobs
27+
*
28+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2429
*/
2530
class CronCommand extends Command
2631
{
2732
/**
2833
* Name of input option
2934
*/
30-
const INPUT_KEY_GROUP = 'group';
35+
public const INPUT_KEY_GROUP = 'group';
3136

3237
/**
33-
* Object manager factory
34-
*
3538
* @var ObjectManagerFactory
3639
*/
3740
private $objectManagerFactory;
@@ -45,7 +48,7 @@ class CronCommand extends Command
4548

4649
/**
4750
* @param ObjectManagerFactory $objectManagerFactory
48-
* @param DeploymentConfig $deploymentConfig Application deployment configuration
51+
* @param DeploymentConfig|null $deploymentConfig Application deployment configuration
4952
*/
5053
public function __construct(
5154
ObjectManagerFactory $objectManagerFactory,
@@ -59,7 +62,7 @@ public function __construct(
5962
}
6063

6164
/**
62-
* {@inheritdoc}
65+
* @inheritdoc
6366
*/
6467
protected function configure()
6568
{
@@ -86,14 +89,20 @@ protected function configure()
8689
/**
8790
* Runs cron jobs if cron is not disabled in Magento configurations
8891
*
89-
* {@inheritdoc}
92+
* @param InputInterface $input
93+
* @param OutputInterface $output
94+
*
95+
* @return int
96+
* @throws FileSystemException
97+
* @throws RuntimeException
9098
*/
9199
protected function execute(InputInterface $input, OutputInterface $output)
92100
{
93101
if (!$this->deploymentConfig->get('cron/enabled', 1)) {
94102
$output->writeln('<info>' . 'Cron is disabled. Jobs were not run.' . '</info>');
95-
return;
103+
return Cli::RETURN_SUCCESS;
96104
}
105+
// phpcs:ignore Magento2.Security.Superglobal
97106
$omParams = $_SERVER;
98107
$omParams[StoreManager::PARAM_RUN_CODE] = 'admin';
99108
$omParams[Store::CUSTOM_ENTRY_POINT_PARAM] = true;
@@ -112,9 +121,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
112121
$params[ProcessCronQueueObserver::STANDALONE_PROCESS_STARTED] = $bootstrapOptionValue;
113122
}
114123
}
115-
/** @var \Magento\Framework\App\Cron $cronObserver */
116-
$cronObserver = $objectManager->create(\Magento\Framework\App\Cron::class, ['parameters' => $params]);
124+
/** @var Cron $cronObserver */
125+
$cronObserver = $objectManager->create(Cron::class, ['parameters' => $params]);
117126
$cronObserver->launch();
118127
$output->writeln('<info>' . 'Ran jobs by schedule.' . '</info>');
128+
129+
return Cli::RETURN_SUCCESS;
119130
}
120131
}

app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayWhenChooseThreeAllowedCurrenciesTest.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,12 @@
6666
<actionGroup ref="OpenOrderByIdActionGroup" stepKey="openNewOrderById">
6767
<argument name="orderId" value="$grabNewOrderNumber"/>
6868
</actionGroup>
69-
<see selector="{{AdminOrderDetailsInformationSection.orderInformationTable}}" userInput="EUR / USD rate" stepKey="seeUSDandEURRate"/>
70-
<see selector="{{AdminOrderDetailsInformationSection.orderInformationTable}}" userInput="RUB / USD rate:" stepKey="seeRUBandEURRate"/>
69+
<actionGroup ref="AdminAssertCurrencyInOrderActionGroup" stepKey="seeUSDandEURRate">
70+
<argument name="rate" value="EUR / USD rate"/>
71+
</actionGroup>
72+
<actionGroup ref="AdminAssertCurrencyInOrderActionGroup" stepKey="seeRUBandEURRate">
73+
<argument name="rate" value="RUB / USD rate:"/>
74+
</actionGroup>
7175
<grabMultiple selector="{{AdminOrderDetailsInformationSection.rate}}" stepKey="grabRates" />
7276
<assertEquals stepKey="assertRates">
7377
<actualResult type="variable">grabRates</actualResult>

app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayedInOneLineTest.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@
7878
<actionGroup ref="OpenOrderByIdActionGroup" stepKey="openOrderById">
7979
<argument name="orderId" value="$grabOrderNumber"/>
8080
</actionGroup>
81-
<see selector="{{AdminOrderDetailsInformationSection.orderInformationTable}}" userInput="EUR / USD rate" stepKey="seeEURandUSDRate"/>
81+
<actionGroup ref="AdminAssertCurrencyInOrderActionGroup" stepKey="seeEURandUSDRate">
82+
<argument name="rate" value="EUR / USD rate"/>
83+
</actionGroup>
8284
<grabMultiple selector="{{AdminOrderDetailsInformationSection.rate}}" stepKey="grabRate" />
8385
<assertEquals stepKey="assertSelectedCategories">
8486
<actualResult type="variable">grabRate</actualResult>

0 commit comments

Comments
 (0)