Skip to content

Commit 475c521

Browse files
committed
Merge remote-tracking branch 'mainline/2.4-develop' into 2.4-develop-pr15
2 parents d53885e + 45b624c commit 475c521

File tree

56 files changed

+3636
-410
lines changed

Some content is hidden

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

56 files changed

+3636
-410
lines changed

.htaccess

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -37,29 +37,6 @@
3737

3838
DirectoryIndex index.php
3939

40-
<IfModule mod_php5.c>
41-
############################################
42-
## adjust memory limit
43-
44-
php_value memory_limit 756M
45-
php_value max_execution_time 18000
46-
47-
############################################
48-
## disable automatic session start
49-
## before autoload was initialized
50-
51-
php_flag session.auto_start off
52-
53-
############################################
54-
## enable resulting html compression
55-
56-
#php_flag zlib.output_compression on
57-
58-
###########################################
59-
## disable user agent verification to not break multiple image upload
60-
61-
php_flag suhosin.session.cryptua off
62-
</IfModule>
6340
<IfModule mod_php7.c>
6441
############################################
6542
## adjust memory limit

app/code/Magento/Catalog/view/frontend/templates/product/image.phtml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@
44
* See COPYING.txt for license details.
55
*/
66
?>
7-
<?php /** @var $block \Magento\Catalog\Block\Product\Image */ ?>
7+
<?php
8+
/** @var $block \Magento\Catalog\Block\Product\Image */
9+
/** @var $escaper \Magento\Framework\Escaper */
10+
?>
811

9-
<img class="photo image <?= $block->escapeHtmlAttr($block->getClass()) ?>"
10-
<?= $block->escapeHtml($block->getCustomAttributes()) ?>
11-
src="<?= $block->escapeUrl($block->getImageUrl()) ?>"
12-
width="<?= $block->escapeHtmlAttr($block->getWidth()) ?>"
13-
height="<?= $block->escapeHtmlAttr($block->getHeight()) ?>"
14-
alt="<?= /* @noEscape */ $block->stripTags($block->getLabel(), null, true) ?>" />
12+
<img class="photo image <?= $escaper->escapeHtmlAttr($block->getClass()) ?>"
13+
<?= $escaper->escapeHtml($block->getCustomAttributes()) ?>
14+
src="<?= $escaper->escapeUrl($block->getImageUrl()) ?>"
15+
loading="lazy"
16+
width="<?= $escaper->escapeHtmlAttr($block->getWidth()) ?>"
17+
height="<?= $escaper->escapeHtmlAttr($block->getHeight()) ?>"
18+
alt="<?= $escaper->escapeHtmlAttr($block->getLabel()) ?>" />

app/code/Magento/Catalog/view/frontend/templates/product/image_with_borders.phtml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,20 @@
44
* See COPYING.txt for license details.
55
*/
66
?>
7-
<?php /** @var $block \Magento\Catalog\Block\Product\Image */ ?>
7+
<?php
8+
/** @var $block \Magento\Catalog\Block\Product\Image */
9+
/** @var $escaper \Magento\Framework\Escaper */
10+
?>
811

912
<span class="product-image-container"
10-
style="width:<?= $block->escapeHtmlAttr($block->getWidth()) ?>px;">
13+
style="width:<?= $escaper->escapeHtmlAttr($block->getWidth()) ?>px;">
1114
<span class="product-image-wrapper"
1215
style="padding-bottom: <?= ($block->getRatio() * 100) ?>%;">
13-
<img class="<?= $block->escapeHtmlAttr($block->getClass()) ?>"
14-
<?= $block->escapeHtmlAttr($block->getCustomAttributes()) ?>
15-
src="<?= $block->escapeUrl($block->getImageUrl()) ?>"
16-
max-width="<?= $block->escapeHtmlAttr($block->getWidth()) ?>"
17-
max-height="<?= $block->escapeHtmlAttr($block->getHeight()) ?>"
18-
alt="<?= /* @noEscape */ $block->stripTags($block->getLabel(), null, true) ?>"/></span>
16+
<img class="<?= $escaper->escapeHtmlAttr($block->getClass()) ?>"
17+
<?= $escaper->escapeHtmlAttr($block->getCustomAttributes()) ?>
18+
src="<?= $escaper->escapeUrl($block->getImageUrl()) ?>"
19+
loading="lazy"
20+
width="<?= $escaper->escapeHtmlAttr($block->getWidth()) ?>"
21+
height="<?= $escaper->escapeHtmlAttr($block->getHeight()) ?>"
22+
alt="<?= $escaper->escapeHtmlAttr($block->getLabel()) ?>"/></span>
1923
</span>

app/code/Magento/Cms/Test/Unit/Ui/Component/Listing/Column/PageActionsTest.php

Lines changed: 153 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -3,91 +3,112 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Cms\Test\Unit\Ui\Component\Listing\Column;
79

810
use Magento\Cms\Ui\Component\Listing\Column\PageActions;
11+
use Magento\Cms\ViewModel\Page\Grid\UrlBuilder;
912
use Magento\Framework\Escaper;
13+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
14+
use Magento\Framework\UrlInterface;
15+
use Magento\Framework\View\Element\UiComponent\ContextInterface;
16+
use Magento\Framework\View\Element\UiComponent\Processor;
17+
use PHPUnit\Framework\TestCase;
18+
use PHPUnit_Framework_MockObject_MockObject as MockObject;
1019

1120
/**
1221
* Test for Magento\Cms\Ui\Component\Listing\Column\PageActions class.
1322
*/
14-
class PageActionsTest extends \PHPUnit\Framework\TestCase
23+
class PageActionsTest extends TestCase
1524
{
16-
public function testPrepareItemsByPageId()
25+
26+
/**
27+
* @var UrlInterface|MockObject
28+
*/
29+
private $urlBuilderMock;
30+
31+
/**
32+
* @var UrlBuilder|MockObject
33+
*/
34+
private $scopeUrlBuilderMock;
35+
36+
/**
37+
* @var ContextInterface|MockObject
38+
*/
39+
private $contextMock;
40+
41+
/**
42+
* @var Processor|MockObject
43+
*/
44+
private $processorMock;
45+
46+
/**
47+
* @var Escaper|MockObject
48+
*/
49+
private $escaperMock;
50+
51+
/**
52+
* @var PageActions
53+
*/
54+
private $model;
55+
56+
/**
57+
* @inheritDoc
58+
*/
59+
public function setUp()
1760
{
18-
$pageId = 1;
19-
// Create Mocks and SUT
20-
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
21-
/** @var \PHPUnit_Framework_MockObject_MockObject $urlBuilderMock */
22-
$urlBuilderMock = $this->getMockBuilder(\Magento\Framework\UrlInterface::class)
23-
->disableOriginalConstructor()
24-
->getMock();
25-
$contextMock = $this->getMockBuilder(\Magento\Framework\View\Element\UiComponent\ContextInterface::class)
61+
$this->urlBuilderMock = $this->createMock(UrlInterface::class);
62+
$this->scopeUrlBuilderMock = $this->createMock(UrlBuilder::class);
63+
$this->processorMock = $this->createMock(Processor::class);
64+
$this->contextMock = $this->getMockBuilder(ContextInterface::class)
2665
->getMockForAbstractClass();
27-
$processor = $this->getMockBuilder(\Magento\Framework\View\Element\UiComponent\Processor::class)
66+
$this->escaperMock = $this->getMockBuilder(Escaper::class)
2867
->disableOriginalConstructor()
68+
->setMethods(['escapeHtml'])
2969
->getMock();
30-
$contextMock->expects($this->never())->method('getProcessor')->willReturn($processor);
3170

32-
/** @var \Magento\Cms\Ui\Component\Listing\Column\PageActions $model */
33-
$model = $objectManager->getObject(
34-
\Magento\Cms\Ui\Component\Listing\Column\PageActions::class,
71+
$objectManager = new ObjectManager($this);
72+
73+
$this->model = $objectManager->getObject(
74+
PageActions::class,
3575
[
36-
'urlBuilder' => $urlBuilderMock,
37-
'context' => $contextMock,
76+
'urlBuilder' => $this->urlBuilderMock,
77+
'context' => $this->contextMock,
78+
'scopeUrlBuilder' => $this->scopeUrlBuilderMock
3879
]
3980
);
4081

41-
$escaper = $this->getMockBuilder(Escaper::class)
42-
->disableOriginalConstructor()
43-
->setMethods(['escapeHtml'])
44-
->getMock();
45-
$objectManager->setBackwardCompatibleProperty($model, 'escaper', $escaper);
46-
47-
// Define test input and expectations
48-
$title = 'page title';
49-
$items = [
50-
'data' => [
51-
'items' => [
52-
[
53-
'page_id' => $pageId,
54-
'title' => $title
55-
]
56-
]
57-
]
58-
];
59-
$name = 'item_name';
60-
$expectedItems = [
61-
[
62-
'page_id' => $pageId,
63-
'title' => $title,
64-
$name => [
65-
'edit' => [
66-
'href' => 'test/url/edit',
67-
'label' => __('Edit'),
68-
'__disableTmpl' => true,
69-
],
70-
'delete' => [
71-
'href' => 'test/url/delete',
72-
'label' => __('Delete'),
73-
'confirm' => [
74-
'title' => __('Delete %1', $title),
75-
'message' => __('Are you sure you want to delete a %1 record?', $title),
76-
'__disableTmpl' => true,
77-
],
78-
'post' => true,
79-
'__disableTmpl' => true,
80-
],
81-
],
82-
],
83-
];
82+
$objectManager->setBackwardCompatibleProperty($this->model, 'escaper', $this->escaperMock);
83+
}
8484

85-
$escaper->expects(static::once())
85+
/**
86+
* Verify Prepare Items by page Id.
87+
*
88+
* @dataProvider configDataProvider
89+
* @param int $pageId
90+
* @param string $title
91+
* @param string $name
92+
* @param array $items
93+
* @param array $expectedItems
94+
* @return void
95+
*/
96+
public function testPrepareItemsByPageId(
97+
int $pageId,
98+
string $title,
99+
string $name,
100+
array $items,
101+
array $expectedItems
102+
):void {
103+
$this->contextMock->expects($this->never())
104+
->method('getProcessor')
105+
->willReturn($this->processorMock);
106+
$this->escaperMock->expects(static::once())
86107
->method('escapeHtml')
87108
->with($title)
88109
->willReturn($title);
89110
// Configure mocks and object data
90-
$urlBuilderMock->expects($this->any())
111+
$this->urlBuilderMock->expects($this->any())
91112
->method('getUrl')
92113
->willReturnMap(
93114
[
@@ -107,9 +128,77 @@ public function testPrepareItemsByPageId()
107128
],
108129
]
109130
);
110-
$model->setName($name);
111-
$items = $model->prepareDataSource($items);
131+
132+
$this->scopeUrlBuilderMock->expects($this->any())
133+
->method('getUrl')
134+
->willReturn('test/url/view');
135+
136+
$this->model->setName($name);
137+
$items = $this->model->prepareDataSource($items);
112138
// Run test
113139
$this->assertEquals($expectedItems, $items['data']['items']);
114140
}
141+
142+
/**
143+
* Data provider for testPrepareItemsByPageId
144+
*
145+
* @return array
146+
*/
147+
public function configDataProvider():array
148+
{
149+
$pageId = 1;
150+
$title = 'page title';
151+
$identifier = 'page_identifier';
152+
$name = 'item_name';
153+
154+
return [
155+
[
156+
'pageId' => $pageId,
157+
'title' => $title,
158+
'name' => $name,
159+
'items' => [
160+
'data' => [
161+
'items' => [
162+
[
163+
'page_id' => $pageId,
164+
'title' => $title,
165+
'identifier' => $identifier
166+
]
167+
]
168+
]
169+
],
170+
'expectedItems' => [
171+
[
172+
'page_id' => $pageId,
173+
'title' => $title,
174+
'identifier' => $identifier,
175+
$name => [
176+
'edit' => [
177+
'href' => 'test/url/edit',
178+
'label' => __('Edit'),
179+
'__disableTmpl' => true,
180+
],
181+
'delete' => [
182+
'href' => 'test/url/delete',
183+
'label' => __('Delete'),
184+
'confirm' => [
185+
'title' => __('Delete %1', $title),
186+
'message' => __('Are you sure you want to delete a %1 record?', $title),
187+
'__disableTmpl' => true,
188+
],
189+
'post' => true,
190+
'__disableTmpl' => true,
191+
],
192+
'preview' => [
193+
'href' => 'test/url/view',
194+
'label' => __('View'),
195+
'__disableTmpl' => true,
196+
'target' => '_blank'
197+
]
198+
],
199+
],
200+
]
201+
]
202+
];
203+
}
115204
}

app/code/Magento/Cms/Ui/Component/Listing/Column/PageActions.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Magento\Ui\Component\Listing\Columns\Column;
1515

1616
/**
17-
* Class PageActions
17+
* Class prepare Page Actions
1818
*/
1919
class PageActions extends Column
2020
{
@@ -111,6 +111,7 @@ public function prepareDataSource(array $dataSource)
111111
),
112112
'label' => __('View'),
113113
'__disableTmpl' => true,
114+
'target' => '_blank'
114115
];
115116
}
116117
}

app/code/Magento/Multishipping/Model/Cart/CartTotalRepositoryPlugin.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,21 @@ public function __construct(
3333
}
3434

3535
/**
36-
* Overwrite the CartTotalRepository quoteTotal and update the shipping price
36+
* Check multishipping update shipping price after get cart total
3737
*
38-
* @param CartTotalRepository $subject
39-
* @param Totals $quoteTotals
40-
* @param String $cartId
41-
* @return Totals
42-
* @throws \Magento\Framework\Exception\NoSuchEntityException
38+
* @param CartTotalRepository $subject
39+
* @param Totals $quoteTotals
40+
* @param int $cartId
41+
* @return Totals
42+
* @throws \Magento\Framework\Exception\NoSuchEntityException
4343
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
4444
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
4545
*/
4646
public function afterGet(
4747
CartTotalRepository $subject,
4848
Totals $quoteTotals,
49-
String $cartId
50-
) {
49+
$cartId
50+
) : Totals {
5151
$quote = $this->quoteRepository->getActive($cartId);
5252
if ($quote->getIsMultiShipping()) {
5353
$shippingMethod = $quote->getShippingAddress()->getShippingMethod();

0 commit comments

Comments
 (0)