Skip to content

Commit 11f0335

Browse files
committed
magento2-login-as-customer/issues/90: Tests stabilization
1 parent 70a3d3b commit 11f0335

File tree

6 files changed

+12
-14
lines changed

6 files changed

+12
-14
lines changed
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,12 @@
77

88
namespace Magento\LoginAsCustomerWebapi\Api;
99

10-
use Magento\Framework\Exception\LocalizedException;
11-
use Magento\Framework\Exception\NoSuchEntityException;
12-
1310
/**
1411
* Interface providing customer token generation for admin.
1512
*
1613
* @api
1714
*/
18-
interface LoginAsCustomerWebapiCreateCustomerAccessTokenInterface
15+
interface CreateCustomerAccessTokenInterface
1916
{
2017
/**
2118
* Create access token for admin by customer id.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
use Magento\Framework\Exception\LocalizedException;
1313
use Magento\Integration\Model\Oauth\TokenFactory;
1414
use Magento\LoginAsCustomerApi\Api\ConfigInterface;
15-
use Magento\LoginAsCustomerWebapi\Api\LoginAsCustomerWebapiCreateCustomerAccessTokenInterface;
15+
use Magento\LoginAsCustomerWebapi\Api\CreateCustomerAccessTokenInterface;
1616

1717
/**
1818
* @inheritdoc
1919
*/
20-
class LoginAsCustomerWebapiCreateCustomerAccessToken implements LoginAsCustomerWebapiCreateCustomerAccessTokenInterface
20+
class CreateCustomerAccessToken implements CreateCustomerAccessTokenInterface
2121
{
2222
/**
2323
* @var ConfigInterface

app/code/Magento/LoginAsCustomerWebapi/etc/acl.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<resource id="Magento_Backend::admin">
1212
<resource id="Magento_Customer::customer">
1313
<resource id="Magento_LoginAsCustomer::login" title="Login as Customer" sortOrder="50">
14-
<resource id="Magento_LoginAsCustomer::login_token" title="Create Login as Customer Token" sortOrder="30" />
14+
<resource id="Magento_LoginAsCustomerWebapi::login_token" title="Create Login as Customer Token" sortOrder="30" />
1515
</resource>
1616
</resource>
1717
</resource>

app/code/Magento/LoginAsCustomerWebapi/etc/webapi.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
99
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd">
1010
<route url="/V1/login-as-customer/token" method="POST">
11-
<service class="\Magento\LoginAsCustomerWebapi\Api\LoginAsCustomerWebapiCreateCustomerAccessTokenInterface" method="execute"/>
11+
<service class="\Magento\LoginAsCustomerWebapi\Api\CreateCustomerAccessTokenInterface" method="execute"/>
1212
<resources>
13-
<resource ref="Magento_LoginAsCustomer::login_token"/>
13+
<resource ref="Magento_LoginAsCustomerWebapi::login_token"/>
1414
</resources>
1515
</route>
1616
</routes>

app/code/Magento/LoginAsCustomerWebapi/etc/webapi_rest/di.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
99
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
10-
<preference for="Magento\LoginAsCustomerWebapi\Api\LoginAsCustomerWebapiCreateCustomerAccessTokenInterface"
11-
type="Magento\LoginAsCustomerWebapi\Model\LoginAsCustomerWebapiCreateCustomerAccessToken"/>
10+
<preference for="Magento\LoginAsCustomerWebapi\Api\CreateCustomerAccessTokenInterface"
11+
type="Magento\LoginAsCustomerWebapi\Model\CreateCustomerAccessToken"/>
1212
</config>

dev/tests/api-functional/testsuite/Magento/LoginAsCustomerWebapi/Api/LoginAsCustomerWebapiCreateCustomerAccessTokenTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

78
namespace Magento\LoginAsCustomerWebapi\Api;
89

@@ -42,9 +43,9 @@ public function setUp()
4243
*/
4344
public function testCreateCustomerAccessToken()
4445
{
45-
// 'Magento_LoginAsCustomer::login_token' resource required for access.
46+
// 'Magento_LoginAsCustomerWebapi::login_token' resource required for access.
4647
OauthHelper::clearApiAccessCredentials();
47-
OauthHelper::getApiAccessCredentials(['Magento_LoginAsCustomer::login_token']);
48+
OauthHelper::getApiAccessCredentials(['Magento_LoginAsCustomerWebapi::login_token']);
4849
try {
4950
$customerId = 1;
5051

@@ -96,7 +97,7 @@ public function testCreateCustomerAccessTokenLoginNoAccess()
9697
$this->expectException(\Exception::class);
9798
$this->expectExceptionMessage('The consumer isn\'t authorized to access %resources.');
9899

99-
// 'Magento_LoginAsCustomer::login_token' resource required for access.
100+
// 'Magento_LoginAsCustomerWebapi::login_token' resource required for access.
100101
OauthHelper::clearApiAccessCredentials();
101102
OauthHelper::getApiAccessCredentials([]);
102103
try {

0 commit comments

Comments
 (0)