Skip to content

Commit 4ba9235

Browse files
author
Oleksii Korshenko
authored
MAGETWO-87056: [EngCom Team] Batch 2. Forwardports to 2.3-develop #1283
2 parents a1338c6 + 9ef1621 commit 4ba9235

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

app/code/Magento/Widget/etc/widget.xsd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@
212212
<xs:annotation>
213213
<xs:documentation>List of parameters this parameter depends on.</xs:documentation>
214214
</xs:annotation>
215-
<xs:all>
215+
<xs:sequence maxOccurs="unbounded">
216216
<xs:element name="parameter" type="dependsParameterType" />
217-
</xs:all>
217+
</xs:sequence>
218218
</xs:complexType>
219219
</xs:schema>

app/code/Magento/Widget/etc/widget_file.xsd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@
212212
<xs:annotation>
213213
<xs:documentation>List of parameters this parameter depends on.</xs:documentation>
214214
</xs:annotation>
215-
<xs:all>
215+
<xs:sequence maxOccurs="unbounded">
216216
<xs:element name="parameter" type="dependsParameterType" />
217-
</xs:all>
217+
</xs:sequence>
218218
</xs:complexType>
219219
</xs:schema>

app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_toolbar.less

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
line-height: @toolbar-mode-icon-font-size + 2;
4545
margin: 0;
4646
padding: 7px 0;
47-
position: absolute;
4847
text-align: left;
4948
top: 0;
5049
vertical-align: middle;

dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Edit/PageForm.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
</custom_design>
6969
<seo>
7070
<class>\Magento\Backend\Test\Block\Widget\Tab</class>
71-
<selector>//div[div/strong/span[text()="Search Engine Optimisation"]]</selector>
71+
<selector>//div[div/strong/span[text()="Search Engine Optimization"]]</selector>
7272
<strategy>xpath</strategy>
7373
<fields>
7474
<identifier />

dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryTreeTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,14 @@ public function testGetChildren()
128128
$this->assertEquals(array_diff([4, 13], explode(',', $this->_model->getChildren())), []);
129129
}
130130

131+
public function testGetChildrenSorted()
132+
{
133+
$this->_model->load(2);
134+
$unsorted = explode(',', $this->_model->getChildren());
135+
sort($unsorted);
136+
$this->assertEquals(array_diff($unsorted, explode(',', $this->_model->getChildren(true, true, true))), []);
137+
}
138+
131139
public function testGetPathInStore()
132140
{
133141
$this->_model->load(5);

lib/internal/Magento/Framework/View/Model/Layout/Merge.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ private function getXmlErrors($libXmlErrors)
811811
protected function _getPhysicalTheme(\Magento\Framework\View\Design\ThemeInterface $theme)
812812
{
813813
$result = $theme;
814-
while ($result->getId() && !$result->isPhysical()) {
814+
while ($result !== null && $result->getId() && !$result->isPhysical()) {
815815
$result = $result->getParentTheme();
816816
}
817817
if (!$result) {

setup/src/Magento/Setup/Model/Installer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,7 @@ private function installOrderIncrementPrefix($orderIncrementPrefix)
10101010
public function installAdminUser($data)
10111011
{
10121012
$this->assertDbConfigExists();
1013+
$data += ['db-prefix' => $this->deploymentConfig->get(ConfigOptionsListConstants::CONFIG_PATH_DB_PREFIX)];
10131014
$setup = $this->setupFactory->create($this->context->getResources());
10141015
$adminAccount = $this->adminAccountFactory->create($setup->getConnection(), (array)$data);
10151016
$adminAccount->save();

0 commit comments

Comments
 (0)