Skip to content

Commit a263da5

Browse files
committed
MAGETWO-88187: Magento 2.1.3 to 2.2.1 upgrade issue
1 parent cec4bf4 commit a263da5

File tree

3 files changed

+45
-3
lines changed

3 files changed

+45
-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: 16 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;
@@ -162,6 +161,22 @@ public function getDumpConfigDataProvider()
162161
],
163162
],
164163
],
164+
[
165+
[
166+
'websites' => [
167+
'base' => [
168+
'design' => ['theme' => ['theme_id' => '']],
169+
],
170+
],
171+
],
172+
[
173+
'websites' => [
174+
'base' => [
175+
'design' => ['theme' => ['theme_id' => '']],
176+
],
177+
],
178+
],
179+
],
165180
],
166181
];
167182
}
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)