/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/RevokeCustomerTokenTest.php
59 строк
2 KB
Alexandra Zota
ACP2E-4019: CE copyright updates for 2.4.9-beta1
22 окт 2025, 10:44
22 окт 2025, 10:44
264bea2
Код
Авторство
О чём код?
<?php /** * Copyright 2018 Adobe * All Rights Reserved. */ declare(strict_types=1); namespace Magento\GraphQl\Customer; use Magento\Integration\Api\CustomerTokenServiceInterface; use Magento\TestFramework\ObjectManager; use Magento\TestFramework\TestCase\GraphQlAbstract; /** * Test for revoke customer token mutation */ class RevokeCustomerTokenTest extends GraphQlAbstract { /** * @magentoApiDataFixture Magento/Customer/_files/customer.php */ public function testRevokeCustomerTokenValidCredentials() { $query = <<<QUERY mutation { revokeCustomerToken { result } } QUERY; $userName = 'customer@example.com'; $password = 'password'; /** @var CustomerTokenServiceInterface $customerTokenService */ $customerTokenService = ObjectManager::getInstance()->get(CustomerTokenServiceInterface::class); $customerToken = $customerTokenService->createCustomerAccessToken($userName, $password); $headerMap = ['Authorization' => 'Bearer ' . $customerToken]; $response = $this->graphQlMutation($query, [], '', $headerMap); $this->assertTrue($response['revokeCustomerToken']['result']); } /** */ public function testRevokeCustomerTokenForGuestCustomer() { $this->expectException(\Exception::class); $this->expectExceptionMessage('The current customer isn\'t authorized.'); $query = <<<QUERY mutation { revokeCustomerToken { result } } QUERY; $this->graphQlMutation($query, [], ''); } }