Skip to content

Commit 1d8b3e9

Browse files
committed
Merge remote-tracking branch 'mainline/develop' into s4
2 parents ba865e4 + 26da100 commit 1d8b3e9

File tree

81 files changed

+3108
-572
lines changed

Some content is hidden

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

81 files changed

+3108
-572
lines changed

app/code/Magento/Bundle/view/adminhtml/layout/adminhtml_order_shipment_view.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
99
<body>
1010
<referenceBlock name="shipment_items">
11-
<block class="Magento\Bundle\Block\Adminhtml\Sales\Order\Items\Renderer" name="shipment_item_bundle" as="shipment_item_bundle" template="sales/shipment/view/items/renderer.phtml"/>
11+
<block class="Magento\Bundle\Block\Adminhtml\Sales\Order\Items\Renderer" name="bundle" as="bundle" template="sales/shipment/view/items/renderer.phtml"/>
1212
</referenceBlock>
1313
</body>
1414
</page>

app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Save.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public function execute()
162162
$this->attributeHelper->getStoreWebsiteId($storeId)
163163
);
164164
if (!$stockItemDo->getProductId()) {
165-
$inventoryData[] = $productId;
165+
$inventoryData['product_id'] = $productId;
166166
}
167167

168168
$stockItemId = $stockItemDo->getId();

app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ switch ($type = $block->getType()) {
110110

111111
case 'crosssell':
112112
/** @var \Magento\Catalog\Block\Product\ProductList\Crosssell $block */
113-
if ($exist = $block->getItemCount()) {
113+
if ($exist = count($block->getItems())) {
114114
$type = 'crosssell';
115115
$class = $type;
116116

app/code/Magento/CatalogImportExport/Model/Import/Uploader.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Magento\CatalogImportExport\Model\Import;
77

88
use Magento\Framework\App\Filesystem\DirectoryList;
9+
use Magento\Framework\Exception\LocalizedException;
910
use Magento\Framework\Filesystem\DriverPool;
1011

1112
/**
@@ -15,6 +16,14 @@
1516
*/
1617
class Uploader extends \Magento\MediaStorage\Model\File\Uploader
1718
{
19+
20+
/**
21+
* HTTP scheme
22+
* used to compare against the filename and select the proper DriverPool adapter
23+
* @var string
24+
*/
25+
private $httpScheme = 'http://';
26+
1827
/**
1928
* Temp directory.
2029
*
@@ -145,7 +154,13 @@ public function move($fileName, $renameFileOff = false)
145154
}
146155
if (preg_match('/\bhttps?:\/\//i', $fileName, $matches)) {
147156
$url = str_replace($matches[0], '', $fileName);
148-
$read = $this->_readFactory->create($url, DriverPool::HTTP);
157+
158+
if ($matches[0] === $this->httpScheme) {
159+
$read = $this->_readFactory->create($url, DriverPool::HTTP);
160+
} else {
161+
$read = $this->_readFactory->create($url, DriverPool::HTTPS);
162+
}
163+
149164
$fileName = preg_replace('/[^a-z0-9\._-]+/i', '', $fileName);
150165
$this->_directory->writeFile(
151166
$this->_directory->getRelativePath($this->getTmpDir() . '/' . $fileName),

app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/UploaderTest.php

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,63 @@ public function testMoveFileName()
152152
$this->assertEquals(['name' => $fileName], $this->uploader->move($fileName));
153153
}
154154

155+
/**
156+
* @dataProvider moveFileUrlDriverPoolDataProvider
157+
*/
158+
public function testMoveFileUrlDrivePool($fileUrl, $expectedHost, $expectedDriverPool, $expectedScheme)
159+
{
160+
161+
$driverPool = $this->getMock(\Magento\Framework\Filesystem\DriverPool::class, ['getDriver']);
162+
$driverMock = $this->getMock($expectedDriverPool, ['readAll']);
163+
$driverMock->expects($this->any())->method('isExists')->willReturn(true);
164+
$driverMock->expects($this->any())->method('readAll')->willReturn(null);
165+
$driverPool->expects($this->any())->method('getDriver')->willReturn($driverMock);
166+
167+
$readFactory = $this->getMockBuilder(\Magento\Framework\Filesystem\File\ReadFactory::class)
168+
->setConstructorArgs(
169+
[
170+
$driverPool,
171+
]
172+
)
173+
->setMethods(['create'])
174+
->getMock();
175+
176+
$readFactory->expects($this->any())->method('create')
177+
->with($expectedHost, $expectedScheme)
178+
->willReturn($driverMock);
179+
180+
$uploaderMock = $this->getMockBuilder(\Magento\CatalogImportExport\Model\Import\Uploader::class)
181+
->setConstructorArgs([
182+
$this->coreFileStorageDb,
183+
$this->coreFileStorage,
184+
$this->imageFactory,
185+
$this->validator,
186+
$this->filesystem,
187+
$readFactory,
188+
])
189+
->getMock();
190+
191+
$uploaderMock->move($fileUrl);
192+
}
193+
194+
public function moveFileUrlDriverPoolDataProvider()
195+
{
196+
return [
197+
[
198+
'$fileUrl' => 'http://test_uploader_file',
199+
'$expectedHost' => 'test_uploader_file',
200+
'$expectedDriverPool' => \Magento\Framework\Filesystem\Driver\Http::class,
201+
'$expectedScheme' => \Magento\Framework\Filesystem\DriverPool::HTTP,
202+
],
203+
[
204+
'$fileUrl' => 'https://!:^&`;file',
205+
'$expectedHost' => '!:^&`;file',
206+
'$expectedDriverPool' => \Magento\Framework\Filesystem\Driver\Https::class,
207+
'$expectedScheme' => \Magento\Framework\Filesystem\DriverPool::HTTPS,
208+
],
209+
];
210+
}
211+
155212
public function moveFileUrlDataProvider()
156213
{
157214
return [

app/code/Magento/CatalogRule/Pricing/Price/CatalogRulePrice.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ public function getValue()
9999
$this->product->getId()
100100
);
101101
$this->value = $this->value ? floatval($this->value) : false;
102-
if ($this->value) {
103-
$this->value = $this->priceCurrency->convertAndRound($this->value);
104-
}
102+
}
103+
if ($this->value) {
104+
$this->value = $this->priceCurrency->convertAndRound($this->value);
105105
}
106106
}
107107

app/code/Magento/CatalogRule/Test/Unit/Pricing/Price/CatalogRulePriceTest.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,20 @@ public function testGetValue()
208208

209209
public function testGetValueFromData()
210210
{
211+
$catalogRulePrice = 7.1;
212+
$convertedPrice = 5.84;
213+
214+
$this->priceCurrencyMock->expects($this->any())
215+
->method('convertAndRound')
216+
->with($catalogRulePrice)
217+
->will($this->returnValue($convertedPrice));
218+
211219
$this->saleableItemMock->expects($this->once())->method('hasData')
212220
->with('catalog_rule_price')->willReturn(true);
213221
$this->saleableItemMock->expects($this->once())->method('getData')
214-
->with('catalog_rule_price')->willReturn('7.1');
222+
->with('catalog_rule_price')->willReturn($catalogRulePrice);
215223

216-
$this->assertEquals(7.1, $this->object->getValue());
224+
$this->assertEquals($convertedPrice, $this->object->getValue());
217225
}
218226

219227
public function testGetAmountNoBaseAmount()

app/code/Magento/Checkout/view/frontend/templates/cart/coupon.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"removeCouponSelector": "#remove-coupon",
2020
"applyButton": "button.action.apply",
2121
"cancelButton": "button.action.cancel"}}'>
22-
<div class="fieldset coupon<?php strlen($block->getCouponCode()) ? ' applied' : ''?>">
22+
<div class="fieldset coupon<?php echo strlen($block->getCouponCode()) ? ' applied' : ''?>">
2323
<input type="hidden" name="remove" id="remove-coupon" value="0" />
2424
<div class="field">
2525
<label for="coupon_code" class="label"><span><?php /* @escapeNotVerified */ echo __('Enter discount code') ?></span></label>

app/code/Magento/Config/Model/Config/Backend/Currency/AbstractCurrency.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ protected function _getAllowedCurrencies()
3232
)
3333
);
3434
}
35-
return $this->getData('groups/options/fields/allow/value');
35+
36+
return (array)$this->getData('groups/options/fields/allow/value');
3637
}
3738

3839
/**

app/code/Magento/Contact/Controller/Index.php

Lines changed: 16 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -5,74 +5,51 @@
55
*/
66
namespace Magento\Contact\Controller;
77

8-
use Magento\Framework\Exception\NotFoundException;
8+
use Magento\Contact\Model\ConfigInterface;
9+
use Magento\Framework\App\Action\Context;
910
use Magento\Framework\App\RequestInterface;
10-
use Magento\Store\Model\ScopeInterface;
11+
use Magento\Framework\Exception\NotFoundException;
1112

1213
/**
13-
* Contact index controller
14+
* Contact module base controller
1415
*/
1516
abstract class Index extends \Magento\Framework\App\Action\Action
1617
{
1718
/**
1819
* Recipient email config path
1920
*/
20-
const XML_PATH_EMAIL_RECIPIENT = 'contact/email/recipient_email';
21+
const XML_PATH_EMAIL_RECIPIENT = ConfigInterface::XML_PATH_EMAIL_RECIPIENT;
2122

2223
/**
2324
* Sender email config path
2425
*/
25-
const XML_PATH_EMAIL_SENDER = 'contact/email/sender_email_identity';
26+
const XML_PATH_EMAIL_SENDER = ConfigInterface::XML_PATH_EMAIL_SENDER;
2627

2728
/**
2829
* Email template config path
2930
*/
30-
const XML_PATH_EMAIL_TEMPLATE = 'contact/email/email_template';
31+
const XML_PATH_EMAIL_TEMPLATE = ConfigInterface::XML_PATH_EMAIL_TEMPLATE;
3132

3233
/**
3334
* Enabled config path
3435
*/
35-
const XML_PATH_ENABLED = 'contact/contact/enabled';
36-
37-
/**
38-
* @var \Magento\Framework\Mail\Template\TransportBuilder
39-
*/
40-
protected $_transportBuilder;
41-
42-
/**
43-
* @var \Magento\Framework\Translate\Inline\StateInterface
44-
*/
45-
protected $inlineTranslation;
46-
47-
/**
48-
* @var \Magento\Framework\App\Config\ScopeConfigInterface
49-
*/
50-
protected $scopeConfig;
36+
const XML_PATH_ENABLED = ConfigInterface::XML_PATH_ENABLED;
5137

5238
/**
53-
* @var \Magento\Store\Model\StoreManagerInterface
39+
* @var ConfigInterface
5440
*/
55-
protected $storeManager;
41+
private $contactsConfig;
5642

5743
/**
58-
* @param \Magento\Framework\App\Action\Context $context
59-
* @param \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder
60-
* @param \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation
61-
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
62-
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
44+
* @param Context $context
45+
* @param ConfigInterface $contactsConfig
6346
*/
6447
public function __construct(
65-
\Magento\Framework\App\Action\Context $context,
66-
\Magento\Framework\Mail\Template\TransportBuilder $transportBuilder,
67-
\Magento\Framework\Translate\Inline\StateInterface $inlineTranslation,
68-
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
69-
\Magento\Store\Model\StoreManagerInterface $storeManager
48+
Context $context,
49+
ConfigInterface $contactsConfig
7050
) {
7151
parent::__construct($context);
72-
$this->_transportBuilder = $transportBuilder;
73-
$this->inlineTranslation = $inlineTranslation;
74-
$this->scopeConfig = $scopeConfig;
75-
$this->storeManager = $storeManager;
52+
$this->contactsConfig = $contactsConfig;
7653
}
7754

7855
/**
@@ -84,7 +61,7 @@ public function __construct(
8461
*/
8562
public function dispatch(RequestInterface $request)
8663
{
87-
if (!$this->scopeConfig->isSetFlag(self::XML_PATH_ENABLED, ScopeInterface::SCOPE_STORE)) {
64+
if (!$this->contactsConfig->isEnabled()) {
8865
throw new NotFoundException(__('Page not found.'));
8966
}
9067
return parent::dispatch($request);

0 commit comments

Comments
 (0)