Skip to content

Commit 9ec8a6c

Browse files
committed
MAGETWO-93305: Broken upgrade to 2.3 due to changed data type for minify_exclude
- adding multi value string support divided by \n
1 parent 57110a2 commit 9ec8a6c

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,9 @@ public function getExcludes($contentType)
162162
private function getMinificationExcludeValues($key)
163163
{
164164
$configValues = $this->scopeConfig->getValue($key, $this->scope) ?? [];
165-
//compatibility fix for type change from string to array
165+
//compatibility fix for type change from new line separated string values to array
166166
if (!is_array($configValues)) {
167-
$configValues = [$configValues => $configValues];
167+
$configValues = explode("\n", $configValues);
168168
}
169169
return array_values($configValues);
170170
}

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

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,19 +219,34 @@ public function testGetExcludes()
219219
/**
220220
* Test dev/js/minify_exclude system value backward compatibility when value was a string
221221
*
222+
* @param string $value
223+
* @param array $expectedValue
222224
* @return void
225+
*
226+
* @dataProvider getExcludesTinyMceAsStringDataProvider
223227
*/
224-
public function testGetExcludesTinyMceAsString()
228+
public function testGetExcludesTinyMceAsString(string $value, array $expectedValue)
225229
{
226230
$this->scopeConfigMock
227231
->expects($this->once())
228232
->method('getValue')
229233
->with('dev/js/minify_exclude')
230-
->willReturn('/tiny_mce/');
234+
->willReturn($value);
231235

232-
$expected = ['/tiny_mce/'];
233-
$this->assertEquals($expected, $this->minification->getExcludes('js'));
236+
$this->assertEquals($expectedValue, $this->minification->getExcludes('js'));
234237
/** check cache: */
235-
$this->assertEquals($expected, $this->minification->getExcludes('js'));
238+
$this->assertEquals($expectedValue, $this->minification->getExcludes('js'));
239+
}
240+
241+
242+
/**
243+
* @return array
244+
*/
245+
public function getExcludesTinyMceAsStringDataProvider()
246+
{
247+
return [
248+
["/tiny_mce/\n/tiny_mce2/", ['/tiny_mce/', '/tiny_mce2/']],
249+
['/tiny_mce/', ['/tiny_mce/']],
250+
];
236251
}
237252
}

0 commit comments

Comments
 (0)