Skip to content

Commit 57110a2

Browse files
committed
MAGETWO-93305: Broken upgrade to 2.3 due to changed data type for minify_exclude
- fix backward incompatibility
1 parent b1ce314 commit 57110a2

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

lib/internal/Magento/Framework/View/Asset/Minification.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,10 @@ public function getExcludes($contentType)
162162
private function getMinificationExcludeValues($key)
163163
{
164164
$configValues = $this->scopeConfig->getValue($key, $this->scope) ?? [];
165-
165+
//compatibility fix for type change from string to array
166+
if (!is_array($configValues)) {
167+
$configValues = [$configValues => $configValues];
168+
}
166169
return array_values($configValues);
167170
}
168171
}

lib/internal/Magento/Framework/View/Test/Unit/Asset/MinificationTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ public function isMinifiedFilenameDataProvider()
195195
}
196196

197197
/**
198+
* Test dev/js/minify_exclude system value as array
199+
*
198200
* @return void
199201
*/
200202
public function testGetExcludes()
@@ -213,4 +215,23 @@ public function testGetExcludes()
213215
/** check cache: */
214216
$this->assertEquals($expected, $this->minification->getExcludes('js'));
215217
}
218+
219+
/**
220+
* Test dev/js/minify_exclude system value backward compatibility when value was a string
221+
*
222+
* @return void
223+
*/
224+
public function testGetExcludesTinyMceAsString()
225+
{
226+
$this->scopeConfigMock
227+
->expects($this->once())
228+
->method('getValue')
229+
->with('dev/js/minify_exclude')
230+
->willReturn('/tiny_mce/');
231+
232+
$expected = ['/tiny_mce/'];
233+
$this->assertEquals($expected, $this->minification->getExcludes('js'));
234+
/** check cache: */
235+
$this->assertEquals($expected, $this->minification->getExcludes('js'));
236+
}
216237
}

0 commit comments

Comments
 (0)