Skip to content

Commit 77c35b5

Browse files
committed
Merge branch 'mainline' into MAGETWO-44464
2 parents 17542e5 + fd7abdf commit 77c35b5

File tree

116 files changed

+672
-1686
lines changed

Some content is hidden

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

116 files changed

+672
-1686
lines changed

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/Captcha/Block/Captcha.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public function __construct(
3232
) {
3333
$this->_captchaData = $captchaData;
3434
parent::__construct($context, $data);
35+
$this->_isScopePrivate = true;
3536
}
3637

3738
/**

app/code/Magento/Checkout/Controller/Cart/CouponPost.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class CouponPost extends \Magento\Checkout\Controller\Cart
1010
/**
1111
* Sales quote repository
1212
*
13-
* @var \Magento\Quote\Model\QuoteRepository
13+
* @var \Magento\Quote\Api\CartRepositoryInterface
1414
*/
1515
protected $quoteRepository;
1616

@@ -29,7 +29,7 @@ class CouponPost extends \Magento\Checkout\Controller\Cart
2929
* @param \Magento\Framework\Data\Form\FormKey\Validator $formKeyValidator
3030
* @param \Magento\Checkout\Model\Cart $cart
3131
* @param \Magento\SalesRule\Model\CouponFactory $couponFactory
32-
* @param \Magento\Quote\Model\QuoteRepository $quoteRepository
32+
* @param \Magento\Quote\Api\CartRepositoryInterface $quoteRepository
3333
* @codeCoverageIgnore
3434
*/
3535
public function __construct(
@@ -40,7 +40,7 @@ public function __construct(
4040
\Magento\Framework\Data\Form\FormKey\Validator $formKeyValidator,
4141
\Magento\Checkout\Model\Cart $cart,
4242
\Magento\SalesRule\Model\CouponFactory $couponFactory,
43-
\Magento\Quote\Model\QuoteRepository $quoteRepository
43+
\Magento\Quote\Api\CartRepositoryInterface $quoteRepository
4444
) {
4545
parent::__construct(
4646
$context,

app/code/Magento/Checkout/Controller/Cart/EstimatePost.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
class EstimatePost extends \Magento\Checkout\Controller\Cart
1212
{
1313
/**
14-
* @var \Magento\Quote\Model\QuoteRepository
14+
* @var \Magento\Quote\Api\CartRepositoryInterface
1515
*/
1616
protected $quoteRepository;
1717

@@ -22,7 +22,7 @@ class EstimatePost extends \Magento\Checkout\Controller\Cart
2222
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
2323
* @param \Magento\Framework\Data\Form\FormKey\Validator $formKeyValidator
2424
* @param CustomerCart $cart
25-
* @param \Magento\Quote\Model\QuoteRepository $quoteRepository
25+
* @param \Magento\Quote\Api\CartRepositoryInterface $quoteRepository
2626
* @codeCoverageIgnore
2727
*/
2828
public function __construct(
@@ -32,7 +32,7 @@ public function __construct(
3232
\Magento\Store\Model\StoreManagerInterface $storeManager,
3333
\Magento\Framework\Data\Form\FormKey\Validator $formKeyValidator,
3434
CustomerCart $cart,
35-
\Magento\Quote\Model\QuoteRepository $quoteRepository
35+
\Magento\Quote\Api\CartRepositoryInterface $quoteRepository
3636
) {
3737
$this->quoteRepository = $quoteRepository;
3838
parent::__construct(

app/code/Magento/Checkout/Controller/Onepage.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ abstract class Onepage extends Action
5757
protected $layoutFactory;
5858

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

@@ -91,7 +91,7 @@ abstract class Onepage extends Action
9191
* @param \Magento\Framework\Data\Form\FormKey\Validator $formKeyValidator
9292
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
9393
* @param \Magento\Framework\View\LayoutFactory $layoutFactory
94-
* @param \Magento\Quote\Model\QuoteRepository $quoteRepository
94+
* @param \Magento\Quote\Api\CartRepositoryInterface $quoteRepository
9595
* @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
9696
* @param \Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory
9797
* @param \Magento\Framework\Controller\Result\RawFactory $resultRawFactory
@@ -110,7 +110,7 @@ public function __construct(
110110
\Magento\Framework\Data\Form\FormKey\Validator $formKeyValidator,
111111
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
112112
\Magento\Framework\View\LayoutFactory $layoutFactory,
113-
\Magento\Quote\Model\QuoteRepository $quoteRepository,
113+
\Magento\Quote\Api\CartRepositoryInterface $quoteRepository,
114114
\Magento\Framework\View\Result\PageFactory $resultPageFactory,
115115
\Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory,
116116
\Magento\Framework\Controller\Result\RawFactory $resultRawFactory,

app/code/Magento/Checkout/Model/Cart.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class Cart extends DataObject implements CartInterface
8181
protected $stockState;
8282

8383
/**
84-
* @var \Magento\Quote\Model\QuoteRepository
84+
* @var \Magento\Quote\Api\CartRepositoryInterface
8585
*/
8686
protected $quoteRepository;
8787

@@ -100,7 +100,7 @@ class Cart extends DataObject implements CartInterface
100100
* @param \Magento\Framework\Message\ManagerInterface $messageManager
101101
* @param \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry
102102
* @param \Magento\CatalogInventory\Api\StockStateInterface $stockState
103-
* @param \Magento\Quote\Model\QuoteRepository $quoteRepository
103+
* @param \Magento\Quote\Api\CartRepositoryInterface $quoteRepository
104104
* @param ProductRepositoryInterface $productRepository
105105
* @param array $data
106106
* @codeCoverageIgnore
@@ -116,7 +116,7 @@ public function __construct(
116116
\Magento\Framework\Message\ManagerInterface $messageManager,
117117
\Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry,
118118
\Magento\CatalogInventory\Api\StockStateInterface $stockState,
119-
\Magento\Quote\Model\QuoteRepository $quoteRepository,
119+
\Magento\Quote\Api\CartRepositoryInterface $quoteRepository,
120120
ProductRepositoryInterface $productRepository,
121121
array $data = []
122122
) {

app/code/Magento/Checkout/Model/Cart/CollectQuote.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class CollectQuote
3333
protected $shippingMethodManager;
3434

3535
/**
36-
* @var \Magento\Quote\Model\QuoteRepository
36+
* @var \Magento\Quote\Api\CartRepositoryInterface
3737
*/
3838
protected $quoteRepository;
3939

@@ -43,7 +43,7 @@ class CollectQuote
4343
* @param \Magento\Customer\Api\AddressRepositoryInterface $addressRepository
4444
* @param \Magento\Quote\Api\Data\EstimateAddressInterfaceFactory $estimatedAddressFactory
4545
* @param \Magento\Quote\Api\ShippingMethodManagementInterface $shippingMethodManager
46-
* @param \Magento\Quote\Model\QuoteRepository $quoteRepository
46+
* @param \Magento\Quote\Api\CartRepositoryInterface $quoteRepository
4747
* @codeCoverageIgnore
4848
*/
4949
public function __construct(
@@ -52,7 +52,7 @@ public function __construct(
5252
\Magento\Customer\Api\AddressRepositoryInterface $addressRepository,
5353
\Magento\Quote\Api\Data\EstimateAddressInterfaceFactory $estimatedAddressFactory,
5454
\Magento\Quote\Api\ShippingMethodManagementInterface $shippingMethodManager,
55-
\Magento\Quote\Model\QuoteRepository $quoteRepository
55+
\Magento\Quote\Api\CartRepositoryInterface $quoteRepository
5656
) {
5757
$this->customerSession = $customerSession;
5858
$this->customerRepository = $customerRepository;

app/code/Magento/Checkout/Model/DefaultConfigProvider.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Magento\Framework\App\Http\Context as HttpContext;
1616
use Magento\Framework\Data\Form\FormKey;
1717
use Magento\Framework\Locale\CurrencyInterface as CurrencyManager;
18-
use Magento\Quote\Model\QuoteRepository;
18+
use Magento\Quote\Api\CartRepositoryInterface;
1919
use Magento\Quote\Api\CartItemRepositoryInterface as QuoteItemRepository;
2020
use Magento\Quote\Api\ShippingMethodManagementInterface as ShippingMethodManager;
2121
use Magento\Catalog\Helper\Product\ConfigurationPool;
@@ -63,7 +63,7 @@ class DefaultConfigProvider implements ConfigProviderInterface
6363
private $httpContext;
6464

6565
/**
66-
* @var QuoteRepository
66+
* @var \Magento\Quote\Api\CartRepositoryInterface
6767
*/
6868
private $quoteRepository;
6969

@@ -169,7 +169,7 @@ class DefaultConfigProvider implements ConfigProviderInterface
169169
* @param CustomerSession $customerSession
170170
* @param CustomerUrlManager $customerUrlManager
171171
* @param HttpContext $httpContext
172-
* @param QuoteRepository $quoteRepository
172+
* @param \Magento\Quote\Api\CartRepositoryInterface $quoteRepository
173173
* @param QuoteItemRepository $quoteItemRepository
174174
* @param ShippingMethodManager $shippingMethodManager
175175
* @param ConfigurationPool $configurationPool
@@ -199,7 +199,7 @@ public function __construct(
199199
CustomerSession $customerSession,
200200
CustomerUrlManager $customerUrlManager,
201201
HttpContext $httpContext,
202-
QuoteRepository $quoteRepository,
202+
\Magento\Quote\Api\CartRepositoryInterface $quoteRepository,
203203
QuoteItemRepository $quoteItemRepository,
204204
ShippingMethodManager $shippingMethodManager,
205205
ConfigurationPool $configurationPool,

app/code/Magento/Checkout/Model/GuestPaymentInformationManagement.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class GuestPaymentInformationManagement implements \Magento\Checkout\Api\GuestPa
2727
protected $cartManagement;
2828

2929
/**
30-
* @var \Magento\Checkout\Model\PaymentInformationManagement
30+
* @var \Magento\Checkout\Api\PaymentInformationManagementInterface
3131
*/
3232
protected $paymentInformationManagement;
3333

@@ -45,7 +45,7 @@ class GuestPaymentInformationManagement implements \Magento\Checkout\Api\GuestPa
4545
* @param \Magento\Quote\Api\GuestBillingAddressManagementInterface $billingAddressManagement
4646
* @param \Magento\Quote\Api\GuestPaymentMethodManagementInterface $paymentMethodManagement
4747
* @param \Magento\Quote\Api\GuestCartManagementInterface $cartManagement
48-
* @param PaymentInformationManagement $paymentInformationManagement
48+
* @param \Magento\Checkout\Api\PaymentInformationManagementInterface $paymentInformationManagement
4949
* @param \Magento\Quote\Model\QuoteIdMaskFactory $quoteIdMaskFactory
5050
* @param CartRepositoryInterface $cartRepository
5151
* @codeCoverageIgnore
@@ -54,7 +54,7 @@ public function __construct(
5454
\Magento\Quote\Api\GuestBillingAddressManagementInterface $billingAddressManagement,
5555
\Magento\Quote\Api\GuestPaymentMethodManagementInterface $paymentMethodManagement,
5656
\Magento\Quote\Api\GuestCartManagementInterface $cartManagement,
57-
\Magento\Checkout\Model\PaymentInformationManagement $paymentInformationManagement,
57+
\Magento\Checkout\Api\PaymentInformationManagementInterface $paymentInformationManagement,
5858
\Magento\Quote\Model\QuoteIdMaskFactory $quoteIdMaskFactory,
5959
CartRepositoryInterface $cartRepository
6060
) {

0 commit comments

Comments
 (0)