Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 9793d28

Browse files
committed
Merge branch 'MAGETWO-81915' into MPI-PR-2.2.1
2 parents aa24c9d + 41d67c2 commit 9793d28

File tree

3 files changed

+46
-3
lines changed

3 files changed

+46
-3
lines changed

app/code/Magento/Theme/Model/Config/Processor/DesignTheme.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ public function process(array $config)
7272
private function changeThemeFullPathToIdentifier($configItems)
7373
{
7474
$theme = null;
75-
if ($this->arrayManager->exists(DesignInterface::XML_PATH_THEME_ID, $configItems)) {
76-
$themeIdentifier = $this->arrayManager->get(DesignInterface::XML_PATH_THEME_ID, $configItems);
75+
$themeIdentifier = $this->arrayManager->get(DesignInterface::XML_PATH_THEME_ID, $configItems);
76+
if (!empty($themeIdentifier)) {
7777
if (!is_numeric($themeIdentifier)) {
7878
// workaround for case when db is not available
7979
try {

app/code/Magento/Theme/Test/Unit/Model/Config/Processor/DesignThemeTest.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66
namespace Magento\Theme\Test\Unit\Model\Config\Processor;
77

8-
use Magento\Config\App\Config\Source\DumpConfigSourceAggregated;
98
use Magento\Framework\Stdlib\ArrayManager;
109
use Magento\Framework\View\Design\Theme\ListInterface;
1110
use Magento\Theme\Model\Config\Processor\DesignTheme;
@@ -78,6 +77,7 @@ private function prepareThemeMock()
7877

7978
/**
8079
* @return array
80+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
8181
*/
8282
public function getDumpConfigDataProvider()
8383
{
@@ -163,6 +163,22 @@ public function getDumpConfigDataProvider()
163163
],
164164
],
165165
],
166+
[
167+
[
168+
'websites' => [
169+
'base' => [
170+
'design' => ['theme' => ['theme_id' => '']],
171+
],
172+
],
173+
],
174+
[
175+
'websites' => [
176+
'base' => [
177+
'design' => ['theme' => ['theme_id' => '']],
178+
],
179+
],
180+
],
181+
],
166182
];
167183
}
168184
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Theme\Model\Config\Processor;
7+
8+
use Magento\TestFramework\Helper\Bootstrap;
9+
10+
class DesignThemeTest extends \PHPUnit\Framework\TestCase
11+
{
12+
/**
13+
* Verifies that empty 'design/theme/theme_id' config value is processed without errors.
14+
*/
15+
public function testProcessWithEmptyThemeId()
16+
{
17+
$designTheme = Bootstrap::getObjectManager()->create(DesignTheme::class);
18+
19+
$config = [
20+
'default' => [
21+
'design' => ['theme' => ['theme_id' => '']],
22+
],
23+
];
24+
25+
$this->assertEquals($config, $designTheme->process($config));
26+
}
27+
}

0 commit comments

Comments
 (0)