Skip to content

Commit 3e9c44c

Browse files
committed
MAGETWO-34363: Pull request processing
1 parent f434872 commit 3e9c44c

File tree

8 files changed

+28
-186
lines changed

8 files changed

+28
-186
lines changed

app/code/Magento/Translation/Model/Js/DataProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class DataProvider implements DataProviderInterface
4848
/**
4949
* @param State $appState
5050
* @param Config $config
51+
* @param Filesystem $filesystem
5152
* @param Files $filesUtility
5253
*/
5354
public function __construct(State $appState, Config $config, Filesystem $filesystem, Files $filesUtility = null)

app/code/Magento/Translation/view/base/templates/translate.phtml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
?>
77
<?php /** @var $block \Magento\Translation\Block\Js */ ?>
88
<?php if ($block->dictionaryEnabled()): ?>
9-
<script>
10-
//<![CDATA[
11-
require(
12-
["jquery", "mage/translate", "text!<?php echo Magento\Translation\Model\Js\Config::DICTIONARY_FILE_NAME?>"],
13-
function($, translate, data){ $.mage.translate.add(JSON.parse(data)); }
14-
);
15-
// ]]>
16-
</script>
9+
<script>
10+
//<![CDATA[
11+
require(
12+
["jquery", "mage/translate", "text!<?php echo Magento\Translation\Model\Js\Config::DICTIONARY_FILE_NAME?>"],
13+
function($, translate, data){ $.mage.translate.add(JSON.parse(data)); }
14+
);
15+
// ]]>
16+
</script>
1717
<?php endif; ?>

dev/tests/static/testsuite/Magento/Test/Integrity/Phrase/JsTest.php

Lines changed: 0 additions & 135 deletions
This file was deleted.

dev/tests/unit/testsuite/Magento/Framework/View/Asset/SourceTest.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -91,24 +91,6 @@ protected function setUp()
9191
);
9292
}
9393

94-
public function testGetFileNoOriginalFile()
95-
{
96-
$this->viewFileResolution->expects($this->once())
97-
->method('getFile')
98-
->with('frontend', $this->theme, 'en_US', 'some/file.ext', 'Magento_Module')
99-
->will($this->returnValue(false));
100-
$this->assertFalse($this->object->getFile($this->getAsset()));
101-
}
102-
103-
public function testGetFileNoOriginalFileBasic()
104-
{
105-
$this->staticDirRead->expects($this->once())
106-
->method('getAbsolutePath')
107-
->with('some/file.ext')
108-
->will($this->returnValue(false));
109-
$this->assertFalse($this->object->getFile($this->getAsset(false)));
110-
}
111-
11294
public function testGetFileCached()
11395
{
11496
$root = '/root/some/file.ext';

dev/tests/unit/testsuite/Magento/Translation/Model/Js/ConfigTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
namespace Magento\Translation\Model\Js;
77

8-
class StrategyTest extends \PHPUnit_Framework_TestCase
8+
class ConfigTest extends \PHPUnit_Framework_TestCase
99
{
1010
/**
1111
* @var Config

dev/tools/Magento/Tools/View/Deployer.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ public function __construct(
102102
* @param ObjectManagerFactory $omFactory
103103
* @param array $locales
104104
* @return void
105+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
105106
*/
106107
public function deploy(ObjectManagerFactory $omFactory, array $locales)
107108
{
@@ -223,6 +224,7 @@ private function emulateApplicationArea($areaCode)
223224
*
224225
* @param string $locale
225226
* @param string $area
227+
* @return void
226228
*/
227229
protected function emulateApplicationLocale($locale, $area)
228230
{

lib/internal/Magento/Framework/App/View/Asset/Publisher.php

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,52 +4,43 @@
44
* See COPYING.txt for license details.
55
*/
66
namespace Magento\Framework\App\View\Asset;
7-
87
use Magento\Framework\App\Filesystem\DirectoryList;
98
use Magento\Framework\View\Asset;
10-
119
/**
1210
* A publishing service for view assets
1311
*/
1412
class Publisher
1513
{
16-
/**
17-
* @var \Magento\Framework\App\State
18-
*/
19-
protected $appState;
20-
2114
/**
2215
* @var \Magento\Framework\Filesystem
2316
*/
2417
protected $filesystem;
25-
2618
/**
27-
* @param \Magento\Framework\App\State $appState
19+
* @var MaterializationStrategy\Factory
20+
*/
21+
private $materializationStrategyFactory;
22+
/**
2823
* @param \Magento\Framework\Filesystem $filesystem
24+
* @param MaterializationStrategy\Factory $materializationStrategyFactory
2925
*/
3026
public function __construct(
31-
\Magento\Framework\App\State $appState,
32-
\Magento\Framework\Filesystem $filesystem
27+
\Magento\Framework\Filesystem $filesystem,
28+
MaterializationStrategy\Factory $materializationStrategyFactory
3329
) {
34-
$this->appState = $appState;
3530
$this->filesystem = $filesystem;
31+
$this->materializationStrategyFactory = $materializationStrategyFactory;
3632
}
37-
3833
/**
3934
* {@inheritdoc}
4035
*/
4136
public function publish(Asset\LocalInterface $asset)
4237
{
43-
if ($this->appState->getMode() === \Magento\Framework\App\State::MODE_DEVELOPER) {
44-
return false;
45-
}
4638
$dir = $this->filesystem->getDirectoryRead(DirectoryList::STATIC_VIEW);
4739
if ($dir->isExist($asset->getPath())) {
4840
return true;
4941
}
5042
return $this->publishAsset($asset);
5143
}
52-
5344
/**
5445
* Publish the asset
5546
*
@@ -58,10 +49,11 @@ public function publish(Asset\LocalInterface $asset)
5849
*/
5950
private function publishAsset(Asset\LocalInterface $asset)
6051
{
61-
if ($asset->getContent()) {
62-
$dir = $this->filesystem->getDirectoryWrite(DirectoryList::STATIC_VIEW);
63-
return (bool) $dir->writeFile($asset->getPath(), $asset->getContent());
64-
}
65-
return false;
52+
$targetDir = $this->filesystem->getDirectoryWrite(DirectoryList::STATIC_VIEW);
53+
$rootDir = $this->filesystem->getDirectoryWrite(DirectoryList::ROOT);
54+
$source = $rootDir->getRelativePath($asset->getSourceFile());
55+
$destination = $asset->getPath();
56+
$strategy = $this->materializationStrategyFactory->create($asset);
57+
return $strategy->publishFile($rootDir, $targetDir, $source, $destination);
6658
}
67-
}
59+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public function createAsset($fileId, array $params = [])
157157
UrlInterface::URL_TYPE_STATIC,
158158
$isSecure,
159159
$params['area'],
160-
$themePath ,
160+
$themePath,
161161
$params['locale']
162162
);
163163
return new File(

0 commit comments

Comments
 (0)