99
1010use Magento \Customer \Model \Session as CustomerSession ;
1111use Magento \Persistent \Helper \Session as PersistentSession ;
12- use Magento \Persistent \Model \Customer \Authorization ;
12+ use Magento \Persistent \Model \Customer \Authorization as PersistentAuthorization ;
1313use PHPUnit \Framework \MockObject \MockObject ;
1414use 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