Skip to content

Commit 1f37a3c

Browse files
committed
Merge remote-tracking branch 'mainline/develop' into BugFestW5
2 parents 783e115 + cd08089 commit 1f37a3c

File tree

198 files changed

+1492
-1850
lines changed

Some content is hidden

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

198 files changed

+1492
-1850
lines changed

app/bootstrap.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,15 @@
3131
require_once __DIR__ . '/autoload.php';
3232
require_once BP . '/app/functions.php';
3333

34-
if (!empty($_SERVER['MAGE_PROFILER'])) {
35-
\Magento\Framework\Profiler::applyConfig($_SERVER['MAGE_PROFILER'], BP, !empty($_REQUEST['isAjax']));
34+
if (!empty($_SERVER['MAGE_PROFILER'])
35+
&& isset($_SERVER['HTTP_ACCEPT'])
36+
&& strpos($_SERVER['HTTP_ACCEPT'], 'text/html') !== false
37+
) {
38+
\Magento\Framework\Profiler::applyConfig(
39+
$_SERVER['MAGE_PROFILER'],
40+
BP,
41+
!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'
42+
);
3643
}
3744
if (ini_get('date.timezone') == '') {
3845
date_default_timezone_set('UTC');

app/code/Magento/Authorizenet/Controller/Directpost/Payment.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ protected function _returnCustomerQuote($cancelOrder = false, $errorMsg = '')
130130
$order = $this->_objectManager->create('Magento\Sales\Model\Order')->loadByIncrementId($incrementId);
131131
if ($order->getId()) {
132132
try {
133-
/** @var \Magento\Quote\Model\QuoteRepository $quoteRepository */
134-
$quoteRepository = $this->_objectManager->create('Magento\Quote\Model\QuoteRepository');
133+
/** @var \Magento\Quote\Api\CartRepositoryInterface $quoteRepository */
134+
$quoteRepository = $this->_objectManager->create('Magento\Quote\Api\CartRepositoryInterface');
135135
/** @var \Magento\Quote\Model\Quote $quote */
136136
$quote = $quoteRepository->get($order->getQuoteId());
137137

app/code/Magento/Authorizenet/Model/Directpost.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet implements Tra
9393
protected $storeManager;
9494

9595
/**
96-
* @var \Magento\Quote\Model\QuoteRepository
96+
* @var \Magento\Quote\Api\CartRepositoryInterface
9797
*/
9898
protected $quoteRepository;
9999

@@ -136,7 +136,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet implements Tra
136136
* @param \Magento\Framework\HTTP\ZendClientFactory $httpClientFactory
137137
* @param \Magento\Sales\Model\OrderFactory $orderFactory
138138
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
139-
* @param \Magento\Quote\Model\QuoteRepository $quoteRepository
139+
* @param \Magento\Quote\Api\CartRepositoryInterface $quoteRepository
140140
* @param OrderSender $orderSender
141141
* @param \Magento\Sales\Api\TransactionRepositoryInterface $transactionRepository
142142
* @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
@@ -161,7 +161,7 @@ public function __construct(
161161
ZendClientFactory $httpClientFactory,
162162
\Magento\Sales\Model\OrderFactory $orderFactory,
163163
\Magento\Store\Model\StoreManagerInterface $storeManager,
164-
\Magento\Quote\Model\QuoteRepository $quoteRepository,
164+
\Magento\Quote\Api\CartRepositoryInterface $quoteRepository,
165165
\Magento\Sales\Model\Order\Email\Sender\OrderSender $orderSender,
166166
\Magento\Sales\Api\TransactionRepositoryInterface $transactionRepository,
167167
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,

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

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class Quote extends \Magento\Framework\Session\SessionManager
6060
/**
6161
* Sales quote repository
6262
*
63-
* @var \Magento\Quote\Model\QuoteRepository
63+
* @var \Magento\Quote\Api\CartRepositoryInterface
6464
*/
6565
protected $quoteRepository;
6666

@@ -74,6 +74,11 @@ class Quote extends \Magento\Framework\Session\SessionManager
7474
*/
7575
protected $groupManagement;
7676

77+
/**
78+
* @var \Magento\Quote\Model\QuoteFactory
79+
*/
80+
protected $quoteFactory;
81+
7782
/**
7883
* @param \Magento\Framework\App\Request\Http $request
7984
* @param \Magento\Framework\Session\SidResolverInterface $sidResolver
@@ -85,11 +90,11 @@ class Quote extends \Magento\Framework\Session\SessionManager
8590
* @param \Magento\Framework\Stdlib\Cookie\CookieMetadataFactory $cookieMetadataFactory
8691
* @param \Magento\Framework\App\State $appState
8792
* @param CustomerRepositoryInterface $customerRepository
88-
* @param \Magento\Quote\Model\QuoteRepository $quoteRepository
93+
* @param \Magento\Quote\Api\CartRepositoryInterface $quoteRepository
8994
* @param \Magento\Sales\Model\OrderFactory $orderFactory
9095
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
9196
* @param GroupManagementInterface $groupManagement
92-
* @throws \Magento\Framework\Exception\SessionException
97+
* @param \Magento\Quote\Model\QuoteFactory $quoteFactory
9398
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
9499
*/
95100
public function __construct(
@@ -103,16 +108,18 @@ public function __construct(
103108
\Magento\Framework\Stdlib\Cookie\CookieMetadataFactory $cookieMetadataFactory,
104109
\Magento\Framework\App\State $appState,
105110
CustomerRepositoryInterface $customerRepository,
106-
\Magento\Quote\Model\QuoteRepository $quoteRepository,
111+
\Magento\Quote\Api\CartRepositoryInterface $quoteRepository,
107112
\Magento\Sales\Model\OrderFactory $orderFactory,
108113
\Magento\Store\Model\StoreManagerInterface $storeManager,
109-
GroupManagementInterface $groupManagement
114+
GroupManagementInterface $groupManagement,
115+
\Magento\Quote\Model\QuoteFactory $quoteFactory
110116
) {
111117
$this->customerRepository = $customerRepository;
112118
$this->quoteRepository = $quoteRepository;
113119
$this->_orderFactory = $orderFactory;
114120
$this->_storeManager = $storeManager;
115121
$this->groupManagement = $groupManagement;
122+
$this->quoteFactory = $quoteFactory;
116123
parent::__construct(
117124
$request,
118125
$sidResolver,
@@ -137,7 +144,7 @@ public function __construct(
137144
public function getQuote()
138145
{
139146
if ($this->_quote === null) {
140-
$this->_quote = $this->quoteRepository->create();
147+
$this->_quote = $this->quoteFactory->create();
141148
if ($this->getStoreId()) {
142149
if (!$this->getQuoteId()) {
143150
$this->_quote->setCustomerGroupId($this->groupManagement->getDefaultGroup()->getId())

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

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
/**
99
* Class QuoteTest
1010
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
11+
* @SuppressWarnings(PHPMD.TooManyFields)
1112
*/
1213
class QuoteTest extends \PHPUnit_Framework_TestCase
1314
{
@@ -86,6 +87,11 @@ class QuoteTest extends \PHPUnit_Framework_TestCase
8687
*/
8788
protected $groupManagementMock;
8889

90+
/**
91+
* @var \PHPUnit_Framework_MockObject_MockObject
92+
*/
93+
protected $quoteFactoryMock;
94+
8995
/**
9096
* Set up
9197
*
@@ -122,13 +128,7 @@ protected function setUp()
122128
true,
123129
['getValue']
124130
);
125-
$this->quoteRepositoryMock = $this->getMock(
126-
'Magento\Quote\Model\QuoteRepository',
127-
['create', 'save', 'get'],
128-
[],
129-
'',
130-
false
131-
);
131+
$this->quoteRepositoryMock = $this->getMock('Magento\Quote\Api\CartRepositoryInterface');
132132

133133
$this->requestMock = $this->getMock(
134134
'Magento\Framework\App\Request\Http',
@@ -196,6 +196,8 @@ protected function setUp()
196196
false
197197
);
198198

199+
$this->quoteFactoryMock = $this->getMock('\Magento\Quote\Model\QuoteFactory', ['create'], [], '', false);
200+
199201
$this->quote = $this->getMock(
200202
'Magento\Backend\Model\Session\Quote',
201203
['getStoreId', 'getQuoteId', 'setQuoteId', 'hasCustomerId', 'getCustomerId'],
@@ -214,6 +216,7 @@ protected function setUp()
214216
'orderFactory' => $this->orderFactoryMock,
215217
'storeManager' => $this->storeManagerMock,
216218
'groupManagement' => $this->groupManagementMock,
219+
'quoteFactory' => $this->quoteFactoryMock
217220
],
218221
'',
219222
true
@@ -302,7 +305,7 @@ public function testGetQuoteWithoutQuoteId()
302305
->method('setIsSuperMode')
303306
->with(true);
304307

305-
$this->quoteRepositoryMock->expects($this->once())
308+
$this->quoteFactoryMock->expects($this->once())
306309
->method('create')
307310
->will($this->returnValue($quoteMock));
308311
$this->quoteRepositoryMock->expects($this->once())
@@ -377,7 +380,7 @@ public function testGetQuoteWithQuoteId($customerId, $quoteCustomerId, $expected
377380
->method('getCustomerId')
378381
->will($this->returnValue($quoteCustomerId));
379382

380-
$this->quoteRepositoryMock->expects($this->once())
383+
$this->quoteFactoryMock->expects($this->once())
381384
->method('create')
382385
->will($this->returnValue($quoteMock));
383386
$this->quoteRepositoryMock->expects($this->once())

app/code/Magento/Braintree/Test/Unit/Model/CheckoutTest.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class CheckoutTest extends \PHPUnit_Framework_TestCase
5757
protected $shippingAddressMock;
5858

5959
/**
60-
* @var \Magento\Quote\Model\QuoteRepository|\PHPUnit_Framework_MockObject_MockObject
60+
* @var \Magento\Quote\Api\CartRepositoryInterface|\PHPUnit_Framework_MockObject_MockObject
6161
*/
6262
protected $quoteRepositoryMock;
6363

@@ -73,10 +73,7 @@ protected function setUp()
7373
$this->quoteMock->expects($this->any())
7474
->method('getShippingAddress')
7575
->willReturn($this->shippingAddressMock);
76-
$this->quoteRepositoryMock = $this->getMockBuilder('\Magento\Quote\Model\QuoteRepository')
77-
->disableOriginalConstructor()
78-
->getMock();
79-
76+
$this->quoteRepositoryMock = $this->getMock('\Magento\Quote\Api\CartRepositoryInterface');
8077
$configMock = $this->getMockBuilder('\Magento\Paypal\Model\Config')
8178
->disableOriginalConstructor()
8279
->getMock();

app/code/Magento/Catalog/Model/Category.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,9 +1086,10 @@ public function reindex()
10861086
$flatIndexer->reindexRow($this->getId());
10871087
}
10881088
}
1089-
$affectedProductIds = $this->getAffectedProductIds();
10901089
$productIndexer = $this->indexerRegistry->get(Indexer\Category\Product::INDEXER_ID);
1091-
if (!$productIndexer->isScheduled() && !empty($affectedProductIds)) {
1090+
if (!$productIndexer->isScheduled()
1091+
&& (!empty($this->getAffectedProductIds()) || $this->dataHasChangedFor('is_anchor'))
1092+
) {
10921093
$productIndexer->reindexList($this->getPathIds());
10931094
}
10941095
}

app/code/Magento/Catalog/Test/Unit/Model/CategoryTest.php

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -380,21 +380,37 @@ public function testReindexFlatEnabled($flatScheduled, $productScheduled, $expec
380380
public function reindexFlatDisabledTestDataProvider()
381381
{
382382
return [
383-
'set 1' => [false, 1],
384-
'set 2' => [true, 0],
383+
[false, null, null, null, 0],
384+
[true, null, null, null, 0],
385+
[false, [], null, null, 0],
386+
[false, ["1", "2"], null, null, 1],
387+
[false, null, 1, null, 1],
388+
[false, ["1", "2"], 0, 1, 1],
389+
[false, null, 1, 1, 0],
385390
];
386391
}
387392

388393
/**
389-
* @param $productScheduled
390-
* @param $expectedProductReindexCall
394+
* @param bool $productScheduled
395+
* @param array $affectedIds
396+
* @param int|string $isAnchorOrig
397+
* @param int|string $isAnchor
398+
* @param int $expectedProductReindexCall
391399
*
392400
* @dataProvider reindexFlatDisabledTestDataProvider
393401
*/
394-
public function testReindexFlatDisabled($productScheduled, $expectedProductReindexCall)
395-
{
396-
$affectedProductIds = ["1", "2"];
397-
$this->category->setAffectedProductIds($affectedProductIds);
402+
public function testReindexFlatDisabled(
403+
$productScheduled,
404+
$affectedIds,
405+
$isAnchorOrig,
406+
$isAnchor,
407+
$expectedProductReindexCall
408+
) {
409+
$this->category->setAffectedProductIds($affectedIds);
410+
$this->category->setData('is_anchor', $isAnchor);
411+
$this->category->setOrigData('is_anchor', $isAnchorOrig);
412+
$this->category->setAffectedProductIds($affectedIds);
413+
398414
$pathIds = ['path/1/2', 'path/2/3'];
399415
$this->category->setData('path_ids', $pathIds);
400416
$this->category->setId('123');
@@ -403,8 +419,12 @@ public function testReindexFlatDisabled($productScheduled, $expectedProductReind
403419
->method('isFlatEnabled')
404420
->will($this->returnValue(false));
405421

406-
$this->productIndexer->expects($this->exactly(1))->method('isScheduled')->will($this->returnValue($productScheduled));
407-
$this->productIndexer->expects($this->exactly($expectedProductReindexCall))->method('reindexList')->with($pathIds);
422+
$this->productIndexer->expects($this->exactly(1))
423+
->method('isScheduled')
424+
->willReturn($productScheduled);
425+
$this->productIndexer->expects($this->exactly($expectedProductReindexCall))
426+
->method('reindexList')
427+
->with($pathIds);
408428

409429
$this->indexerRegistry->expects($this->at(0))
410430
->method('get')

app/code/Magento/Catalog/etc/product_options_merged.xsd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
9-
<xs:redefine schemaLocation="product_options.xsd">
9+
<xs:redefine schemaLocation="urn:magento:module:Magento_Catalog:etc/product_options.xsd">
1010
<xs:complexType name="optionDeclaration">
1111
<xs:complexContent>
1212
<xs:restriction base="optionDeclaration">

app/code/Magento/Catalog/etc/product_types.xsd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
9-
<xs:include schemaLocation="product_types_base.xsd" />
9+
<xs:include schemaLocation="urn:magento:module:Magento_Catalog:etc/product_types_base.xsd" />
1010

1111
<xs:element name="config">
1212
<xs:complexType>

0 commit comments

Comments
 (0)