Skip to content

Commit a655eeb

Browse files
ENGCOM-9071: Allow underscore in extended static files in theme #32620
- Merge Pull Request #32620 from bentideswell/magento2:2.4-develop - Merged commits: 1. a3b124a 2. e17a3e7 3. df94b8a 4. 696f7ee 5. 96f58e7 6. 87c4a75
2 parents 5f05166 + 87c4a75 commit a655eeb

File tree

5 files changed

+48
-2
lines changed

5 files changed

+48
-2
lines changed

dev/tests/integration/testsuite/Magento/Framework/App/Utility/FilesTest.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
namespace Magento\Framework\App\Utility;
88

9-
use Magento\Framework\App\Utility\Files;
109
use Magento\Framework\Component\ComponentRegistrar;
1110

1211
class FilesTest extends \PHPUnit\Framework\TestCase
@@ -159,4 +158,24 @@ public function testReadLists()
159158
}
160159
$this->assertSame($expected, $actual);
161160
}
161+
162+
/**
163+
* Tests if underscores are allowed in extended static files in theme.
164+
*
165+
* @magentoComponentsDir Magento/Framework/App/Utility/_files/design
166+
* @magentoAppIsolation enabled
167+
* @magentoDbIsolation enabled
168+
*/
169+
public function testAllowUnderscoreInExtendedFiles()
170+
{
171+
$this->assertNotEmpty(
172+
array_filter(
173+
$this->model->getStaticPreProcessingFiles('*.less'),
174+
function ($resource) {
175+
return $resource[3] === 'Module_Third_Party'
176+
&& $resource[4] === 'css/source/_module.less';
177+
}
178+
)
179+
);
180+
}
162181
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
.a-random-css-rule {
6+
background: red;
7+
}
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
use Magento\Framework\Component\ComponentRegistrar;
8+
9+
ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/FrameworkUtilityTest/default', __DIR__);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
9+
<title>Test Default</title>
10+
</theme>

lib/internal/Magento/Framework/App/Utility/Files.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,7 @@ private function accumulateThemeStaticFiles($area, $locale, $filePattern, &$resu
936936
];
937937
$this->_accumulateFilesByPatterns($paths, $filePattern, $files);
938938
$regex = '#^' . $themePath .
939-
'/((?P<module>[a-z\d]+_[a-z\d]+)/)?web/(i18n/(?P<locale>[a-z_]+)/)?(?P<path>.+)$#i';
939+
'/((?P<module>[a-z\d]+_[a-z_\d]+)/)?web/(i18n/(?P<locale>[a-z_]+)/)?(?P<path>.+)$#i';
940940
foreach ($files as $file) {
941941
if (preg_match($regex, $file, $matches)) {
942942
$result[] = [

0 commit comments

Comments
 (0)