Skip to content

Commit 592915d

Browse files
authored
#23972 fix disabled guest checkout issue
1 parent af4b740 commit 592915d

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

app/code/Magento/Downloadable/Test/Unit/Observer/IsAllowedGuestCheckoutObserverTest.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ protected function setUp(): void
103103
*/
104104
public function testIsAllowedGuestCheckoutConfigSetToTrue($productType, $isAllowed): void
105105
{
106+
$storeId = 1;
107+
106108
if ($isAllowed) {
107109
$this->resultMock->expects($this->at(0))
108110
->method('setIsAllowed')
@@ -140,6 +142,10 @@ public function testIsAllowedGuestCheckoutConfigSetToTrue($productType, $isAllow
140142
->method('getStore')
141143
->willReturn($this->storeMock);
142144

145+
$this->storeMock->expects($this->any())
146+
->method('getId')
147+
->willReturn($storeId);
148+
143149
$this->eventMock->expects($this->once())
144150
->method('getResult')
145151
->willReturn($this->resultMock);
@@ -153,7 +159,7 @@ public function testIsAllowedGuestCheckoutConfigSetToTrue($productType, $isAllow
153159
->with(
154160
self::XML_PATH_DISABLE_GUEST_CHECKOUT,
155161
ScopeInterface::SCOPE_STORE,
156-
$this->storeMock
162+
$storeId
157163
)
158164
->willReturn(true);
159165

@@ -180,7 +186,7 @@ public function dataProviderForTestisAllowedGuestCheckoutConfigSetToTrue(): arra
180186

181187
public function testIsAllowedGuestCheckoutConfigSetToFalse(): void
182188
{
183-
$storeCode = 1;
189+
$storeId = 1;
184190

185191
$product = $this->getMockBuilder(Product::class)
186192
->disableOriginalConstructor()
@@ -212,6 +218,10 @@ public function testIsAllowedGuestCheckoutConfigSetToFalse(): void
212218
$this->eventMock->expects($this->once())
213219
->method('getStore')
214220
->willReturn($this->storeMock);
221+
222+
$this->storeMock->expects($this->any())
223+
->method('getId')
224+
->willReturn($storeId);
215225

216226
$this->eventMock->expects($this->once())
217227
->method('getResult')
@@ -226,7 +236,7 @@ public function testIsAllowedGuestCheckoutConfigSetToFalse(): void
226236
->with(
227237
self::XML_PATH_DISABLE_GUEST_CHECKOUT,
228238
ScopeInterface::SCOPE_STORE,
229-
$this->storeMock
239+
$storeId
230240
)
231241
->willReturn(false);
232242

0 commit comments

Comments
 (0)