Skip to content

Commit 2a6a6e3

Browse files
author
mtanniru
committed
Merge remote-tracking branch 'remotes/origin/2.1-develop' into MAGETWO-58335-Uploaded-Image-2.1.3
# Conflicts: # dev/tests/static/testsuite/Magento/Test/Legacy/ModuleDBChangeTest.php
2 parents b9265f4 + 606b04d commit 2a6a6e3

File tree

390 files changed

+19762
-1702
lines changed

Some content is hidden

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

390 files changed

+19762
-1702
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Use the following table to verify you have the correct prerequisites to install
3333
<td><a href="http://devdocs.magento.com/guides/v2.0/install-gde/prereq/apache.html">Apache</a></td>
3434
</tr>
3535
<tr>
36-
<td>PHP 5.6.x, 7.0.2 or 7.0.6</td>
36+
<td>PHP 5.6.x, 7.0.2, 7.0.4 or 7.0.6</td>
3737
<td><code>php -v</code></td>
3838
<td><a href="http://devdocs.magento.com/guides/v2.0/install-gde/prereq/php-ubuntu.html">PHP Ubuntu</a><br><a href="http://devdocs.magento.com/guides/v2.0/install-gde/prereq/php-centos.html">PHP CentOS</a></td>
3939
</tr>

app/bootstrap.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
#ini_set('display_errors', 1);
1212

1313
/* PHP version validation */
14-
if (!defined('PHP_VERSION_ID') || !(PHP_VERSION_ID >= 50600 && PHP_VERSION_ID < 50700 || PHP_VERSION_ID === 70002 || PHP_VERSION_ID >= 70006)) {
14+
if (!defined('PHP_VERSION_ID') || !(PHP_VERSION_ID >= 50005 && PHP_VERSION_ID < 50700 || PHP_VERSION_ID === 70002 || PHP_VERSION_ID === 70004 || PHP_VERSION_ID >= 70006)) {
1515
if (PHP_SAPI == 'cli') {
16-
echo 'Magento supports PHP 5.6, 7.0.2, and 7.0.6 or later. ' .
16+
echo 'Magento supports PHP 5.6.5, 7.0.2, 7.0.4 and 7.0.6 or later. ' .
1717
'Please read http://devdocs.magento.com/guides/v1.0/install-gde/system-requirements.html';
1818
} else {
1919
echo <<<HTML
2020
<div style="font:12px/1.35em arial, helvetica, sans-serif;">
21-
<p>Magento supports PHP 5.6, 7.0.2, and 7.0.6 or later. Please read
21+
<p>Magento supports PHP 5.6.5, 7.0.2, 7.0.4 and 7.0.6 or later. Please read
2222
<a target="_blank" href="http://devdocs.magento.com/guides/v1.0/install-gde/system-requirements.html">
2323
Magento System Requirements</a>.
2424
</div>
@@ -35,6 +35,17 @@
3535
$mask = file_exists($umaskFile) ? octdec(file_get_contents($umaskFile)) : 002;
3636
umask($mask);
3737

38+
if (empty($_SERVER['ENABLE_IIS_REWRITES']) || ($_SERVER['ENABLE_IIS_REWRITES'] != 1)) {
39+
/*
40+
* Unset headers used by IIS URL rewrites.
41+
*/
42+
unset($_SERVER['HTTP_X_REWRITE_URL']);
43+
unset($_SERVER['HTTP_X_ORIGINAL_URL']);
44+
unset($_SERVER['IIS_WasUrlRewritten']);
45+
unset($_SERVER['UNENCODED_URL']);
46+
unset($_SERVER['ORIG_PATH_INFO']);
47+
}
48+
3849
if (!empty($_SERVER['MAGE_PROFILER'])
3950
&& isset($_SERVER['HTTP_ACCEPT'])
4051
&& strpos($_SERVER['HTTP_ACCEPT'], 'text/html') !== false

app/code/Magento/AdminNotification/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
"name": "magento/module-admin-notification",
33
"description": "N/A",
44
"require": {
5-
"php": "~5.6.0|7.0.2|~7.0.6",
5+
"php": "~5.6.5|7.0.2|7.0.4|~7.0.6",
66
"magento/module-store": "100.1.*",
77
"magento/module-backend": "100.1.*",
88
"magento/module-media-storage": "100.1.*",
99
"magento/framework": "100.1.*",
1010
"lib-libxml": "*"
1111
},
1212
"type": "magento2-module",
13-
"version": "100.1.0",
13+
"version": "100.1.1",
1414
"license": [
1515
"OSL-3.0",
1616
"AFL-3.0"

app/code/Magento/AdvancedPricingImportExport/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/module-advanced-pricing-import-export",
33
"description": "N/A",
44
"require": {
5-
"php": "~5.6.0|7.0.2|~7.0.6",
5+
"php": "~5.6.5|7.0.2|7.0.4|~7.0.6",
66
"magento/module-catalog": "101.0.*",
77
"magento/module-catalog-inventory": "100.1.*",
88
"magento/module-eav": "100.1.*",
@@ -13,7 +13,7 @@
1313
"magento/framework": "100.1.*"
1414
},
1515
"type": "magento2-module",
16-
"version": "100.1.0",
16+
"version": "100.1.1",
1717
"license": [
1818
"OSL-3.0",
1919
"AFL-3.0"

app/code/Magento/Authorization/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
"name": "magento/module-authorization",
33
"description": "Authorization module provides access to Magento ACL functionality.",
44
"require": {
5-
"php": "~5.6.0|7.0.2|~7.0.6",
5+
"php": "~5.6.5|7.0.2|7.0.4|~7.0.6",
66
"magento/module-backend": "100.1.*",
77
"magento/framework": "100.1.*"
88
},
99
"type": "magento2-module",
10-
"version": "100.1.0",
10+
"version": "100.1.1",
1111
"license": [
1212
"OSL-3.0",
1313
"AFL-3.0"

app/code/Magento/Authorizenet/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/module-authorizenet",
33
"description": "N/A",
44
"require": {
5-
"php": "~5.6.0|7.0.2|~7.0.6",
5+
"php": "~5.6.5|7.0.2|7.0.4|~7.0.6",
66
"magento/module-sales": "100.1.*",
77
"magento/module-store": "100.1.*",
88
"magento/module-quote": "100.1.*",
@@ -13,7 +13,7 @@
1313
"magento/framework": "100.1.*"
1414
},
1515
"type": "magento2-module",
16-
"version": "100.1.1",
16+
"version": "100.1.2",
1717
"license": [
1818
"proprietary"
1919
],

app/code/Magento/Backend/Block/Store/Switcher.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
/**
1010
* Store switcher block
11-
*
12-
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1311
*/
1412
class Switcher extends \Magento\Backend\Block\Template
1513
{
@@ -152,11 +150,7 @@ public function getWebsites()
152150
{
153151
$websites = $this->_storeManager->getWebsites();
154152
if ($websiteIds = $this->getWebsiteIds()) {
155-
foreach (array_keys($websites) as $websiteId) {
156-
if (!in_array($websiteId, $websiteIds)) {
157-
unset($websites[$websiteId]);
158-
}
159-
}
153+
$websites = array_intersect_key($websites, array_flip($websiteIds));
160154
}
161155
return $websites;
162156
}

app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Currency.php

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,10 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
namespace Magento\Backend\Block\Widget\Grid\Column\Renderer;
108

119
/**
1210
* Backend grid item renderer currency
13-
*
14-
* @author Magento Core Team <core@magentocommerce.com>
1511
*/
1612
class Currency extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer
1713
{
@@ -49,6 +45,11 @@ class Currency extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstra
4945
*/
5046
protected $_localeCurrency;
5147

48+
/**
49+
* @var \Magento\Framework\Pricing\PriceCurrencyInterface
50+
*/
51+
private $priceCurrency;
52+
5253
/**
5354
* @param \Magento\Backend\Block\Context $context
5455
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
@@ -76,6 +77,23 @@ public function __construct(
7677
$this->_defaultBaseCurrency = $currencyFactory->create()->load($defaultBaseCurrencyCode);
7778
}
7879

80+
/**
81+
* Get price currency
82+
*
83+
* @return \Magento\Framework\Pricing\PriceCurrencyInterface
84+
*
85+
* @deprecated
86+
*/
87+
private function getPriceCurrency()
88+
{
89+
if ($this->priceCurrency === null) {
90+
$this->priceCurrency = \Magento\Framework\App\ObjectManager::getInstance()->get(
91+
\Magento\Framework\Pricing\PriceCurrencyInterface::class
92+
);
93+
}
94+
return $this->priceCurrency;
95+
}
96+
7997
/**
8098
* Renders grid column
8199
*
@@ -84,15 +102,9 @@ public function __construct(
84102
*/
85103
public function render(\Magento\Framework\DataObject $row)
86104
{
87-
if ($data = (string)$this->_getValue($row)) {
88-
$currency_code = $this->_getCurrencyCode($row);
89-
$data = floatval($data) * $this->_getRate($row);
90-
$sign = (bool)(int)$this->getColumn()->getShowNumberSign() && $data > 0 ? '+' : '';
91-
$data = sprintf("%f", $data);
92-
$data = $this->_localeCurrency->getCurrency($currency_code)->toCurrency($data);
93-
return $sign . $data;
94-
}
95-
return $this->getColumn()->getDefault();
105+
$price = $this->_getValue($row) ? $this->_getValue($row) : $this->getColumn()->getDefault();
106+
$displayPrice = $this->getPriceCurrency()->convertAndFormat($price, false);
107+
return $displayPrice;
96108
}
97109

98110
/**
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Backend\Test\Unit\Block\Store;
8+
9+
class SwitcherTest extends \PHPUnit_Framework_TestCase
10+
{
11+
/**
12+
* @var \Magento\Backend\Block\Store\Switcher
13+
*/
14+
private $switcherBlock;
15+
16+
private $storeManagerMock;
17+
18+
protected function setUp()
19+
{
20+
$this->storeManagerMock = $this->getMock(\Magento\Store\Model\StoreManagerInterface::class);
21+
$objectHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
22+
$context = $objectHelper->getObject(
23+
\Magento\Backend\Block\Template\Context::class,
24+
[
25+
'storeManager' => $this->storeManagerMock,
26+
]
27+
);
28+
29+
$this->switcherBlock = $objectHelper->getObject(
30+
\Magento\Backend\Block\Store\Switcher::class,
31+
['context' => $context]
32+
);
33+
}
34+
35+
public function testGetWebsites()
36+
{
37+
$websiteMock = $this->getMock(\Magento\Store\Model\Website::class, [], [], '', false);
38+
$websites = [0 => $websiteMock, 1 => $websiteMock];
39+
$this->storeManagerMock->expects($this->once())->method('getWebsites')->will($this->returnValue($websites));
40+
$this->assertEquals($websites, $this->switcherBlock->getWebsites());
41+
}
42+
43+
public function testGetWebsitesIfSetWebsiteIds()
44+
{
45+
$websiteMock = $this->getMock(\Magento\Store\Model\Website::class, [], [], '', false);
46+
$websites = [0 => $websiteMock, 1 => $websiteMock];
47+
$this->storeManagerMock->expects($this->once())->method('getWebsites')->will($this->returnValue($websites));
48+
49+
$this->switcherBlock->setWebsiteIds([1]);
50+
$expected = [1 => $websiteMock];
51+
$this->assertEquals($expected, $this->switcherBlock->getWebsites());
52+
}
53+
}

app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Renderer/CurrencyTest.php

Lines changed: 34 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -47,44 +47,49 @@ class CurrencyTest extends \PHPUnit_Framework_TestCase
4747
*/
4848
protected $_row;
4949

50+
/*
51+
* @var \PHPUnit_Framework_MockObject_MockObject
52+
*/
53+
protected $priceCurrencyMock;
54+
5055
protected function setUp()
5156
{
52-
$this->_storeManagerMock = $this->getMock('Magento\Store\Model\StoreManagerInterface');
53-
$this->_localeMock = $this->getMock('Magento\Framework\Locale\CurrencyInterface');
54-
$this->_requestMock = $this->getMock('Magento\Framework\App\RequestInterface');
57+
$this->_storeManagerMock = $this->getMock(\Magento\Store\Model\StoreManagerInterface::class);
58+
$this->_localeMock = $this->getMock(\Magento\Framework\Locale\CurrencyInterface::class);
59+
$this->_requestMock = $this->getMock(\Magento\Framework\App\RequestInterface::class);
5560

5661
$this->_curLocatorMock = $this->getMock(
57-
'Magento\Directory\Model\Currency\DefaultLocator',
62+
\Magento\Directory\Model\Currency\DefaultLocator::class,
5863
[],
5964
[],
6065
'',
6166
false
6267
);
6368
$this->_columnMock = $this->getMock(
64-
'Magento\Backend\Block\Widget\Grid\Column',
69+
\Magento\Backend\Block\Widget\Grid\Column::class,
6570
['getIndex'],
6671
[],
6772
'',
6873
false
6974
);
7075
$this->_columnMock->expects($this->any())->method('getIndex')->will($this->returnValue('columnIndex'));
7176

72-
$this->_currencyMock = $this->getMock('Magento\Directory\Model\Currency', [], [], '', false);
77+
$this->_currencyMock = $this->getMock(\Magento\Directory\Model\Currency::class, [], [], '', false);
7378
$this->_currencyMock->expects($this->any())->method('load')->will($this->returnSelf());
7479
$currencyFactoryMock = $this->getMock(
75-
'Magento\Directory\Model\CurrencyFactory',
80+
\Magento\Directory\Model\CurrencyFactory::class,
7681
['create'],
7782
[],
7883
'',
7984
false
8085
);
8186
$currencyFactoryMock->expects($this->any())->method('create')->will($this->returnValue($this->_currencyMock));
8287

83-
$this->_row = new \Magento\Framework\DataObject(['columnIndex' => '10']);
88+
$this->_row = new \Magento\Framework\DataObject(['columnIndex' => '$10.00']);
8489

8590
$helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
8691
$this->_blockCurrency = $helper->getObject(
87-
'Magento\Backend\Block\Widget\Grid\Column\Renderer\Currency',
92+
\Magento\Backend\Block\Widget\Grid\Column\Renderer\Currency::class,
8893
[
8994
'storeManager' => $this->_storeManagerMock,
9095
'localeCurrency' => $this->_localeMock,
@@ -95,6 +100,21 @@ protected function setUp()
95100
);
96101

97102
$this->_blockCurrency->setColumn($this->_columnMock);
103+
104+
$this->priceCurrencyMock = $this->getMockForAbstractClass(
105+
\Magento\Framework\Pricing\PriceCurrencyInterface::class,
106+
[],
107+
'',
108+
false,
109+
true,
110+
true,
111+
['convertAndFormat']
112+
);
113+
$helper->setBackwardCompatibleProperty(
114+
$this->_blockCurrency,
115+
'priceCurrency',
116+
$this->priceCurrencyMock
117+
);
98118
}
99119

100120
protected function tearDown()
@@ -113,46 +133,11 @@ protected function tearDown()
113133
*/
114134
public function testRenderWithDefaultCurrency()
115135
{
116-
$this->_currencyMock->expects(
117-
$this->once()
118-
)->method(
119-
'getRate'
120-
)->with(
121-
'defaultCurrency'
122-
)->will(
123-
$this->returnValue(1.5)
124-
);
125-
126-
$this->_curLocatorMock->expects(
127-
$this->any()
128-
)->method(
129-
'getDefaultCurrency'
130-
)->with(
131-
$this->_requestMock
132-
)->will(
133-
$this->returnValue('defaultCurrency')
134-
);
135-
136-
$currLocaleMock = $this->getMock('Zend_Currency', [], [], '', false);
137-
$currLocaleMock->expects(
138-
$this->once()
139-
)->method(
140-
'toCurrency'
141-
)->with(
142-
15.0000
143-
)->will(
144-
$this->returnValue('15USD')
145-
);
146-
$this->_localeMock->expects(
147-
$this->once()
148-
)->method(
149-
'getCurrency'
150-
)->with(
151-
'defaultCurrency'
152-
)->will(
153-
$this->returnValue($currLocaleMock)
154-
);
136+
$this->priceCurrencyMock->expects($this->once())
137+
->method('convertAndFormat')
138+
->with('$10.00', false)
139+
->willReturn('$10.00');
155140

156-
$this->assertEquals('15USD', $this->_blockCurrency->render($this->_row));
141+
$this->assertEquals('$10.00', $this->_blockCurrency->render($this->_row));
157142
}
158143
}

0 commit comments

Comments
 (0)