Skip to content

Commit e0d29e9

Browse files
author
Yaroslav Onischenko
committed
Merge remote-tracking branch 'mainline/develop' into develop
2 parents 2c818d3 + 96d2202 commit e0d29e9

File tree

103 files changed

+2255
-522
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+2255
-522
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ atlassian*
4646

4747
/var/*
4848
!/var/.htaccess
49-
/vendor
49+
/vendor/*
5050
!/vendor/.htaccess

app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ public function render(\Magento\Framework\DataObject $row)
4141
{
4242
$readDetailsHtml = $row->getUrl() ? '<a class="action-details" target="_blank" href="' . $row->getUrl() . '">' . __(
4343
'Read Details'
44-
) . '</a>' : '';
44+
) . '</a> | ' : '';
4545

4646
$markAsReadHtml = !$row->getIsRead() ? '<a class="action-mark" href="' . $this->getUrl(
4747
'*/*/markAsRead/',
4848
['_current' => true, 'id' => $row->getId()]
4949
) . '">' . __(
5050
'Mark as Read'
51-
) . '</a>' : '';
51+
) . '</a> | ' : '';
5252

5353
$encodedUrl = $this->_urlHelper->getEncodedUrl();
5454
return sprintf(

app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@
2828
<script data-template="search-suggest" type="text/x-magento-template">
2929
<ul class="search-global-menu">
3030
<li class="item">
31-
<a href="<?php /* @escapeNotVerified */ echo $block->getURL('catalog/product/index/'); ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Products</a>
31+
<a id="searchPreviewProducts" href="<?php /* @escapeNotVerified */ echo $block->getURL('catalog/product/index/'); ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Products</a>
3232
</li>
3333
<li class="item">
34-
<a href="<?php /* @escapeNotVerified */ echo $block->getURL('sales/order/index/'); ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Orders</a>
34+
<a id="searchPreviewOrders" href="<?php /* @escapeNotVerified */ echo $block->getURL('sales/order/index/'); ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Orders</a>
3535
</li>
3636
<li class="item">
37-
<a href="<?php /* @escapeNotVerified */ echo $block->getURL('customer/index/index/'); ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Customers</a>
37+
<a id="searchPreviewCustomers" href="<?php /* @escapeNotVerified */ echo $block->getURL('customer/index/index/'); ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Customers</a>
3838
</li>
3939
<li class="item">
40-
<a href="<?php /* @escapeNotVerified */ echo $block->getURL('cms/page/index/'); ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Pages</a>
40+
<a id="searchPreviewPages" href="<?php /* @escapeNotVerified */ echo $block->getURL('cms/page/index/'); ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Pages</a>
4141
</li>
4242
<% if (data.items.length) { %>
4343
<% _.each(data.items, function(value){ %>

app/code/Magento/Backup/Helper/Data.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function getExtensions()
122122
\Magento\Framework\Backup\Factory::TYPE_SYSTEM_SNAPSHOT => 'tgz',
123123
\Magento\Framework\Backup\Factory::TYPE_SNAPSHOT_WITHOUT_MEDIA => 'tgz',
124124
\Magento\Framework\Backup\Factory::TYPE_MEDIA => 'tgz',
125-
\Magento\Framework\Backup\Factory::TYPE_DB => 'gz'
125+
\Magento\Framework\Backup\Factory::TYPE_DB => 'sql'
126126
];
127127
}
128128

app/code/Magento/Checkout/Block/Checkout/LayoutProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ private function processPaymentConfiguration(array &$configuration, array $eleme
173173
'telephone' => [
174174
'config' => [
175175
'tooltip' => [
176-
'description' => 'For delivery questions.',
176+
'description' => __('For delivery questions.'),
177177
],
178178
],
179179
],

app/code/Magento/Developer/Console/Command/SourceThemeDeployCommand.php

Lines changed: 56 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -87,47 +87,49 @@ protected function configure()
8787
{
8888
parent::configure();
8989
$this->setDescription('Collects and publishes source files for theme.')
90-
->setDefinition([
91-
new InputArgument(
92-
self::FILE_ARGUMENT,
93-
InputArgument::IS_ARRAY,
94-
'Files to pre-process (file should be specified without extension)',
95-
['css/styles-m', 'css/styles-l']
96-
),
97-
new InputOption(
98-
self::TYPE_ARGUMENT,
99-
null,
100-
InputOption::VALUE_REQUIRED,
101-
'Type of source files: [less]',
102-
'less'
103-
),
104-
new InputOption(
105-
self::LOCALE_OPTION,
106-
null,
107-
InputOption::VALUE_REQUIRED,
108-
'Locale: [en_US]',
109-
'en_US'
110-
),
111-
new InputOption(
112-
self::AREA_OPTION,
113-
null,
114-
InputOption::VALUE_REQUIRED,
115-
'Area: [frontend|adminhtml]',
116-
'frontend'
117-
),
118-
new InputOption(
119-
self::THEME_OPTION,
120-
null,
121-
InputOption::VALUE_REQUIRED,
122-
'Theme: [Vendor/theme]',
123-
'Magento/luma'
124-
),
125-
126-
]);
90+
->setDefinition(
91+
[
92+
new InputArgument(
93+
self::FILE_ARGUMENT,
94+
InputArgument::IS_ARRAY,
95+
'Files to pre-process (file should be specified without extension)',
96+
['css/styles-m', 'css/styles-l']
97+
),
98+
new InputOption(
99+
self::TYPE_ARGUMENT,
100+
null,
101+
InputOption::VALUE_REQUIRED,
102+
'Type of source files: [less]',
103+
'less'
104+
),
105+
new InputOption(
106+
self::LOCALE_OPTION,
107+
null,
108+
InputOption::VALUE_REQUIRED,
109+
'Locale: [en_US]',
110+
'en_US'
111+
),
112+
new InputOption(
113+
self::AREA_OPTION,
114+
null,
115+
InputOption::VALUE_REQUIRED,
116+
'Area: [frontend|adminhtml]',
117+
'frontend'
118+
),
119+
new InputOption(
120+
self::THEME_OPTION,
121+
null,
122+
InputOption::VALUE_REQUIRED,
123+
'Theme: [Vendor/theme]',
124+
'Magento/luma'
125+
),
126+
127+
]
128+
);
127129
}
128130

129131
/**
130-
* @inheritdoc
132+
* {@inheritdoc}
131133
* @throws \InvalidArgumentException
132134
*/
133135
protected function execute(InputInterface $input, OutputInterface $output)
@@ -144,6 +146,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
144146
$locale . ' argument has invalid value, please run info:language:list for list of available locales'
145147
);
146148
}
149+
150+
if (!preg_match('#^[\w\-]+\/[\w\-]+$#', $theme)) {
151+
throw new \InvalidArgumentException(
152+
'Value "' . $theme . '" of the option "' . self::THEME_OPTION .
153+
'" has invalid format. The format should be "Vendor/theme".'
154+
);
155+
}
156+
147157
$message = sprintf(
148158
'<info>Processed Area: %s, Locale: %s, Theme: %s, File type: %s.</info>',
149159
$area,
@@ -164,7 +174,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
164174
]
165175
);
166176

167-
$this->assetPublisher->publish($asset);
177+
try {
178+
$this->assetPublisher->publish($asset);
179+
} catch (\Magento\Framework\View\Asset\File\NotFoundException $e) {
180+
throw new \InvalidArgumentException(
181+
'Verify entered values of the argument and options. ' . $e->getMessage()
182+
);
183+
}
184+
168185
$output->writeln('<comment>-> ' . $asset->getFilePath() . '</comment>');
169186
}
170187

app/code/Magento/Developer/Test/Unit/Console/Command/SourceThemeDeployCommandTest.php

Lines changed: 92 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ class SourceThemeDeployCommandTest extends \PHPUnit_Framework_TestCase
2424

2525
const LOCALE_TEST_VALUE = 'locale-test-value';
2626

27-
const THEME_TEST_VALUE = 'theme-test-value';
27+
const THEME_TEST_VALUE = 'Vendor/theme';
28+
29+
const THEME_INCORRECT_FORMAT_VALUE = 'theme-value';
30+
31+
const THEME_NONEXISTING_VALUE = 'NonExistentVendor/theme';
2832

2933
const TYPE_TEST_VALUE = 'type-test-value';
3034

@@ -128,23 +132,103 @@ public function testExecute()
128132
$this->sourceThemeDeployCommand->run($this->getInputMock(), $outputMock);
129133
}
130134

135+
/**
136+
* Run test for execute method with incorrect theme value
137+
*
138+
* @expectedException \InvalidArgumentException
139+
* @expectedExceptionMessage Value "theme-value" of the option "theme" has invalid format. The format should be
140+
*/
141+
public function testExecuteIncorrectThemeFormat()
142+
{
143+
/** @var OutputInterface|\PHPUnit_Framework_MockObject_MockObject $outputMock */
144+
$outputMock = $this->getMockBuilder(OutputInterface::class)
145+
->getMockForAbstractClass();
146+
$this->validatorMock->expects(self::once())
147+
->method('isValid')
148+
->with(self::LOCALE_TEST_VALUE)
149+
->willReturn(true);
150+
151+
$valueMap = [
152+
['area', self::AREA_TEST_VALUE],
153+
['locale', self::LOCALE_TEST_VALUE],
154+
['theme', self::THEME_INCORRECT_FORMAT_VALUE],
155+
['type', self::TYPE_TEST_VALUE]
156+
];
157+
158+
$this->sourceThemeDeployCommand->run(
159+
$this->getInputMock($valueMap),
160+
$outputMock
161+
);
162+
}
163+
164+
/**
165+
* Run test for execute method with non existing theme
166+
*
167+
* @expectedException \InvalidArgumentException
168+
* @expectedExceptionMessage Verify entered values of the argument and options.
169+
*/
170+
public function testExecuteNonExistingValue()
171+
{
172+
/** @var OutputInterface|\PHPUnit_Framework_MockObject_MockObject $outputMock */
173+
$outputMock = $this->getMockBuilder(OutputInterface::class)
174+
->getMockForAbstractClass();
175+
$assetMock = $this->getMockBuilder(LocalInterface::class)
176+
->getMockForAbstractClass();
177+
178+
$this->validatorMock->expects(self::once())
179+
->method('isValid')
180+
->with(self::LOCALE_TEST_VALUE)
181+
->willReturn(true);
182+
183+
$this->assetRepositoryMock->expects(self::once())
184+
->method('createAsset')
185+
->with(
186+
'file-test-value/test' . DIRECTORY_SEPARATOR . 'file' . '.' . self::TYPE_TEST_VALUE,
187+
[
188+
'area' => self::AREA_TEST_VALUE,
189+
'theme' => self::THEME_NONEXISTING_VALUE,
190+
'locale' => self::LOCALE_TEST_VALUE,
191+
]
192+
)->willReturn($assetMock);
193+
194+
$this->assetPublisherMock->expects(self::once())
195+
->method('publish')
196+
->with($assetMock)
197+
->willThrowException(new \Magento\Framework\View\Asset\File\NotFoundException);
198+
199+
$valueMap = [
200+
['area', self::AREA_TEST_VALUE],
201+
['locale', self::LOCALE_TEST_VALUE],
202+
['theme', self::THEME_NONEXISTING_VALUE],
203+
['type', self::TYPE_TEST_VALUE]
204+
];
205+
206+
$this->sourceThemeDeployCommand->run(
207+
$this->getInputMock($valueMap),
208+
$outputMock
209+
);
210+
}
211+
131212
/**
132213
* @return InputInterface|\PHPUnit_Framework_MockObject_MockObject
133214
*/
134-
private function getInputMock()
215+
private function getInputMock(array $valueMap = [])
135216
{
136217
$inputMock = $this->getMockBuilder(InputInterface::class)
137218
->getMockForAbstractClass();
138219

220+
$defaultValueMap = [
221+
['area', self::AREA_TEST_VALUE],
222+
['locale', self::LOCALE_TEST_VALUE],
223+
['theme', self::THEME_TEST_VALUE],
224+
['type', self::TYPE_TEST_VALUE]
225+
];
226+
$valueMap = empty($valueMap) ? $defaultValueMap : $valueMap;
227+
139228
$inputMock->expects(self::exactly(4))
140229
->method('getOption')
141230
->willReturnMap(
142-
[
143-
['area', self::AREA_TEST_VALUE],
144-
['locale', self::LOCALE_TEST_VALUE],
145-
['theme', self::THEME_TEST_VALUE],
146-
['type', self::TYPE_TEST_VALUE]
147-
]
231+
$valueMap
148232
);
149233
$inputMock->expects(self::once())
150234
->method('getArgument')

app/code/Magento/Directory/Model/Currency/Import/Webservicex.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212
class Webservicex extends \Magento\Directory\Model\Currency\Import\AbstractImport
1313
{
1414
/**
15-
* @var string
15+
* Currency converter url
1616
*/
17-
const CURRENCY_CONVERTER_URL = 'http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate?' .
18-
'FromCurrency={{CURRENCY_FROM}}&ToCurrency={{CURRENCY_TO}}';
17+
// @codingStandardsIgnoreStart
18+
const CURRENCY_CONVERTER_URL = 'http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate?FromCurrency={{CURRENCY_FROM}}&ToCurrency={{CURRENCY_TO}}';
19+
// @codingStandardsIgnoreEnd
1920

2021
/**
2122
* Http Client Factory

app/code/Magento/Email/Model/Template/Filter.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,8 @@ public function getCssFilesContent(array $files)
893893
}
894894
} catch (ContentProcessorException $exception) {
895895
$css = $exception->getMessage();
896+
} catch (\Magento\Framework\View\Asset\File\NotFoundException $exception) {
897+
$css = '';
896898
}
897899

898900
return $css;

app/code/Magento/MediaStorage/Model/File/Storage/Database.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ class Database extends \Magento\MediaStorage\Model\File\Storage\Database\Abstrac
4141
*/
4242
protected $_mediaHelper;
4343

44+
/**
45+
* Store media base directory path
46+
*
47+
* @var string
48+
*/
49+
protected $mediaBaseDirectory = null;
50+
4451
/**
4552
* @param \Magento\Framework\Model\Context $context
4653
* @param \Magento\Framework\Registry $registry
@@ -352,4 +359,17 @@ public function deleteFile($path)
352359

353360
return $this;
354361
}
362+
363+
/**
364+
* Retrieve media base directory path
365+
*
366+
* @return string
367+
*/
368+
public function getMediaBaseDirectory()
369+
{
370+
if ($this->mediaBaseDirectory === null) {
371+
$this->mediaBaseDirectory = $this->_coreFileStorageDb->getMediaBaseDir();
372+
}
373+
return $this->mediaBaseDirectory;
374+
}
355375
}

0 commit comments

Comments
 (0)