Skip to content

Commit 2026ce8

Browse files
committed
MAGETWO-91808: Categories of the Main menu in the different Store View not updated when varnish enabled
1 parent 4ac2df0 commit 2026ce8

File tree

10 files changed

+145
-2
lines changed

10 files changed

+145
-2
lines changed

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

Lines changed: 19 additions & 1 deletion
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,6 +135,9 @@ 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);
@@ -150,6 +162,9 @@ public function testAuthenticate()
150162
$this->assertFalse($this->_model->authenticate());
151163
}
152164

165+
/**
166+
* @return void
167+
*/
153168
public function testLoginById()
154169
{
155170
$customerId = 1;
@@ -165,7 +180,7 @@ public function testLoginById()
165180
}
166181

167182
/**
168-
* @param $customerId
183+
* @param int $customerId
169184
* @return \PHPUnit_Framework_MockObject_MockObject
170185
*/
171186
protected function prepareLoginDataMock($customerId)
@@ -242,6 +257,9 @@ public function getIsLoggedInDataProvider()
242257
];
243258
}
244259

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

app/code/Magento/Store/Model/Store.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1379,7 +1379,8 @@ public function getExtensionAttributes()
13791379
}
13801380

13811381
/**
1382-
* {@inheritdoc}
1382+
* @param \Magento\Store\Api\Data\StoreExtensionInterface $extensionAttributes
1383+
* @return $this
13831384
*/
13841385
public function setExtensionAttributes(
13851386
\Magento\Store\Api\Data\StoreExtensionInterface $extensionAttributes

app/code/Magento/Store/Test/Unit/Block/SwitcherTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ class SwitcherTest extends \PHPUnit\Framework\TestCase
2828
/** @var \Magento\Store\Api\Data\StoreInterface|\PHPUnit_Framework_MockObject_MockObject */
2929
private $store;
3030

31+
/**
32+
* @return void
33+
*/
3134
protected function setUp()
3235
{
3336
$this->storeManager = $this->getMockBuilder(\Magento\Store\Model\StoreManagerInterface::class)->getMock();
@@ -48,6 +51,9 @@ protected function setUp()
4851
);
4952
}
5053

54+
/**
55+
* @return void
56+
*/
5157
public function testGetTargetStorePostData()
5258
{
5359
$store = $this->getMockBuilder(\Magento\Store\Model\Store::class)
@@ -79,6 +85,7 @@ public function testGetTargetStorePostData()
7985

8086
/**
8187
* @dataProvider isStoreInUrlDataProvider
88+
* @param bool $isUseStoreInUrl
8289
*/
8390
public function testIsStoreInUrl($isUseStoreInUrl)
8491
{

app/code/Magento/Store/Test/Unit/Controller/Store/SwitchActionTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ class SwitchActionTest extends \PHPUnit\Framework\TestCase
6363
/** @var StoreSwitcherInterface|\PHPUnit_Framework_MockObject_MockObject */
6464
private $storeSwitcher;
6565

66+
/**
67+
* @return void
68+
*/
6669
protected function setUp()
6770
{
6871
$this->storeManagerMock = $this->getMockBuilder(\Magento\Store\Model\StoreManagerInterface::class)->getMock();
@@ -98,6 +101,9 @@ protected function setUp()
98101
);
99102
}
100103

104+
/**
105+
* @return void
106+
*/
101107
public function testExecute()
102108
{
103109
$storeToSwitchToCode = 'sv2';

app/code/Magento/Store/Test/Unit/Model/Plugin/StoreCookieTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ protected function setUp()
110110
);
111111
}
112112

113+
/**
114+
* @return void
115+
*/
113116
public function testBeforeDispatchNoSuchEntity()
114117
{
115118
$storeCode = 'store';
@@ -129,6 +132,9 @@ public function testBeforeDispatchNoSuchEntity()
129132
$this->plugin->beforeDispatch($this->subjectMock, $this->requestMock);
130133
}
131134

135+
/**
136+
* @return void
137+
*/
132138
public function testBeforeDispatchStoreIsInactive()
133139
{
134140
$storeCode = 'store';
@@ -148,6 +154,9 @@ public function testBeforeDispatchStoreIsInactive()
148154
$this->plugin->beforeDispatch($this->subjectMock, $this->requestMock);
149155
}
150156

157+
/**
158+
* @return void
159+
*/
151160
public function testBeforeDispatchInvalidArgument()
152161
{
153162
$storeCode = 'store';
@@ -167,6 +176,9 @@ public function testBeforeDispatchInvalidArgument()
167176
$this->plugin->beforeDispatch($this->subjectMock, $this->requestMock);
168177
}
169178

179+
/**
180+
* @return void
181+
*/
170182
public function testBeforeDispatchNoStoreCookie()
171183
{
172184
$storeCode = null;
@@ -185,6 +197,9 @@ public function testBeforeDispatchNoStoreCookie()
185197
$this->plugin->beforeDispatch($this->subjectMock, $this->requestMock);
186198
}
187199

200+
/**
201+
* @return void
202+
*/
188203
public function testBeforeDispatchWithStoreRequestParam()
189204
{
190205
$storeCode = 'store';

app/code/Magento/Store/Test/Unit/Model/StoreTest.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ class StoreTest extends \PHPUnit\Framework\TestCase
4343
*/
4444
private $urlModifierMock;
4545

46+
/**
47+
* @return void
48+
*/
4649
protected function setUp()
4750
{
4851
$this->objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
@@ -105,6 +108,9 @@ public function loadDataProvider()
105108
];
106109
}
107110

111+
/**
112+
* @return void
113+
*/
108114
public function testSetWebsite()
109115
{
110116
$website = $this->createPartialMock(\Magento\Store\Model\Website::class, ['getId', '__wakeup']);
@@ -115,6 +121,9 @@ public function testSetWebsite()
115121
$this->assertEquals(2, $model->getWebsiteId());
116122
}
117123

124+
/**
125+
* @return void
126+
*/
118127
public function testGetWebsite()
119128
{
120129
$websiteId = 2;
@@ -138,6 +147,9 @@ public function testGetWebsite()
138147
$this->assertEquals($website, $model->getWebsite());
139148
}
140149

150+
/**
151+
* @return void
152+
*/
141153
public function testGetWebsiteIfWebsiteIsNotExist()
142154
{
143155
$websiteRepository = $this->getMockBuilder(\Magento\Store\Api\WebsiteRepositoryInterface::class)
@@ -156,6 +168,9 @@ public function testGetWebsiteIfWebsiteIsNotExist()
156168
$this->assertFalse($model->getWebsite());
157169
}
158170

171+
/**
172+
* @return void
173+
*/
159174
public function testGetGroup()
160175
{
161176
$groupId = 2;
@@ -179,6 +194,9 @@ public function testGetGroup()
179194
$this->assertEquals($group, $model->getGroup());
180195
}
181196

197+
/**
198+
* @return void
199+
*/
182200
public function testGetGroupIfGroupIsNotExist()
183201
{
184202
$groupRepository = $this->getMockBuilder(\Magento\Store\Api\GroupRepositoryInterface::class)
@@ -197,6 +215,9 @@ public function testGetGroupIfGroupIsNotExist()
197215
$this->assertFalse($model->getGroup());
198216
}
199217

218+
/**
219+
* @return void
220+
*/
200221
public function testGetUrl()
201222
{
202223
$params = ['_scope_to_url' => true];
@@ -325,6 +346,9 @@ public function getBaseUrlDataProvider()
325346
];
326347
}
327348

349+
/**
350+
* @return void
351+
*/
328352
public function testGetBaseUrlEntryPoint()
329353
{
330354
$expectedPath = 'web/unsecure/base_link_url';
@@ -526,6 +550,9 @@ public function getBaseCurrencyDataProvider()
526550
];
527551
}
528552

553+
/**
554+
* @return void
555+
*/
529556
public function testGetAllowedCurrencies()
530557
{
531558
$currencyPath = 'cur/ren/cy/path';
@@ -651,11 +678,17 @@ public function testGetBaseStaticDir()
651678
$this->assertEquals($expectedResult, $this->store->getBaseStaticDir());
652679
}
653680

681+
/**
682+
* @return void
683+
*/
654684
public function testGetScopeType()
655685
{
656686
$this->assertEquals(ScopeInterface::SCOPE_STORE, $this->store->getScopeType());
657687
}
658688

689+
/**
690+
* @return void
691+
*/
659692
public function testGetScopeTypeName()
660693
{
661694
$this->assertEquals('Store View', $this->store->getScopeTypeName());

app/code/Magento/UrlRewrite/Test/Unit/Controller/RouterTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ class RouterTest extends \PHPUnit\Framework\TestCase
4040
/** @var \Magento\UrlRewrite\Model\UrlFinderInterface|\PHPUnit_Framework_MockObject_MockObject */
4141
protected $urlFinder;
4242

43+
/**
44+
* @return void
45+
*/
4346
protected function setUp()
4447
{
4548
$this->actionFactory = $this->createMock(\Magento\Framework\App\ActionFactory::class);
@@ -68,6 +71,9 @@ protected function setUp()
6871
);
6972
}
7073

74+
/**
75+
* @return void
76+
*/
7177
public function testNoRewriteExist()
7278
{
7379
$this->urlFinder->expects($this->any())->method('findOneByData')->will($this->returnValue(null));
@@ -77,6 +83,9 @@ public function testNoRewriteExist()
7783
$this->assertNull($this->router->match($this->request));
7884
}
7985

86+
/**
87+
* @return void
88+
*/
8089
public function testRewriteAfterStoreSwitcher()
8190
{
8291
$initialRequestPath = 'request-path';
@@ -146,6 +155,9 @@ public function testRewriteAfterStoreSwitcher()
146155
$this->router->match($this->request);
147156
}
148157

158+
/**
159+
* @return void
160+
*/
149161
public function testNoRewriteAfterStoreSwitcherWhenNoOldRewrite()
150162
{
151163
$this->request->expects($this->any())->method('getPathInfo')->will($this->returnValue('request-path'));
@@ -168,6 +180,9 @@ public function testNoRewriteAfterStoreSwitcherWhenNoOldRewrite()
168180
$this->assertNull($this->router->match($this->request));
169181
}
170182

183+
/**
184+
* @return void
185+
*/
171186
public function testNoRewriteAfterStoreSwitcherWhenOldRewriteEqualsToNewOne()
172187
{
173188
$this->request->expects($this->any())->method('getPathInfo')->will($this->returnValue('request-path'));
@@ -208,6 +223,9 @@ public function testNoRewriteAfterStoreSwitcherWhenOldRewriteEqualsToNewOne()
208223
$this->assertNull($this->router->match($this->request));
209224
}
210225

226+
/**
227+
* @return void
228+
*/
211229
public function testMatchWithRedirect()
212230
{
213231
$this->storeManager->expects($this->any())->method('getStore')->will($this->returnValue($this->store));
@@ -227,6 +245,9 @@ public function testMatchWithRedirect()
227245
$this->router->match($this->request);
228246
}
229247

248+
/**
249+
* @return void
250+
*/
230251
public function testMatchWithCustomInternalRedirect()
231252
{
232253
$this->storeManager->expects($this->any())->method('getStore')->will($this->returnValue($this->store));
@@ -278,6 +299,9 @@ public function externalRedirectTargetPathDataProvider()
278299
];
279300
}
280301

302+
/**
303+
* @return void
304+
*/
281305
public function testMatch()
282306
{
283307
$this->storeManager->expects($this->any())->method('getStore')->will($this->returnValue($this->store));

0 commit comments

Comments
 (0)