Skip to content

Commit bb99950

Browse files
author
Roman Lytvynenko
committed
MC-36647: Order can be placed as a customer after session cookie expiration with Persistent Cart enabled
1 parent 551a3a6 commit bb99950

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

app/code/Magento/Persistent/Test/Unit/Model/Customer/AuthorizationTest.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99

1010
use Magento\Customer\Model\Session as CustomerSession;
1111
use Magento\Persistent\Helper\Session as PersistentSession;
12-
use Magento\Persistent\Model\Customer\Authorization;
12+
use Magento\Persistent\Model\Customer\Authorization as PersistentAuthorization;
1313
use PHPUnit\Framework\MockObject\MockObject;
1414
use PHPUnit\Framework\TestCase;
15+
use Magento\Customer\Model\Customer\AuthorizationComposite as CustomerAuthorizationComposite;
1516

1617
/**
1718
* A test class for the persistent customers authorization
@@ -26,15 +27,20 @@ class AuthorizationTest extends TestCase
2627
private $persistentSessionMock;
2728

2829
/**
29-
* @var Authorization
30+
* @var PersistentAuthorization
3031
*/
31-
private $authorization;
32+
private $persistentCustomerAuthorization;
3233

3334
/**
3435
* @var CustomerSession|MockObject
3536
*/
3637
private $customerSessionMock;
3738

39+
/**
40+
* @var CustomerAuthorizationComposite
41+
*/
42+
private $customerAuthorizationComposite;
43+
3844
/**
3945
* @inheritdoc
4046
*/
@@ -50,10 +56,14 @@ protected function setUp(): void
5056
->disableOriginalConstructor()
5157
->getMock();
5258

53-
$this->authorization = new Authorization(
59+
$this->persistentCustomerAuthorization = new PersistentAuthorization(
5460
$this->customerSessionMock,
5561
$this->persistentSessionMock
5662
);
63+
64+
$this->customerAuthorizationComposite = new CustomerAuthorizationComposite(
65+
[$this->persistentCustomerAuthorization]
66+
);
5767
}
5868

5969
/**
@@ -71,7 +81,7 @@ public function testIsAuthorized(
7181
): void {
7282
$this->persistentSessionMock->method('isPersistent')->willReturn($isPersistent);
7383
$this->customerSessionMock->method('isLoggedIn')->willReturn($isLoggedIn);
74-
$isAllowedResult = $this->authorization->isAllowed('self');
84+
$isAllowedResult = $this->customerAuthorizationComposite->isAllowed('self');
7585

7686
$this->assertEquals($isAllowedExpectation, $isAllowedResult);
7787
}

0 commit comments

Comments
 (0)