Skip to content

Commit 26bd947

Browse files
author
olysenko
committed
Merge remote-tracking branch 'mainline/2.3-develop' into chaika_august2
2 parents 05e9b78 + 50503f2 commit 26bd947

File tree

40 files changed

+1101
-694
lines changed

40 files changed

+1101
-694
lines changed

app/code/Magento/CatalogUrlRewrite/Plugin/Store/Block/Switcher.php

Lines changed: 0 additions & 86 deletions
This file was deleted.

app/code/Magento/CatalogUrlRewrite/etc/frontend/di.xml

Lines changed: 0 additions & 12 deletions
This file was deleted.

app/code/Magento/Customer/Model/Session.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ public function authenticate($loginUrl = null)
487487
$this->response->setRedirect($loginUrl);
488488
} else {
489489
$arguments = $this->_customerUrl->getLoginUrlParams();
490-
if ($this->_session->getCookieShouldBeReceived() && $this->_createUrl()->getUseSession()) {
490+
if ($this->_createUrl()->getUseSession()) {
491491
$arguments += [
492492
'_query' => [
493493
$this->sidResolver->getSessionIdQueryParam($this->_session) => $this->_session->getSessionId(),

app/code/Magento/Customer/Test/Unit/Model/SessionTest.php

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ class SessionTest extends \PHPUnit\Framework\TestCase
5252
*/
5353
protected $_model;
5454

55+
/**
56+
* @return void
57+
*/
5558
protected function setUp()
5659
{
5760
$this->_storageMock = $this->createPartialMock(
@@ -82,6 +85,9 @@ protected function setUp()
8285
);
8386
}
8487

88+
/**
89+
* @return void
90+
*/
8591
public function testSetCustomerAsLoggedIn()
8692
{
8793
$customer = $this->createMock(\Magento\Customer\Model\Customer::class);
@@ -102,6 +108,9 @@ public function testSetCustomerAsLoggedIn()
102108
$this->assertSame($customer, $this->_model->getCustomer());
103109
}
104110

111+
/**
112+
* @return void
113+
*/
105114
public function testSetCustomerDataAsLoggedIn()
106115
{
107116
$customer = $this->createMock(\Magento\Customer\Model\Customer::class);
@@ -126,27 +135,36 @@ public function testSetCustomerDataAsLoggedIn()
126135
$this->assertSame($customer, $this->_model->getCustomer());
127136
}
128137

138+
/**
139+
* @return void
140+
*/
129141
public function testAuthenticate()
130142
{
131143
$urlMock = $this->createMock(\Magento\Framework\Url::class);
132144
$urlMock->expects($this->exactly(2))
133145
->method('getUrl')
134-
->will($this->returnValue(''));
146+
->willReturn('');
135147
$urlMock->expects($this->once())
136148
->method('getRebuiltUrl')
137-
->will($this->returnValue(''));
138-
$this->urlFactoryMock->expects($this->exactly(3))
149+
->willReturn('');
150+
$this->urlFactoryMock->expects($this->exactly(4))
139151
->method('create')
140-
->will($this->returnValue($urlMock));
152+
->willReturn($urlMock);
153+
$urlMock->expects($this->once())
154+
->method('getUseSession')
155+
->willReturn(false);
141156

142157
$this->responseMock->expects($this->once())
143158
->method('setRedirect')
144159
->with('')
145-
->will($this->returnValue(''));
160+
->willReturn('');
146161

147162
$this->assertFalse($this->_model->authenticate());
148163
}
149164

165+
/**
166+
* @return void
167+
*/
150168
public function testLoginById()
151169
{
152170
$customerId = 1;
@@ -162,7 +180,7 @@ public function testLoginById()
162180
}
163181

164182
/**
165-
* @param $customerId
183+
* @param int $customerId
166184
* @return \PHPUnit_Framework_MockObject_MockObject
167185
*/
168186
protected function prepareLoginDataMock($customerId)
@@ -239,6 +257,9 @@ public function getIsLoggedInDataProvider()
239257
];
240258
}
241259

260+
/**
261+
* @return void
262+
*/
242263
public function testSetCustomerRemovesFlagThatShowsIfCustomerIsEmulated()
243264
{
244265
$customerMock = $this->createMock(\Magento\Customer\Model\Customer::class);

app/code/Magento/PageCache/Model/Config.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ public function __construct(
113113
*
114114
* @return int
115115
* @api
116-
* @deprecated 100.2.0 see \Magento\PageCache\Model\VclGeneratorInterface::generateVcl
117116
*/
118117
public function getType()
119118
{
@@ -125,7 +124,6 @@ public function getType()
125124
*
126125
* @return int
127126
* @api
128-
* @deprecated 100.2.0 see \Magento\PageCache\Model\VclGeneratorInterface::generateVcl
129127
*/
130128
public function getTtl()
131129
{
@@ -255,7 +253,6 @@ protected function _getDesignExceptions()
255253
*
256254
* @return bool
257255
* @api
258-
* @deprecated 100.2.0 see \Magento\PageCache\Model\VclGeneratorInterface::generateVcl
259256
*/
260257
public function isEnabled()
261258
{

app/code/Magento/Store/App/Config/Type/Scopes.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,5 +114,6 @@ private function convertIdPathToCodePath(array $patchChunks)
114114
public function clean()
115115
{
116116
$this->data = null;
117+
$this->idCodeMap = [];
117118
}
118119
}

app/code/Magento/Store/App/Response/Redirect.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -171,16 +171,6 @@ public function success($defaultUrl)
171171
*/
172172
public function updatePathParams(array $arguments)
173173
{
174-
if ($this->_session->getCookieShouldBeReceived()
175-
&& $this->_sidResolver->getUseSessionInUrl()
176-
&& $this->_canUseSessionIdInParam
177-
) {
178-
$arguments += [
179-
'_query' => [
180-
$this->_sidResolver->getSessionIdQueryParam($this->_session) => $this->_session->getSessionId(),
181-
]
182-
];
183-
}
184174
return $arguments;
185175
}
186176

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

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
use Magento\Store\Api\StoreResolverInterface;
1414
use Magento\Store\Model\Group;
1515
use Magento\Store\Model\Store;
16+
use Magento\Framework\App\ActionInterface;
17+
use Magento\Framework\App\ObjectManager;
18+
use Magento\Framework\Url\Helper\Data as UrlHelper;
1619

1720
/**
1821
* @api
@@ -30,20 +33,28 @@ class Switcher extends \Magento\Framework\View\Element\Template
3033
*/
3134
protected $_postDataHelper;
3235

36+
/**
37+
* @var UrlHelper
38+
*/
39+
private $urlHelper;
40+
3341
/**
3442
* Constructs
3543
*
3644
* @param \Magento\Framework\View\Element\Template\Context $context
3745
* @param \Magento\Framework\Data\Helper\PostHelper $postDataHelper
3846
* @param array $data
47+
* @param UrlHelper $urlHelper
3948
*/
4049
public function __construct(
4150
\Magento\Framework\View\Element\Template\Context $context,
4251
\Magento\Framework\Data\Helper\PostHelper $postDataHelper,
43-
array $data = []
52+
array $data = [],
53+
UrlHelper $urlHelper = null
4454
) {
4555
$this->_postDataHelper = $postDataHelper;
4656
parent::__construct($context, $data);
57+
$this->urlHelper = $urlHelper ?: ObjectManager::getInstance()->get(UrlHelper::class);
4758
}
4859

4960
/**
@@ -222,15 +233,20 @@ public function getStoreName()
222233
* @param Store $store
223234
* @param array $data
224235
* @return string
236+
* @throws \Magento\Framework\Exception\NoSuchEntityException
225237
*/
226238
public function getTargetStorePostData(Store $store, $data = [])
227239
{
228-
$data[StoreResolverInterface::PARAM_NAME] = $store->getCode();
240+
$data[\Magento\Store\Api\StoreResolverInterface::PARAM_NAME] = $store->getCode();
241+
$data['___from_store'] = $this->_storeManager->getStore()->getCode();
242+
243+
$urlOnTargetStore = $store->getCurrentUrl(false);
244+
$data[ActionInterface::PARAM_NAME_URL_ENCODED] = $this->urlHelper->getEncodedUrl($urlOnTargetStore);
245+
246+
$url = $this->getUrl('stores/store/redirect');
229247

230-
//We need to set fromStore argument as true because
231-
//it will enable proper URL rewriting during store switching.
232248
return $this->_postDataHelper->getPostData(
233-
$store->getCurrentUrl(true),
249+
$url,
234250
$data
235251
);
236252
}

0 commit comments

Comments
 (0)