@@ -43,28 +43,30 @@ protected function setUp()
43
43
);
44
44
}
45
45
46
- public function testGetCustomerSessionTokensNonRegisteredCustomer ()
46
+ /**
47
+ * @param int|null $customerId
48
+ * @param bool $isLoggedCustomer
49
+ * @return void
50
+ * @dataProvider getCustomerSessionTokensNegativeDataProvider
51
+ */
52
+ public function testGetCustomerSessionTokensNegative ($ customerId , bool $ isLoggedCustomer )
47
53
{
48
- $ this ->customerSession ->expects ( self :: once ())
49
- -> method ('getCustomerId ' )
50
- -> willReturn ( null );
54
+ $ this ->customerSession ->method ( ' getCustomerId ' )-> willReturn ( $ customerId );
55
+ $ this -> customerSession -> method ('isLoggedIn ' )-> willReturn ( $ isLoggedCustomer );
56
+ $ this -> paymentTokenManagement -> expects ( static :: never ())-> method ( ' getVisibleAvailableTokens ' );
51
57
52
- $ this ->paymentTokenManagement ->expects (static ::never ())
53
- ->method ('getVisibleAvailableTokens ' );
54
-
55
- $ this ->tokenManagement ->getCustomerSessionTokens ();
58
+ static ::assertEquals ([], $ this ->tokenManagement ->getCustomerSessionTokens ());
56
59
}
57
60
58
- public function testGetCustomerSessionTokensForNotExistsCustomer ()
61
+ /**
62
+ * @return array
63
+ */
64
+ public function getCustomerSessionTokensNegativeDataProvider ()
59
65
{
60
- $ this ->customerSession ->expects (static ::once ())
61
- ->method ('getCustomerId ' )
62
- ->willReturn (null );
63
-
64
- $ this ->paymentTokenManagement ->expects (static ::never ())
65
- ->method ('getVisibleAvailableTokens ' );
66
-
67
- $ this ->tokenManagement ->getCustomerSessionTokens ();
66
+ return [
67
+ 'not registered customer ' => [null , false ],
68
+ 'not logged in customer ' => [1 , false ],
69
+ ];
68
70
}
69
71
70
72
public function testGetCustomerSessionTokens ()
@@ -77,6 +79,10 @@ public function testGetCustomerSessionTokens()
77
79
->method ('getCustomerId ' )
78
80
->willReturn ($ customerId );
79
81
82
+ $ this ->customerSession ->expects (static ::once ())
83
+ ->method ('isLoggedIn ' )
84
+ ->willReturn (true );
85
+
80
86
$ this ->paymentTokenManagement ->expects (static ::once ())
81
87
->method ('getVisibleAvailableTokens ' )
82
88
->with ($ customerId )
0 commit comments