Skip to content

Commit ae60e49

Browse files
committed
Merge remote-tracking branch 'origin/2.4-develop' into gl_pr_arrows_april21_2022
2 parents ee2f8a4 + 7e794ce commit ae60e49

File tree

22 files changed

+794
-62
lines changed

22 files changed

+794
-62
lines changed

app/code/Magento/Checkout/view/frontend/requirejs-config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,10 @@ var config = {
1515
proceedToCheckout: 'Magento_Checkout/js/proceed-to-checkout',
1616
catalogAddToCart: 'Magento_Catalog/js/catalog-add-to-cart'
1717
}
18+
},
19+
shim: {
20+
'Magento_Checkout/js/model/totals' : {
21+
deps: ['Magento_Customer/js/customer-data']
22+
}
1823
}
1924
};

app/code/Magento/Checkout/view/frontend/web/js/action/redirect-on-success.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ define(
2222
*/
2323
execute: function () {
2424
fullScreenLoader.startLoader();
25-
this.reloadPage();
25+
this.redirectToSuccessPage();
2626
},
2727

2828
/**
29-
* Method to reload page
29+
* Redirect to success page.
3030
*/
31-
reloadPage: function () {
31+
redirectToSuccessPage: function () {
3232
window.location.replace(url.build(this.redirectUrl));
3333
}
3434
};

app/code/Magento/Checkout/view/frontend/web/js/model/error-processor.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ define([
2424
messageContainer = messageContainer || globalMessageList;
2525

2626
if (response.status == 401) { //eslint-disable-line eqeqeq
27-
this.reloadPage(url.build('customer/account/login/'));
27+
this.redirectTo(url.build('customer/account/login/'));
2828
} else {
2929
try {
3030
error = JSON.parse(response.responseText);
@@ -38,9 +38,9 @@ define([
3838
},
3939

4040
/**
41-
* Method to reload page
41+
* Method to redirect by requested URL.
4242
*/
43-
reloadPage: function (redirectUrl) {
43+
redirectTo: function (redirectUrl) {
4444
window.location.replace(redirectUrl);
4545
}
4646
};

app/code/Magento/Cookie/view/base/requirejs-config.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

app/code/Magento/Indexer/Console/Command/IndexerShowDimensionsModeCommand.php

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
*/
2020
class IndexerShowDimensionsModeCommand extends AbstractIndexerCommand
2121
{
22-
const INPUT_KEY_INDEXER = 'indexer';
23-
const DIMENSION_MODE_NONE = 'none';
24-
const XML_PATH_DIMENSIONS_MODE_MASK = 'indexer/%s/dimensions_mode';
22+
private const INPUT_KEY_INDEXER = 'indexer';
23+
private const DIMENSION_MODE_NONE = 'none';
24+
private const XML_PATH_DIMENSIONS_MODE_MASK = 'indexer/%s/dimensions_mode';
2525
/**
2626
* @var string
2727
*/
@@ -36,24 +36,31 @@ class IndexerShowDimensionsModeCommand extends AbstractIndexerCommand
3636
* @var string[]
3737
*/
3838
private $indexers;
39+
/**
40+
* @var string[]
41+
*/
42+
private $optionalIndexers;
3943

4044
/**
4145
* @param ObjectManagerFactory $objectManagerFactory
4246
* @param ScopeConfigInterface $configReader
4347
* @param array $indexers
48+
* @param array $optionalIndexers
4449
*/
4550
public function __construct(
4651
ObjectManagerFactory $objectManagerFactory,
4752
ScopeConfigInterface $configReader,
48-
array $indexers
53+
array $indexers,
54+
array $optionalIndexers = []
4955
) {
5056
$this->configReader = $configReader;
5157
$this->indexers = $indexers;
58+
$this->optionalIndexers = $optionalIndexers;
5259
parent::__construct($objectManagerFactory);
5360
}
5461

5562
/**
56-
* {@inheritdoc}
63+
* @inheritdoc
5764
*/
5865
protected function configure()
5966
{
@@ -64,7 +71,7 @@ protected function configure()
6471
}
6572

6673
/**
67-
* {@inheritdoc}
74+
* @inheritdoc
6875
* @param InputInterface $input
6976
* @param OutputInterface $output
7077
* @return int
@@ -92,10 +99,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
9299
$output->writeln(sprintf('%-50s ', $indexer->getTitle() . ':') . $mode);
93100
}
94101
} catch (\Exception $e) {
95-
$output->writeln('"' . $indexer->getTitle() . '" indexer process unknown error:' . PHP_EOL);
96-
$output->writeln($e->getMessage() . PHP_EOL);
97-
// we must have an exit code higher than zero to indicate something was wrong
98-
$returnValue = Cli::RETURN_FAILURE;
102+
if (!in_array($indexerId, $this->optionalIndexers)) { /** @phpstan-ignore-line */
103+
$output->writeln('"' . $indexer->getTitle() . '" indexer process unknown error:' . PHP_EOL);
104+
$output->writeln($e->getMessage() . PHP_EOL);
105+
// we must have an exit code higher than zero to indicate something was wrong
106+
$returnValue = Cli::RETURN_FAILURE;
107+
}
99108
}
100109

101110
return $returnValue;
@@ -112,7 +121,7 @@ private function getInputList(): array
112121
$arguments[] = new InputArgument(
113122
self::INPUT_KEY_INDEXER,
114123
InputArgument::OPTIONAL | InputArgument::IS_ARRAY,
115-
$optionDescription . ' (' . implode($this->indexers) . ')'
124+
$optionDescription . ' (' . implode(',', $this->indexers) . ')'
116125
);
117126

118127
return $arguments;

app/code/Magento/Indexer/Test/Unit/Console/Command/IndexerShowDimensionsModeCommandTest.php

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,26 @@ class IndexerShowDimensionsModeCommandTest extends AbstractIndexerCommandCommonS
4141
*/
4242
private $indexerMock;
4343

44+
/**
45+
* @var string[]
46+
*/
47+
private $optionalIndexers;
48+
49+
/**
50+
* @var ObjectManagerHelper
51+
*/
52+
private $objectManagerHelper;
53+
4454
/**
4555
* @inheritdoc
4656
*/
4757
protected function setUp(): void
4858
{
4959
parent::setUp();
50-
$objectManagerHelper = new ObjectManagerHelper($this);
60+
$this->objectManagerHelper = new ObjectManagerHelper($this);
5161
$this->configReaderMock = $this->getMockForAbstractClass(ScopeConfigInterface::class);
5262
$this->indexers = ['indexer_1' => 'indexer_1', 'indexer_2' => 'indexer_2'];
53-
$this->command = $objectManagerHelper->getObject(
63+
$this->command = $this->objectManagerHelper->getObject(
5464
IndexerShowDimensionsModeCommand::class,
5565
[
5666
'objectManagerFactory' => $this->objectManagerFactory,
@@ -98,6 +108,29 @@ public function testExecuteWithAttributes($command, $consoleOutput)
98108
);
99109
}
100110

111+
public function testExecuteWithOptionalIndexers()
112+
{
113+
$this->optionalIndexers = ['indexer_3'];
114+
$this->indexers = ['indexer_3'=> 'indexer_3'];
115+
$this->command = $this->objectManagerHelper->getObject(
116+
IndexerShowDimensionsModeCommand::class,
117+
[
118+
'objectManagerFactory' => $this->objectManagerFactory,
119+
'configReader' => $this->configReaderMock,
120+
'indexers' => $this->indexers,
121+
'optionalIndexers' => $this->optionalIndexers
122+
]
123+
);
124+
$command = ['indexer' => ['indexer_3']];
125+
$this->configureAdminArea();
126+
/** @var CommandTester $commandTester */
127+
$commandTester = new CommandTester($this->command);
128+
$this->indexerMock->method('load')->willThrowException(new \InvalidArgumentException());
129+
$commandTester->execute($command);
130+
$actualValue = $commandTester->getDisplay();
131+
$this->assertEquals('', $actualValue);
132+
}
133+
101134
/**
102135
* @return array
103136
*/

app/code/Magento/ProductVideo/etc/csp_whitelist.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
1515
<value id="vimeo" type="host">vimeo.com</value>
1616
<value id="www_vimeo" type="host">www.vimeo.com</value>
1717
<value id="vimeo_cdn" type="host">*.vimeocdn.com</value>
18+
<value id="youtube" type="host">*.youtube.com</value>
1819
</values>
1920
</policy>
2021
<policy id="img-src">
2122
<values>
2223
<value id="vimeo_cdn" type="host">*.vimeocdn.com</value>
2324
<value id="youtube_image" type="host">i.ytimg.com</value>
25+
<value id="youtube" type="host">*.youtube.com</value>
2426
</values>
2527
</policy>
2628
<policy id="frame-src">

app/code/Magento/Theme/view/base/requirejs-config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ var config = {
4747
'jquery-ui-modules/widget': 'jquery/ui-modules/widget',
4848
'jquery-ui-modules/timepicker': 'jquery/timepicker',
4949
'vimeo': 'vimeo/player',
50-
'vimeoWrapper': 'vimeo/vimeo-wrapper',
51-
'jquery/jquery.cookie': 'js-cookie/cookie-wrapper'
50+
'vimeoWrapper': 'vimeo/vimeo-wrapper'
5251
}
5352
},
5453
shim: {
@@ -69,7 +68,8 @@ var config = {
6968
'jquery/validate': 'jquery/jquery.validate',
7069
'jquery/file-uploader': 'jquery/fileUploader/jquery.fileuploader',
7170
'prototype': 'legacy-build.min',
72-
'jquery/jquery-storageapi': 'jquery/jquery.storageapi.min',
71+
'jquery/jquery.cookie': 'js-cookie/cookie-wrapper',
72+
'jquery/jquery-storageapi': 'js-storage/storage-wrapper',
7373
'text': 'mage/requirejs/text',
7474
'domReady': 'requirejs/domReady',
7575
'spectrum': 'jquery/spectrum/spectrum',

dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/Category/Plugin/StorageTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Magento\Catalog\Model\Product\Media\ConfigInterface;
1313
use Magento\Framework\App\Bootstrap as AppBootstrap;
1414
use Magento\Framework\App\Filesystem\DirectoryList;
15+
use Magento\Framework\App\ResourceConnection;
1516
use Magento\Framework\Exception\NoSuchEntityException;
1617
use Magento\Framework\Filesystem;
1718
use Magento\Framework\Filesystem\Driver\File;
@@ -139,6 +140,9 @@ private function removeFiles(): void
139140
*/
140141
private function removeProducts(): void
141142
{
143+
$resource = $this->objectManager->get(ResourceConnection::class);
144+
$connection = $resource->getConnection();
145+
$connection->delete('catalog_category_product');
142146
foreach ($this->createdProductsSkus as $sku) {
143147
try {
144148
$this->productRepository->deleteById($sku);

dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111
use Magento\Catalog\Model\CategoryRepository;
1212
use Magento\Catalog\Model\ProductRepository;
1313
use Magento\CatalogUrlRewrite\Model\ResourceModel\Category\Product;
14+
use Magento\Framework\App\ResourceConnection;
1415
use Magento\Framework\Exception\CouldNotSaveException;
1516
use Magento\Framework\Exception\LocalizedException;
1617
use Magento\Framework\Exception\NoSuchEntityException;
1718
use Magento\Framework\ObjectManagerInterface;
1819
use Magento\TestFramework\Helper\Bootstrap;
1920
use Magento\UrlRewrite\Model\OptionProvider;
21+
use Magento\UrlRewrite\Model\Storage\DbStorage;
2022
use Magento\UrlRewrite\Model\UrlFinderInterface;
2123
use Magento\UrlRewrite\Service\V1\Data\UrlRewrite;
2224
use PHPUnit\Framework\Exception;
@@ -44,6 +46,9 @@ protected function setUp(): void
4446
*/
4547
public function testGenerateUrlRewritesWithoutSaveHistory()
4648
{
49+
$resource = $this->objectManager->get(ResourceConnection::class);
50+
$connection = $resource->getConnection();
51+
$connection->delete(DbStorage::TABLE_NAME);
4752
/** @var Category $category */
4853
$category = $this->objectManager->create(Category::class);
4954
$category->load(3);

0 commit comments

Comments
 (0)