Skip to content

Commit ad59055

Browse files
author
rossbrandon
committed
Merge remote-tracking branch 'upstream/2.2-develop' into MAGETWO-83184-release-notification-content-update
2 parents a5d84a7 + 2275b89 commit ad59055

File tree

20 files changed

+880
-430
lines changed

20 files changed

+880
-430
lines changed

app/code/Magento/Deploy/Service/DeployPackage.php

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Deploy\Service;
78

89
use Magento\Deploy\Package\Package;
910
use Magento\Deploy\Package\PackageFile;
11+
use Magento\Framework\App\ObjectManager;
1012
use Magento\Framework\App\State as AppState;
1113
use Magento\Framework\Locale\ResolverInterface as LocaleResolver;
1214
use Magento\Framework\View\Asset\ContentProcessorException;
1315
use Magento\Deploy\Console\InputValidator;
16+
use Magento\Framework\View\Design\Theme\ListInterface;
17+
use Magento\Framework\View\DesignInterface;
1418
use Psr\Log\LoggerInterface;
1519

1620
/**
@@ -91,15 +95,15 @@ public function __construct(
9195
* @param array $options
9296
* @param bool $skipLogging
9397
* @return bool true on success
98+
* @throws \Exception
9499
*/
95100
public function deploy(Package $package, array $options, $skipLogging = false)
96101
{
97102
$result = $this->appState->emulateAreaCode(
98-
$package->getArea() == Package::BASE_AREA ? 'global' : $package->getArea(),
103+
$package->getArea() === Package::BASE_AREA ? 'global' : $package->getArea(),
99104
function () use ($package, $options, $skipLogging) {
100105
// emulate application locale needed for correct file path resolving
101106
$this->localeResolver->setLocale($package->getLocale());
102-
103107
$this->deployEmulated($package, $options, $skipLogging);
104108
}
105109
);
@@ -111,7 +115,7 @@ function () use ($package, $options, $skipLogging) {
111115
* @param Package $package
112116
* @param array $options
113117
* @param bool $skipLogging
114-
* @return int
118+
* @return bool
115119
*/
116120
public function deployEmulated(Package $package, array $options, $skipLogging = false)
117121
{
@@ -200,14 +204,14 @@ private function processFile(PackageFile $file, Package $package)
200204
private function checkIfCanCopy(PackageFile $file, Package $package, Package $parentPackage = null)
201205
{
202206
return $parentPackage
203-
&& $file->getOrigPackage() !== $package
204-
&& (
205-
$file->getArea() !== $package->getArea()
206-
|| $file->getTheme() !== $package->getTheme()
207-
|| $file->getLocale() !== $package->getLocale()
208-
)
209-
&& $file->getOrigPackage() == $parentPackage
210-
&& $this->deployStaticFile->readFile($file->getDeployedFileId(), $parentPackage->getPath());
207+
&& $file->getOrigPackage() !== $package
208+
&& (
209+
$file->getArea() !== $package->getArea()
210+
|| $file->getTheme() !== $package->getTheme()
211+
|| $file->getLocale() !== $package->getLocale()
212+
)
213+
&& $file->getOrigPackage() === $parentPackage
214+
&& $this->deployStaticFile->readFile($file->getDeployedFileId(), $parentPackage->getPath());
211215
}
212216

213217
/**
@@ -219,10 +223,10 @@ private function checkIfCanCopy(PackageFile $file, Package $package, Package $pa
219223
*/
220224
private function checkFileSkip($filePath, array $options)
221225
{
222-
if ($filePath != '.') {
226+
if ($filePath !== '.') {
223227
$ext = strtolower(pathinfo($filePath, PATHINFO_EXTENSION));
224228
$basename = pathinfo($filePath, PATHINFO_BASENAME);
225-
if ($ext == 'less' && strpos($basename, '_') === 0) {
229+
if ($ext === 'less' && strpos($basename, '_') === 0) {
226230
return true;
227231
}
228232
$option = isset(InputValidator::$fileExtensionOptionMap[$ext])

app/code/Magento/Deploy/Service/DeployStaticContent.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ public function deploy(array $options)
112112
$deployRjsConfig = $this->objectManager->create(DeployRequireJsConfig::class, [
113113
'logger' => $this->logger
114114
]);
115+
/** @var DeployTranslationsDictionary $deployI18n */
115116
$deployI18n = $this->objectManager->create(DeployTranslationsDictionary::class, [
116117
'logger' => $this->logger
117118
]);

app/code/Magento/Translation/Model/Json/PreProcessor.php

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Translation\Model\Json;
78

9+
use Magento\Framework\App\AreaList;
10+
use Magento\Framework\App\ObjectManager;
11+
use Magento\Framework\TranslateInterface;
12+
use Magento\Framework\View\Asset\File\FallbackContext;
13+
use Magento\Framework\View\Asset\PreProcessor\Chain;
814
use Magento\Framework\View\Asset\PreProcessorInterface;
15+
use Magento\Framework\View\DesignInterface;
916
use Magento\Translation\Model\Js\Config;
1017
use Magento\Translation\Model\Js\DataProviderInterface;
11-
use Magento\Framework\View\Asset\PreProcessor\Chain;
12-
use Magento\Framework\View\Asset\File\FallbackContext;
13-
use Magento\Framework\App\AreaList;
14-
use Magento\Framework\TranslateInterface;
1518

1619
/**
1720
* PreProcessor responsible for providing js translation dictionary
@@ -41,30 +44,38 @@ class PreProcessor implements PreProcessorInterface
4144
* @var TranslateInterface
4245
*/
4346
protected $translate;
47+
/**
48+
* @var DesignInterface
49+
*/
50+
private $viewDesign;
4451

4552
/**
4653
* @param Config $config
4754
* @param DataProviderInterface $dataProvider
4855
* @param AreaList $areaList
4956
* @param TranslateInterface $translate
57+
* @param DesignInterface|null $viewDesign
5058
*/
5159
public function __construct(
5260
Config $config,
5361
DataProviderInterface $dataProvider,
5462
AreaList $areaList,
55-
TranslateInterface $translate
63+
TranslateInterface $translate,
64+
DesignInterface $viewDesign = null
5665
) {
5766
$this->config = $config;
5867
$this->dataProvider = $dataProvider;
5968
$this->areaList = $areaList;
6069
$this->translate = $translate;
70+
$this->viewDesign = $viewDesign ?: ObjectManager::getInstance()->get(DesignInterface::class);
6171
}
6272

6373
/**
6474
* Transform content and/or content type for the specified preprocessing chain object
6575
*
6676
* @param Chain $chain
6777
* @return void
78+
* @throws \Exception
6879
*/
6980
public function process(Chain $chain)
7081
{
@@ -77,7 +88,12 @@ public function process(Chain $chain)
7788
if ($context instanceof FallbackContext) {
7889
$themePath = $context->getThemePath();
7990
$areaCode = $context->getAreaCode();
80-
$this->translate->setLocale($context->getLocale());
91+
92+
$this->viewDesign->setDesignTheme($themePath, $areaCode);
93+
94+
$this->translate
95+
->setLocale($context->getLocale())
96+
->loadData($areaCode);
8197
}
8298

8399
$area = $this->areaList->getArea($areaCode);

app/code/Magento/Translation/Test/Unit/Model/Json/PreProcessorTest.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Translation\Test\Unit\Model\Json;
78

89
use Magento\Translation\Model\Js\Config;
@@ -41,7 +42,15 @@ protected function setUp()
4142
$this->configMock = $this->createMock(\Magento\Translation\Model\Js\Config::class);
4243
$this->dataProviderMock = $this->createMock(\Magento\Translation\Model\Js\DataProvider::class);
4344
$this->areaListMock = $this->createMock(\Magento\Framework\App\AreaList::class);
44-
$this->translateMock = $this->getMockForAbstractClass(\Magento\Framework\TranslateInterface::class);
45+
$this->translateMock = $this->getMockBuilder(\Magento\Framework\Translate::class)
46+
->disableOriginalConstructor()
47+
->getMock();
48+
49+
$this->translateMock
50+
->expects($this->once())
51+
->method('setLocale')
52+
->willReturn($this->translateMock);
53+
4554
$this->model = new PreProcessor(
4655
$this->configMock,
4756
$this->dataProviderMock,
@@ -97,6 +106,11 @@ public function testGetData()
97106
->method('setContentType')
98107
->with('json');
99108

109+
$this->translateMock
110+
->expects($this->once())
111+
->method('loadData')
112+
->willReturn($this->translateMock);
113+
100114
$this->model->process($chain);
101115
}
102116
}

composer.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
"require": {
1111
"php": "7.0.2|7.0.4|~7.0.6|~7.1.0",
1212
"zendframework/zend-stdlib": "^2.7.7",
13-
"zendframework/zend-code": "^3.1.0",
13+
"zendframework/zend-code": "~3.1.0",
1414
"zendframework/zend-server": "^2.6.1",
1515
"zendframework/zend-soap": "^2.6.0",
1616
"zendframework/zend-uri": "^2.5.1",
1717
"zendframework/zend-validator": "^2.6.0",
1818
"zendframework/zend-crypt": "^2.6.0",
1919
"zendframework/zend-console": "^2.6.0",
2020
"zendframework/zend-modulemanager": "^2.7",
21-
"zendframework/zend-mvc": "~2.6.3",
21+
"zendframework/zend-mvc": "~2.7.12",
2222
"zendframework/zend-text": "^2.6.0",
2323
"zendframework/zend-i18n": "^2.7.3",
2424
"zendframework/zend-eventmanager": "^2.6.3",
@@ -35,22 +35,22 @@
3535
"zendframework/zend-captcha": "^2.7.1",
3636
"zendframework/zend-session": "^2.7.3",
3737
"magento/zendframework1": "~1.13.0",
38-
"colinmollenhour/credis": "1.8.2",
38+
"colinmollenhour/credis": "1.9.1",
3939
"colinmollenhour/php-redis-session-abstract": "1.3.4",
40-
"colinmollenhour/cache-backend-redis": "1.10.2",
40+
"colinmollenhour/cache-backend-redis": "1.10.4",
4141
"colinmollenhour/cache-backend-file": "1.4",
4242
"composer/composer": "1.4.1",
4343
"monolog/monolog": "^1.17",
4444
"oyejorge/less.php": "~1.7.0",
4545
"pelago/emogrifier": "1.2.0",
4646
"tubalmartin/cssmin": "4.1.0",
4747
"magento/magento-composer-installer": ">=0.1.11",
48-
"braintree/braintree_php": "3.22.0",
48+
"braintree/braintree_php": "3.25.0",
4949
"symfony/console": "~2.3, !=2.7.0",
5050
"symfony/event-dispatcher": "~2.1",
5151
"symfony/process": "~2.1",
5252
"phpseclib/phpseclib": "2.0.*",
53-
"tedivm/jshrink": "~1.1.0",
53+
"tedivm/jshrink": "~1.2.0",
5454
"magento/composer": "~1.2.0",
5555
"lib-libxml": "*",
5656
"ext-ctype": "*",
@@ -70,14 +70,14 @@
7070
"ext-pdo_mysql": "*",
7171
"ext-soap": "*",
7272
"sjparkinson/static-review": "~4.1",
73-
"ramsey/uuid": "3.6.1"
73+
"ramsey/uuid": "3.7.1"
7474
},
7575
"require-dev": {
7676
"phpunit/phpunit": "~6.2.0",
77-
"squizlabs/php_codesniffer": "3.0.1",
77+
"squizlabs/php_codesniffer": "3.1.1",
7878
"phpmd/phpmd": "@stable",
7979
"pdepend/pdepend": "2.5.0",
80-
"friendsofphp/php-cs-fixer": "~2.1.1",
80+
"friendsofphp/php-cs-fixer": "~2.2.0",
8181
"lusitanian/oauth": "~0.8.10",
8282
"sebastian/phpcpd": "2.0.4"
8383
},

0 commit comments

Comments
 (0)