Skip to content

Commit f8cd759

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-55510' into PR
2 parents fbe6c10 + 9bd170d commit f8cd759

File tree

2 files changed

+4
-40
lines changed

2 files changed

+4
-40
lines changed

app/code/Magento/Developer/Model/View/Asset/PreProcessor/FrontendCompilation.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,6 @@ public function __construct(
7474
*/
7575
public function process(PreProcessor\Chain $chain)
7676
{
77-
$content = $chain->getContent();
78-
if (trim($content) !== '') {
79-
return;
80-
}
8177

8278
try {
8379
$this->lockerProcess->lockProcess($this->lockName);
@@ -88,7 +84,7 @@ public function process(PreProcessor\Chain $chain)
8884
/** @var FallbackContext $context */
8985
$context = $chain->getAsset()->getContext();
9086

91-
$result = $this->processContent($path, $content, $module, $context);
87+
$result = $this->processContent($path, $chain->getContent(), $module, $context);
9288
$chain->setContent($result['content']);
9389
$chain->setContentType($result['sourceType']);
9490
} finally {
@@ -107,14 +103,14 @@ public function process(PreProcessor\Chain $chain)
107103
*/
108104
private function processContent($path, $content, $module, FallbackContext $context)
109105
{
110-
$sourceType = '#\.' . preg_quote(pathinfo($path, PATHINFO_EXTENSION), '#') . '$#';
106+
$sourceTypePattern = '#\.' . preg_quote(pathinfo($path, PATHINFO_EXTENSION), '#') . '$#';
111107

112108
foreach ($this->alternativeSource->getAlternativesExtensionsNames() as $name) {
113109
$asset = $this->assetBuilder->setArea($context->getAreaCode())
114110
->setTheme($context->getThemePath())
115111
->setLocale($context->getLocale())
116112
->setModule($module)
117-
->setPath(preg_replace($sourceType, '.' . $name, $path))
113+
->setPath(preg_replace($sourceTypePattern, '.' . $name, $path))
118114
->build();
119115

120116
$processedContent = $this->assetSource->getContent($asset);
@@ -129,7 +125,7 @@ private function processContent($path, $content, $module, FallbackContext $conte
129125

130126
return [
131127
'content' => $content,
132-
'sourceType' => $sourceType
128+
'sourceType' => pathinfo($path, PATHINFO_EXTENSION)
133129
];
134130
}
135131
}

app/code/Magento/Developer/Test/Unit/Model/View/Asset/PreProcessor/FrontendCompilationTest.php

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -189,38 +189,6 @@ public function testProcess()
189189
$frontendCompilation->process($this->getChainMockExpects('', 1, 1, $newContentType));
190190
}
191191

192-
/**
193-
* Run test for process method (content not empty)
194-
*/
195-
public function testProcessContentNotEmpty()
196-
{
197-
$chainMock = $this->getChainMock();
198-
$assetMock = $this->getAssetMock();
199-
200-
$chainMock->expects(self::once())
201-
->method('getContent')
202-
->willReturn('test-content');
203-
204-
$chainMock->expects(self::never())
205-
->method('getAsset')
206-
->willReturn($assetMock);
207-
208-
$this->lockerProcessMock->expects(self::never())
209-
->method('lockProcess');
210-
$this->lockerProcessMock->expects(self::never())
211-
->method('unlockProcess');
212-
213-
$frontendCompilation = new FrontendCompilation(
214-
$this->assetSourceMock,
215-
$this->assetBuilderMock,
216-
$this->alternativeSourceMock,
217-
$this->lockerProcessMock,
218-
'lock'
219-
);
220-
221-
$frontendCompilation->process($chainMock);
222-
}
223-
224192
/**
225193
* @return Chain|\PHPUnit_Framework_MockObject_MockObject
226194
*/

0 commit comments

Comments
 (0)