Skip to content

Commit 9a3ae42

Browse files
committed
Merge remote-tracking branch 'origin/MC-33069-CE-6' into MC-33069
2 parents 1b41d6d + f8a3a28 commit 9a3ae42

File tree

12 files changed

+68
-33
lines changed

12 files changed

+68
-33
lines changed

app/code/Magento/PageCache/Controller/Block/Render.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
*/
77
namespace Magento\PageCache\Controller\Block;
88

9-
class Render extends \Magento\PageCache\Controller\Block
9+
use Magento\Framework\App\Action\HttpGetActionInterface;
10+
11+
class Render extends \Magento\PageCache\Controller\Block implements HttpGetActionInterface
1012
{
1113
/**
1214
* Returns block content depends on ajax request
@@ -27,13 +29,15 @@ public function execute()
2729
$currentRequestUri = $this->getRequest()->getRequestUri();
2830

2931
$origRequest = $this->getRequest()->getParam('originalRequest');
30-
if ($origRequest && is_string($origRequest)) {
31-
$origRequest = json_decode($origRequest, true);
32+
if ($origRequest !== null) {
33+
if ($origRequest && is_string($origRequest)) {
34+
$origRequest = json_decode($origRequest, true);
35+
}
36+
$this->getRequest()->setRouteName($origRequest['route']);
37+
$this->getRequest()->setControllerName($origRequest['controller']);
38+
$this->getRequest()->setActionName($origRequest['action']);
39+
$this->getRequest()->setRequestUri($origRequest['uri']);
3240
}
33-
$this->getRequest()->setRouteName($origRequest['route']);
34-
$this->getRequest()->setControllerName($origRequest['controller']);
35-
$this->getRequest()->setActionName($origRequest['action']);
36-
$this->getRequest()->setRequestUri($origRequest['uri']);
3741

3842
/** @var \Magento\Framework\View\Element\BlockInterface[] $blocks */
3943
$blocks = $this->_getBlocks();

app/code/Magento/PageCache/Test/Unit/Controller/Block/RenderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,11 @@ public function testExecuteNotAjax()
140140
public function testExecuteNoParams()
141141
{
142142
$this->requestMock->expects($this->once())->method('isAjax')->willReturn(true);
143-
$this->requestMock->expects($this->at(10))
143+
$this->requestMock->expects($this->at(6))
144144
->method('getParam')
145145
->with('blocks', '')
146146
->willReturn('');
147-
$this->requestMock->expects($this->at(11))
147+
$this->requestMock->expects($this->at(7))
148148
->method('getParam')
149149
->with('handles', '')
150150
->willReturn('');

lib/internal/Magento/Framework/Archive/Tar.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
class Tar extends \Magento\Framework\Archive\AbstractArchive implements \Magento\Framework\Archive\ArchiveInterface
1717
{
1818
/**
19-
* Tar block size
19+
* Define acceptable tar block size.
2020
*
2121
* @const int
2222
*/
@@ -447,12 +447,12 @@ protected function _extractFileHeader()
447447

448448
$header = unpack(self::_getFormatParseHeader(), $headerBlock);
449449

450-
$header['mode'] = octdec($header['mode']);
451-
$header['uid'] = octdec($header['uid']);
452-
$header['gid'] = octdec($header['gid']);
453-
$header['size'] = octdec($header['size']);
454-
$header['mtime'] = octdec($header['mtime']);
455-
$header['checksum'] = octdec($header['checksum']);
450+
$header['mode'] = octdec((int)$header['mode']);
451+
$header['uid'] = octdec((int)$header['uid']);
452+
$header['gid'] = octdec((int)$header['gid']);
453+
$header['size'] = octdec((int)$header['size']);
454+
$header['mtime'] = octdec((int)$header['mtime']);
455+
$header['checksum'] = octdec((int)$header['checksum']);
456456

457457
if ($header['type'] == "5") {
458458
$header['size'] = 0;

lib/internal/Magento/Framework/Cache/Test/Unit/CoreTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ public function testSave()
112112
->method('save')
113113
->with($data, $this->anything(), $prefixedTags)
114114
->willReturn(true);
115+
$backendMock->expects($this->once())
116+
->method('getCapabilities')
117+
->willReturn(['priority' => null]);
115118
$frontend = new Core([
116119
'disable_save' => false,
117120
'caching' => true,

lib/internal/Magento/Framework/EntityManager/Sequence/SequenceApplier.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ public function apply($entity)
7171
$entityType = $this->typeResolver->resolve($entity);
7272

7373
/** @var \Magento\Framework\DB\Sequence\SequenceInterface|null $sequence */
74-
$sequence = $this->sequenceRegistry->retrieve($entityType)['sequence'];
74+
$sequence = $this->sequenceRegistry->retrieve($entityType) ?
75+
$this->sequenceRegistry->retrieve($entityType)['sequence'] : null;
7576

7677
if ($sequence) {
7778
$metadata = $this->metadataPool->getMetadata($entityType);

lib/internal/Magento/Framework/EntityManager/Test/Unit/Sequence/SequenceApplierTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function testApplyEntityHasIdentifier()
138138
->method('resolve')
139139
->with($this->entityMock)
140140
->willReturn($entityType);
141-
$this->sequenceRegistryMock->expects($this->once())
141+
$this->sequenceRegistryMock->expects($this->exactly(2))
142142
->method('retrieve')
143143
->with($entityType)
144144
->willReturn($sequenceInfo);
@@ -176,7 +176,7 @@ public function testApplyEntityDoesNotHaveIdentifier()
176176
->method('resolve')
177177
->with($this->entityMock)
178178
->willReturn($entityType);
179-
$this->sequenceRegistryMock->expects($this->once())
179+
$this->sequenceRegistryMock->expects($this->exactly(2))
180180
->method('retrieve')
181181
->with($entityType)
182182
->willReturn($sequenceInfo);

lib/internal/Magento/Framework/View/Helper/PathPattern.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function translatePatternFromGlob($path)
3939
protected function translateGroupsFromGlob($pattern)
4040
{
4141
preg_match_all('~\\\\\\{[^,\\}]+(?:,[^,\\}]*)*\\\\\\}~', $pattern, $matches, PREG_OFFSET_CAPTURE);
42-
for ($index = count($matches[0]) - 1; $index >= 0; $index -= 1) {
42+
for ($index = count($matches[0]) - 1; $index >= 0; --$index) {
4343
list($match, $offset) = $matches[0][$index];
4444
$replacement = substr_replace($match, '(?:', 0, 2);
4545
$replacement = substr_replace($replacement, ')', -2);
@@ -65,9 +65,9 @@ protected function translateGroupsFromGlob($pattern)
6565
protected function translateCharacterGroupsFromGlob($pattern)
6666
{
6767
preg_match_all('~\\\\\\[(\\\\\\!)?[^\\]]+\\\\\\]~i', $pattern, $matches, PREG_OFFSET_CAPTURE);
68-
for ($index = count($matches[0]) - 1; $index >= 0; $index -= 1) {
68+
for ($index = count($matches[0]) - 1; $index >= 0; --$index) {
6969
list($match, $offset) = $matches[0][$index];
70-
$exclude = !empty($matches[1][$index]);
70+
$exclude = !empty($matches[1][$index][0]);
7171
$replacement = substr_replace($match, '[' . ($exclude ? '^' : ''), 0, $exclude ? 4 : 2);
7272
$replacement = substr_replace($replacement, ']', -2);
7373
$replacement = str_replace('\\-', '-', $replacement);

setup/src/Magento/Setup/Fixtures/Quote/QuoteGenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ private function prepareQueryTemplates()
583583
* @param array $replacements
584584
* @return void
585585
*/
586-
protected function query($table, ... $replacements)
586+
protected function query($table, ...$replacements)
587587
{
588588
$query = $this->queryTemplates[$table];
589589
foreach ($replacements as $data) {
@@ -689,7 +689,7 @@ private function prepareConfigurableProducts(array $productIds = [])
689689
foreach ($options as $option) {
690690
$attributesInfo[] = [
691691
"label" => $option->getLabel(),
692-
"value" => $option['options']['0']['label'],
692+
"value" => isset($option['options']) ? $option['options']['0']['label'] : null,
693693
"option_id" => $option->getAttributeId(),
694694
"option_value" => $option->getValues()[0]->getValueIndex()
695695
];

setup/src/Magento/Setup/Test/Unit/Controller/InstallTest.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,14 @@ public function testStartAction()
9999
{
100100
$this->webLogger->expects($this->once())->method('clear');
101101
$this->installer->expects($this->once())->method('install');
102-
$this->installer->expects($this->exactly(2))->method('getInstallInfo');
102+
$this->installer->expects($this->exactly(2))
103+
->method('getInstallInfo')
104+
->willReturn(
105+
[
106+
'key' => null,
107+
'message' => null,
108+
]
109+
);
103110
$this->deploymentConfig->expects($this->once())->method('isAvailable')->willReturn(false);
104111
$jsonModel = $this->controller->startAction();
105112
$this->assertInstanceOf(JsonModel::class, $jsonModel);
@@ -140,6 +147,14 @@ public function testStartActionWithSampleDataError()
140147
$this->webLogger->expects($this->never())->method('logError');
141148
$this->deploymentConfig->expects($this->once())->method('isAvailable')->willReturn(false);
142149
$this->installer->method('install');
150+
$this->installer->expects($this->exactly(2))
151+
->method('getInstallInfo')
152+
->willReturn(
153+
[
154+
'key' => null,
155+
'message' => null,
156+
]
157+
);
143158
$this->sampleDataState->expects($this->once())->method('hasError')->willReturn(true);
144159
$jsonModel = $this->controller->startAction();
145160
$this->assertInstanceOf(JsonModel::class, $jsonModel);

setup/src/Magento/Setup/Test/Unit/Fixtures/CartPriceRulesFixtureTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public function testGenerateAdvancedCondition($ruleId, $categoriesArray, $ruleCo
173173
'type' => Product::class,
174174
'attribute' => 'category_ids',
175175
'operator' => '==',
176-
'value' => null,
176+
'value' => 0,
177177
];
178178

179179
$secondCondition = [
@@ -261,8 +261,8 @@ public function testGenerateAdvancedCondition($ruleId, $categoriesArray, $ruleCo
261261
public function dataProviderGenerateAdvancedCondition()
262262
{
263263
return [
264-
[1, [0], 1],
265-
[1, [0], 300]
264+
[1, [[0]], 1],
265+
[1, [[0]], 300]
266266
];
267267
}
268268

0 commit comments

Comments
 (0)