Skip to content

Commit c6fad12

Browse files
committed
MAGETWO-44603: Styles are lost on Storefront if CSS files minification is enabled in "default" mode
- Fixed test
1 parent 769cb12 commit c6fad12

File tree

8 files changed

+24
-13
lines changed

8 files changed

+24
-13
lines changed

app/code/Magento/Deploy/Model/Deployer.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ protected function emulateApplicationLocale($locale, $area)
300300
* @throws LocalizedException
301301
*
302302
* @SuppressWarnings(PHPMD.NPathComplexity)
303+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
303304
*/
304305
private function deployFile($filePath, $area, $themePath, $locale, $module)
305306
{
@@ -341,7 +342,7 @@ private function deployFile($filePath, $area, $themePath, $locale, $module)
341342
}
342343
$this->count++;
343344
} catch (ContentProcessorException $exception) {
344-
throw new LocalizedException(__($exception->getMessage()));
345+
throw $exception;
345346
} catch (\Exception $exception) {
346347
$this->output->write('.');
347348
$this->verboseLog($exception->getTraceAsString());

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* Class FrontendCompilationTest
2020
*
2121
* @see \Magento\Developer\Model\View\Asset\PreProcessor\FrontendCompilation
22+
*
23+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2224
*/
2325
class FrontendCompilationTest extends \PHPUnit_Framework_TestCase
2426
{

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
namespace Magento\Developer\Test\Unit\Model\View\Asset\PreProcessor;
77

8-
use Magento\Framework\View\Asset\PreProcessor;
8+
use Magento\Framework\View\Asset\PreProcessor\Chain;
99
use Magento\Framework\App\Config\ScopeConfigInterface;
1010
use Magento\Developer\Model\Config\Source\WorkflowType;
1111
use Magento\Developer\Model\View\Asset\PreProcessor\FrontendCompilation;
@@ -104,11 +104,11 @@ public function testProcessAlternativeSource()
104104
}
105105

106106
/**
107-
* @return PreProcessor\Chain|\PHPUnit_Framework_MockObject_MockObject
107+
* @return Chain|\PHPUnit_Framework_MockObject_MockObject
108108
*/
109109
private function getChainMock()
110110
{
111-
$chainMock = $this->getMockBuilder(PreProcessor\Chain::class)
111+
$chainMock = $this->getMockBuilder(Chain::class)
112112
->disableOriginalConstructor()
113113
->getMock();
114114

lib/internal/Magento/Framework/Css/PreProcessor/Adapter/Less/Processor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@ public function processContent(File $asset)
8888
$errorMessage = PHP_EOL . self::ERROR_MESSAGE_PREFIX . PHP_EOL . $path;
8989
$this->logger->critical($errorMessage);
9090

91-
throw new ContentProcessorException($errorMessage);
91+
throw new ContentProcessorException(__($errorMessage));
9292
}
9393

9494
return $content;
9595
} catch (\Exception $e) {
9696
$errorMessage = PHP_EOL . self::ERROR_MESSAGE_PREFIX . PHP_EOL . $path . PHP_EOL . $e->getMessage();
9797
$this->logger->critical($errorMessage);
9898

99-
throw new ContentProcessorException($errorMessage);
99+
throw new ContentProcessorException(__($errorMessage));
100100
}
101101
}
102102
}

lib/internal/Magento/Framework/Css/PreProcessor/FileGenerator/RelatedGenerator.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
use Magento\Framework\Css\PreProcessor\Instruction\Import;
1010
use Magento\Framework\View\Asset\LocalInterface;
1111

12+
/**
13+
* Class RelatedGenerator
14+
*/
1215
class RelatedGenerator
1316
{
1417
/**
@@ -19,7 +22,7 @@ class RelatedGenerator
1922
/**
2023
* @var \Magento\Framework\View\Asset\Repository
2124
*/
22-
private $assetRepo;
25+
private $assetRepository;
2326

2427
/**
2528
* @var \Magento\Framework\Css\PreProcessor\File\Temporary
@@ -28,17 +31,16 @@ class RelatedGenerator
2831

2932
/**
3033
* @param \Magento\Framework\Filesystem $filesystem
31-
* @param \Magento\Framework\View\Asset\Repository $assetRepo
34+
* @param \Magento\Framework\View\Asset\Repository $assetRepository
3235
* @param \Magento\Framework\Css\PreProcessor\File\Temporary $temporaryFile
3336
*/
3437
public function __construct(
3538
\Magento\Framework\Filesystem $filesystem,
36-
\Magento\Framework\View\Asset\Repository $assetRepo,
39+
\Magento\Framework\View\Asset\Repository $assetRepository,
3740
\Magento\Framework\Css\PreProcessor\File\Temporary $temporaryFile
3841
) {
3942
$this->tmpDirectory = $filesystem->getDirectoryWrite(DirectoryList::VAR_DIR);
40-
$this->assetRepo = $assetRepo;
41-
43+
$this->assetRepository = $assetRepository;
4244
$this->temporaryFile = $temporaryFile;
4345
}
4446

@@ -71,7 +73,7 @@ public function generate(Import $importGenerator)
7173
*/
7274
protected function generateRelatedFile($relatedFileId, LocalInterface $asset)
7375
{
74-
$relatedAsset = $this->assetRepo->createRelated($relatedFileId, $asset);
76+
$relatedAsset = $this->assetRepository->createRelated($relatedFileId, $asset);
7577
$this->temporaryFile->createFile($relatedAsset->getPath(), $relatedAsset->getContent());
7678

7779
return $relatedAsset;

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
*/
66
namespace Magento\Framework\View\Asset;
77

8+
use Magento\Framework\Exception\LocalizedException;
9+
810
/**
911
* Class ContentProcessorException
1012
*/
11-
class ContentProcessorException extends \RuntimeException
13+
class ContentProcessorException extends LocalizedException
1214
{
1315

1416
}

lib/internal/Magento/Framework/View/Asset/PreProcessor/AlternativeSource.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
/**
1616
* Class AlternativeSource
17+
*
18+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1719
*/
1820
class AlternativeSource implements AlternativeSourceInterface
1921
{

lib/internal/Magento/Framework/View/Test/Unit/Asset/PreProcessor/AlternativeSourceTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
* Class AlternativeSourceTest
2323
*
2424
* @see \Magento\Framework\View\Asset\PreProcessor\AlternativeSource
25+
*
26+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2527
*/
2628
class AlternativeSourceTest extends \PHPUnit_Framework_TestCase
2729
{

0 commit comments

Comments
 (0)