Skip to content

Commit 9ef1621

Browse files
author
Oleksii Korshenko
committed
MAGETWO-87056: [EngCom Team] Batch 2. Forwardports to 2.3-develop #1283
- Merge Pull Request magento-engcom/magento2ce#1283 from magento-engcom-team/magento2:batch-2-forwardport-2.3-develop - Merged commits: 1. 0742857 2. fde512e 3. e7d90de 4. 6d4f36d 5. 2e83a36 6. 23b4aa1 7. b50bfa8 8. 04cd60d 9. 75d5a05 10. 5e02b15 11. aad5ba6 12. 3e32140 13. 7898946 14. a173e1c 15. 41d0075 16. dda19b2 17. cba48cd 18. 0c62caa 19. 736f783 20. 7569b70
2 parents 8e77e2f + 7569b70 commit 9ef1621

File tree

17 files changed

+104
-19
lines changed

17 files changed

+104
-19
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -780,11 +780,14 @@ public function getAllChildren($asArray = false)
780780
/**
781781
* Retrieve children ids comma separated
782782
*
783+
* @param boolean $recursive
784+
* @param boolean $isActive
785+
* @param boolean $sortByPosition
783786
* @return string
784787
*/
785-
public function getChildren()
788+
public function getChildren($recursive = false, $isActive = true, $sortByPosition = false)
786789
{
787-
return implode(',', $this->getResource()->getChildren($this, false));
790+
return implode(',', $this->getResource()->getChildren($this, $recursive, $isActive, $sortByPosition));
788791
}
789792

790793
/**

app/code/Magento/Catalog/Model/ResourceModel/Category/Flat.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,9 +602,10 @@ public function isInRootCategoryList($category)
602602
* @param \Magento\Catalog\Model\Category $category
603603
* @param bool $recursive
604604
* @param bool $isActive
605+
* @param bool $sortByPosition
605606
* @return array
606607
*/
607-
public function getChildren($category, $recursive = true, $isActive = true)
608+
public function getChildren($category, $recursive = true, $isActive = true, $sortByPosition = false)
608609
{
609610
$select = $this->getConnection()->select()->from(
610611
$this->getMainStoreTable($category->getStoreId()),
@@ -619,6 +620,9 @@ public function getChildren($category, $recursive = true, $isActive = true)
619620
if ($isActive) {
620621
$select->where('is_active = ?', '1');
621622
}
623+
if ($sortByPosition) {
624+
$select->order('position ASC');
625+
}
622626
$_categories = $this->getConnection()->fetchAll($select);
623627
$categoriesIds = [];
624628
foreach ($_categories as $_category) {

app/code/Magento/Checkout/i18n/en_US.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,4 @@ Payment,Payment
176176
"Not yet calculated","Not yet calculated"
177177
"We received your order!","We received your order!"
178178
"Thank you for your purchase!","Thank you for your purchase!"
179+
"optional", "optional"

app/code/Magento/Cms/i18n/en_US.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ Block,Block
133133
"Enable Page","Enable Page"
134134
Content,Content
135135
"Content Heading","Content Heading"
136-
"Search Engine Optimisation","Search Engine Optimisation"
136+
"Search Engine Optimization","Search Engine Optimization"
137137
"Meta Title","Meta Title"
138138
"Meta Keywords","Meta Keywords"
139139
"Meta Description","Meta Description"

app/code/Magento/Cms/view/adminhtml/ui_component/cms_page_form.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141
<fieldset name="search_engine_optimisation" sortOrder="20">
142142
<settings>
143143
<collapsible>true</collapsible>
144-
<label translate="true">Search Engine Optimisation</label>
144+
<label translate="true">Search Engine Optimization</label>
145145
</settings>
146146
<field name="identifier" formElement="input">
147147
<argument name="data" xsi:type="array">

app/code/Magento/Indexer/Model/Indexer.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,11 @@ public function reindexAll()
418418
$state->save();
419419
$this->getView()->resume();
420420
throw $exception;
421+
} catch (\Error $error) {
422+
$state->setStatus(StateInterface::STATUS_INVALID);
423+
$state->save();
424+
$this->getView()->resume();
425+
throw $error;
421426
}
422427
}
423428
}

app/code/Magento/Indexer/Test/Unit/Model/IndexerTest.php

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,56 @@ function () {
273273
$this->model->reindexAll();
274274
}
275275

276+
/**
277+
* @expectedException \Error
278+
* @expectedExceptionMessage Test Engine Error
279+
*/
280+
public function testReindexAllWithError()
281+
{
282+
283+
$indexId = 'indexer_internal_name';
284+
$this->loadIndexer($indexId);
285+
286+
$stateMock = $this->createPartialMock(
287+
\Magento\Indexer\Model\Indexer\State::class,
288+
['load', 'getId', 'setIndexerId', '__wakeup', 'getStatus', 'setStatus', 'save']
289+
);
290+
$stateMock->expects($this->once())->method('load')->with($indexId, 'indexer_id')->will($this->returnSelf());
291+
$stateMock->expects($this->never())->method('setIndexerId');
292+
$stateMock->expects($this->once())->method('getId')->will($this->returnValue(1));
293+
$stateMock->expects($this->exactly(2))->method('setStatus')->will($this->returnSelf());
294+
$stateMock->expects($this->once())->method('getStatus')->will($this->returnValue('idle'));
295+
$stateMock->expects($this->exactly(2))->method('save')->will($this->returnSelf());
296+
$this->stateFactoryMock->expects($this->once())->method('create')->will($this->returnValue($stateMock));
297+
298+
$this->viewMock->expects($this->once())->method('isEnabled')->will($this->returnValue(false));
299+
$this->viewMock->expects($this->never())->method('suspend');
300+
$this->viewMock->expects($this->once())->method('resume');
301+
302+
$actionMock = $this->createPartialMock(
303+
\Magento\Framework\Indexer\ActionInterface::class,
304+
['executeFull', 'executeList', 'executeRow']
305+
);
306+
$actionMock->expects($this->once())->method('executeFull')->will(
307+
$this->returnCallback(
308+
function () {
309+
throw new \Error('Test Engine Error');
310+
}
311+
)
312+
);
313+
$this->actionFactoryMock->expects(
314+
$this->once()
315+
)->method(
316+
'create'
317+
)->with(
318+
'Some\Class\Name'
319+
)->will(
320+
$this->returnValue($actionMock)
321+
);
322+
323+
$this->model->reindexAll();
324+
}
325+
276326
protected function getIndexerData()
277327
{
278328
return [

app/code/Magento/Sales/Helper/Guest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ public function loadValidOrder(App\RequestInterface $request)
178178
public function getBreadcrumbs(\Magento\Framework\View\Result\Page $resultPage)
179179
{
180180
$breadcrumbs = $resultPage->getLayout()->getBlock('breadcrumbs');
181+
if (!$breadcrumbs) {
182+
return;
183+
}
181184
$breadcrumbs->addCrumb(
182185
'home',
183186
[

app/code/Magento/Theme/view/frontend/templates/js/polyfill.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
};
127127

128128
window.localStorage.__proto__ = window.localStorage = new Storage('local');
129-
window.sessionStorage.__proto__ = window.sessionStorag = new Storage('session');
129+
window.sessionStorage.__proto__ = window.sessionStorage = new Storage('session');
130130
})();
131131
}
132132
</script>

app/code/Magento/Widget/Model/Config/Converter.php

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ protected function _convertDepends($source)
222222
{
223223
$depends = [];
224224
foreach ($source->childNodes as $childNode) {
225-
if ($childNode->nodeName == '#text') {
225+
if ($childNode->nodeName === '#text') {
226226
continue;
227227
}
228228
if ($childNode->nodeName !== 'parameter') {
@@ -231,12 +231,23 @@ protected function _convertDepends($source)
231231
);
232232
}
233233
$parameterAttributes = $childNode->attributes;
234-
$depends[$parameterAttributes->getNamedItem(
235-
'name'
236-
)->nodeValue] = [
237-
'value' => $parameterAttributes->getNamedItem('value')->nodeValue,
238-
];
234+
$dependencyName = $parameterAttributes->getNamedItem('name')->nodeValue;
235+
$dependencyValue = $parameterAttributes->getNamedItem('value')->nodeValue;
236+
237+
if (!isset($depends[$dependencyName])) {
238+
$depends[$dependencyName] = [
239+
'value' => $dependencyValue,
240+
];
241+
242+
continue;
243+
} else if (!isset($depends[$dependencyName]['values'])) {
244+
$depends[$dependencyName]['values'] = [$depends[$dependencyName]['value']];
245+
unset($depends[$dependencyName]['value']);
246+
}
247+
248+
$depends[$dependencyName]['values'][] = $dependencyValue;
239249
}
250+
240251
return $depends;
241252
}
242253

0 commit comments

Comments
 (0)