Skip to content

Commit 4aa0a42

Browse files
committed
Merge remote-tracking branch 'mainline/develop' into MAGETWO-49512
2 parents 0dc11dd + 901637a commit 4aa0a42

File tree

691 files changed

+16150
-7331
lines changed

Some content is hidden

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

691 files changed

+16150
-7331
lines changed

.htaccess

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@
44

55
# SetEnv MAGE_MODE developer
66

7-
############################################
8-
## overrides default umask value to allow using different
9-
## file permissions
10-
11-
# SetEnv MAGE_UMASK 022
12-
137
############################################
148
## uncomment these lines for CGI mode
159
## make sure to specify the correct cgi php binary file name
@@ -281,6 +275,10 @@
281275
order allow,deny
282276
deny from all
283277
</Files>
278+
<Files magento_umask>
279+
order allow,deny
280+
deny from all
281+
</Files>
284282

285283
################################
286284
## If running in cluster environment, uncomment this

.htaccess.sample

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,10 @@
274274
order allow,deny
275275
deny from all
276276
</Files>
277+
<Files magento_umask>
278+
order allow,deny
279+
deny from all
280+
</Files>
277281

278282
################################
279283
## If running in cluster environment, uncomment this

app/bootstrap.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
error_reporting(E_ALL);
1111
#ini_set('display_errors', 1);
1212

13-
/* Custom umask value may be provided in MAGE_UMASK environment variable */
14-
$mask = isset($_SERVER['MAGE_UMASK']) ? octdec($_SERVER['MAGE_UMASK']) : 002;
15-
umask($mask);
16-
1713
/* PHP version validation */
1814
if (!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 50522) {
1915
if (PHP_SAPI == 'cli') {
@@ -34,6 +30,11 @@
3430
require_once __DIR__ . '/autoload.php';
3531
require_once BP . '/app/functions.php';
3632

33+
/* Custom umask value may be provided in optional mage_umask file in root */
34+
$umaskFile = BP . '/magento_umask';
35+
$mask = file_exists($umaskFile) ? octdec(file_get_contents($umaskFile)) : 002;
36+
umask($mask);
37+
3738
if (!empty($_SERVER['MAGE_PROFILER'])
3839
&& isset($_SERVER['HTTP_ACCEPT'])
3940
&& strpos($_SERVER['HTTP_ACCEPT'], 'text/html') !== false

app/code/Magento/Backend/Block/Dashboard/Tab/Customers/Most.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,14 @@ protected function _prepareColumns()
8080

8181
$this->addColumn(
8282
'orders_count',
83-
['header' => __('Orders'), 'sortable' => false, 'index' => 'orders_count', 'type' => 'number']
83+
[
84+
'header' => __('Orders'),
85+
'sortable' => false,
86+
'index' => 'orders_count',
87+
'type' => 'number',
88+
'header_css_class' => 'col-orders',
89+
'column_css_class' => 'col-orders'
90+
]
8491
);
8592

8693
$baseCurrencyCode = (string)$this->_storeManager->getStore(

app/code/Magento/Backend/Block/Dashboard/Tab/Customers/Newest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,14 @@ protected function _prepareColumns()
7878

7979
$this->addColumn(
8080
'orders_count',
81-
['header' => __('Orders'), 'sortable' => false, 'index' => 'orders_count', 'type' => 'number']
81+
[
82+
'header' => __('Orders'),
83+
'sortable' => false,
84+
'index' => 'orders_count',
85+
'type' => 'number',
86+
'header_css_class' => 'col-orders',
87+
'column_css_class' => 'col-orders'
88+
]
8289
);
8390

8491
$baseCurrencyCode = (string)$this->_storeManager->getStore(

app/code/Magento/Backend/Block/Widget/Grid/Export.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ public function _exportIterateCollection($callback, array $args)
257257
$break = false;
258258

259259
while ($break !== true) {
260+
$originalCollection->clear();
260261
$originalCollection->setPageSize($this->getExportPageSize());
261262
$originalCollection->setCurPage($page);
262263
$originalCollection->load();

app/code/Magento/Backend/Model/Session/Quote.php

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
use Magento\Customer\Api\CustomerRepositoryInterface;
99
use Magento\Customer\Api\GroupManagementInterface;
10+
use Magento\Framework\App\ObjectManager;
11+
use Magento\Quote\Api\CartManagementInterface;
1012

1113
/**
1214
* Adminhtml quote session
@@ -79,6 +81,11 @@ class Quote extends \Magento\Framework\Session\SessionManager
7981
*/
8082
protected $quoteFactory;
8183

84+
/**
85+
* @var \Magento\Quote\Api\CartManagementInterface;
86+
*/
87+
private $cartManagement;
88+
8289
/**
8390
* @param \Magento\Framework\App\Request\Http $request
8491
* @param \Magento\Framework\Session\SidResolverInterface $sidResolver
@@ -143,15 +150,15 @@ public function __construct(
143150
*/
144151
public function getQuote()
145152
{
153+
$cartManagement = $this->getCartManagement();
154+
146155
if ($this->_quote === null) {
147-
$this->_quote = $this->quoteFactory->create();
148156
if ($this->getStoreId()) {
149157
if (!$this->getQuoteId()) {
150-
$this->_quote->setCustomerGroupId($this->groupManagement->getDefaultGroup()->getId())
151-
->setIsActive(false)
152-
->setStoreId($this->getStoreId());
153-
$this->quoteRepository->save($this->_quote);
154-
$this->setQuoteId($this->_quote->getId());
158+
$this->setQuoteId($cartManagement->createEmptyCart());
159+
$this->_quote = $this->quoteRepository->get($this->getQuoteId(), [$this->getStoreId()]);
160+
$this->_quote->setCustomerGroupId($this->groupManagement->getDefaultGroup()->getId());
161+
$this->_quote->setIsActive(false);
155162
} else {
156163
$this->_quote = $this->quoteRepository->get($this->getQuoteId(), [$this->getStoreId()]);
157164
$this->_quote->setStoreId($this->getStoreId());
@@ -169,6 +176,18 @@ public function getQuote()
169176
return $this->_quote;
170177
}
171178

179+
/**
180+
* @return CartManagementInterface
181+
* @deprecated
182+
*/
183+
private function getCartManagement()
184+
{
185+
if ($this->cartManagement === null) {
186+
$this->cartManagement = ObjectManager::getInstance()->get(CartManagementInterface::class);
187+
}
188+
return $this->cartManagement;
189+
}
190+
172191
/**
173192
* Retrieve store model object
174193
*

app/code/Magento/Backend/Test/Unit/Model/Session/AdminConfigTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function testSetCookiePathNonDefault()
112112
public function testSetSessionSettingsByConstructor($secureRequest)
113113
{
114114
$sessionName = 'admin';
115-
$this->requestMock->expects($this->once())->method('isSecure')->willReturn($secureRequest);
115+
$this->requestMock->expects($this->exactly(2))->method('isSecure')->willReturn($secureRequest);
116116

117117
$validatorMock = $this->getMockBuilder('Magento\Framework\Validator\ValidatorInterface')
118118
->disableOriginalConstructor()

app/code/Magento/Backend/Test/Unit/Model/Session/QuoteTest.php

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ class QuoteTest extends \PHPUnit_Framework_TestCase
9292
*/
9393
protected $quoteFactoryMock;
9494

95+
/**
96+
* @var \PHPUnit_Framework_MockObject_MockObject
97+
*/
98+
protected $cartManagementMock;
99+
95100
/**
96101
* Set up
97102
*
@@ -197,9 +202,16 @@ protected function setUp()
197202
);
198203

199204
$this->quoteFactoryMock = $this->getMock('\Magento\Quote\Model\QuoteFactory', ['create'], [], '', false);
205+
$this->cartManagementMock = $this->getMock(
206+
\Magento\Quote\Api\CartManagementInterface::class,
207+
[],
208+
[],
209+
'',
210+
false
211+
);
200212

201213
$this->quote = $this->getMock(
202-
'Magento\Backend\Model\Session\Quote',
214+
\Magento\Backend\Model\Session\Quote::class,
203215
['getStoreId', 'getQuoteId', 'setQuoteId', 'hasCustomerId', 'getCustomerId'],
204216
[
205217
'request' => $this->requestMock,
@@ -217,10 +229,12 @@ protected function setUp()
217229
'storeManager' => $this->storeManagerMock,
218230
'groupManagement' => $this->groupManagementMock,
219231
'quoteFactory' => $this->quoteFactoryMock
220-
],
221-
'',
222-
true
232+
]
223233
);
234+
235+
$this->prepareObjectManager([
236+
[\Magento\Quote\Api\CartManagementInterface::class, $this->cartManagementMock]
237+
]);
224238
}
225239

226240
/**
@@ -235,6 +249,8 @@ public function testGetQuoteWithoutQuoteId()
235249
$customerId = 66;
236250
$customerGroupId = 77;
237251

252+
$this->cartManagementMock->expects($this->once())->method('createEmptyCart')->willReturn($quoteId);
253+
238254
$this->quote->expects($this->any())
239255
->method('getQuoteId')
240256
->will($this->returnValue(null));
@@ -271,7 +287,6 @@ public function testGetQuoteWithoutQuoteId()
271287
'setStoreId',
272288
'setCustomerGroupId',
273289
'setIsActive',
274-
'getId',
275290
'assignCustomer',
276291
'setIgnoreOldQty',
277292
'setIsSuperMode',
@@ -281,9 +296,7 @@ public function testGetQuoteWithoutQuoteId()
281296
'',
282297
false
283298
);
284-
$quoteMock->expects($this->once())
285-
->method('setStoreId')
286-
->with($storeId);
299+
$this->quoteRepositoryMock->expects($this->once())->method('get')->willReturn($quoteMock);
287300
$quoteMock->expects($this->once())
288301
->method('setCustomerGroupId')
289302
->with($customerGroupId)
@@ -292,9 +305,6 @@ public function testGetQuoteWithoutQuoteId()
292305
->method('setIsActive')
293306
->with(false)
294307
->will($this->returnSelf());
295-
$quoteMock->expects($this->once())
296-
->method('getId')
297-
->will($this->returnValue($quoteId));
298308
$quoteMock->expects($this->once())
299309
->method('assignCustomer')
300310
->with($dataCustomerMock);
@@ -305,13 +315,6 @@ public function testGetQuoteWithoutQuoteId()
305315
->method('setIsSuperMode')
306316
->with(true);
307317

308-
$this->quoteFactoryMock->expects($this->once())
309-
->method('create')
310-
->will($this->returnValue($quoteMock));
311-
$this->quoteRepositoryMock->expects($this->once())
312-
->method('save')
313-
->with($quoteMock);
314-
315318
$this->assertEquals($quoteMock, $this->quote->getQuote());
316319
}
317320

@@ -380,9 +383,6 @@ public function testGetQuoteWithQuoteId($customerId, $quoteCustomerId, $expected
380383
->method('getCustomerId')
381384
->will($this->returnValue($quoteCustomerId));
382385

383-
$this->quoteFactoryMock->expects($this->once())
384-
->method('create')
385-
->will($this->returnValue($quoteMock));
386386
$this->quoteRepositoryMock->expects($this->once())
387387
->method('get')
388388
->with($quoteId)
@@ -401,4 +401,19 @@ public function getQuoteDataProvider()
401401
'customer ids same' => [66, 66, 'never'],
402402
];
403403
}
404+
405+
/**
406+
* @param array $map
407+
* @deprecated
408+
*/
409+
private function prepareObjectManager($map)
410+
{
411+
$objectManagerMock = $this->getMock('Magento\Framework\ObjectManagerInterface');
412+
$objectManagerMock->expects($this->any())->method('getInstance')->willReturnSelf();
413+
$objectManagerMock->expects($this->any())->method('get')->will($this->returnValueMap($map));
414+
$reflectionClass = new \ReflectionClass('Magento\Framework\App\ObjectManager');
415+
$reflectionProperty = $reflectionClass->getProperty('_instance');
416+
$reflectionProperty->setAccessible(true);
417+
$reflectionProperty->setValue($objectManagerMock);
418+
}
404419
}

app/code/Magento/Backend/etc/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
<argument name="storage" xsi:type="object">Magento\Backend\Model\Session\Quote\Storage</argument>
150150
</arguments>
151151
</type>
152-
<type name="Magento\Framework\Console\CommandList">
152+
<type name="Magento\Framework\Console\CommandListInterface">
153153
<arguments>
154154
<argument name="commands" xsi:type="array">
155155
<item name="cacheEnableCommand" xsi:type="object">Magento\Backend\Console\Command\CacheEnableCommand</item>

0 commit comments

Comments
 (0)