77namespace Magento \Integration \Model ;
88
99use Magento \Customer \Api \AccountManagementInterface ;
10- use Magento \Framework \Exception \ InputException ;
10+ use Magento \Framework \Webapi \ Rest \ Request ;
1111use Magento \Integration \Model \Oauth \Token as TokenModel ;
1212use Magento \TestFramework \Helper \Bootstrap ;
1313use Magento \TestFramework \TestCase \WebapiAbstract ;
@@ -76,25 +76,44 @@ protected function setUp(): void
7676 }
7777
7878 /**
79+ * Create customer access token
80+ *
81+ * @dataProvider storesDataProvider
7982 * @magentoApiDataFixture Magento/Customer/_files/customer.php
83+ *
84+ * @param string|null $store
85+ * @return void
8086 */
81- public function testCreateCustomerAccessToken ()
87+ public function testCreateCustomerAccessToken (? string $ store ): void
8288 {
8389 $ userName = 'customer@example.com ' ;
8490 $ password = 'password ' ;
8591
8692 $ serviceInfo = [
8793 'rest ' => [
8894 'resourcePath ' => self ::RESOURCE_PATH_CUSTOMER_TOKEN ,
89- 'httpMethod ' => \ Magento \ Framework \ Webapi \ Rest \ Request::HTTP_METHOD_POST ,
95+ 'httpMethod ' => Request::HTTP_METHOD_POST ,
9096 ],
9197 ];
9298 $ requestData = ['username ' => $ userName , 'password ' => $ password ];
93- $ accessToken = $ this ->_webApiCall ($ serviceInfo , $ requestData );
99+ $ accessToken = $ this ->_webApiCall ($ serviceInfo , $ requestData, null , $ store );
94100
95101 $ this ->assertToken ($ accessToken , $ userName , $ password );
96102 }
97103
104+ /**
105+ * DataProvider for testCreateCustomerAccessToken
106+ *
107+ * @return array
108+ */
109+ public function storesDataProvider (): array
110+ {
111+ return [
112+ 'default store ' => [null ],
113+ 'all store view ' => ['all ' ],
114+ ];
115+ }
116+
98117 /**
99118 * @dataProvider validationDataProvider
100119 */
@@ -105,7 +124,7 @@ public function testCreateCustomerAccessTokenEmptyOrNullCredentials($username, $
105124 $ serviceInfo = [
106125 'rest ' => [
107126 'resourcePath ' => self ::RESOURCE_PATH_CUSTOMER_TOKEN ,
108- 'httpMethod ' => \ Magento \ Framework \ Webapi \ Rest \ Request::HTTP_METHOD_POST ,
127+ 'httpMethod ' => Request::HTTP_METHOD_POST ,
109128 ],
110129 ];
111130 $ requestData = ['username ' => $ username , 'password ' => $ password ];
@@ -128,7 +147,7 @@ public function testCreateCustomerAccessTokenInvalidCustomer()
128147 $ serviceInfo = [
129148 'rest ' => [
130149 'resourcePath ' => self ::RESOURCE_PATH_CUSTOMER_TOKEN ,
131- 'httpMethod ' => \ Magento \ Framework \ Webapi \ Rest \ Request::HTTP_METHOD_POST ,
150+ 'httpMethod ' => Request::HTTP_METHOD_POST ,
132151 ],
133152 ];
134153 $ requestData = ['username ' => $ customerUserName , 'password ' => $ password ];
@@ -195,7 +214,7 @@ public function testThrottlingMaxAttempts()
195214 $ serviceInfo = [
196215 'rest ' => [
197216 'resourcePath ' => self ::RESOURCE_PATH_CUSTOMER_TOKEN ,
198- 'httpMethod ' => \ Magento \ Framework \ Webapi \ Rest \ Request::HTTP_METHOD_POST ,
217+ 'httpMethod ' => Request::HTTP_METHOD_POST ,
199218 ],
200219 ];
201220 $ invalidCredentials = [
@@ -238,7 +257,7 @@ public function testThrottlingAccountLockout()
238257 $ serviceInfo = [
239258 'rest ' => [
240259 'resourcePath ' => self ::RESOURCE_PATH_CUSTOMER_TOKEN ,
241- 'httpMethod ' => \ Magento \ Framework \ Webapi \ Rest \ Request::HTTP_METHOD_POST ,
260+ 'httpMethod ' => Request::HTTP_METHOD_POST ,
242261 ],
243262 ];
244263 $ invalidCredentials = [
0 commit comments