From 165b34067f96e7a91d8de6b3469155a81be5e086 Mon Sep 17 00:00:00 2001 From: Aakash Kumar Date: Wed, 2 Aug 2023 14:09:47 -0500 Subject: [PATCH 1/5] ACPT-1502: Add Customer GraphQl mutations to GraphQlStateTest.php --- .../Magento/GraphQl/App/GraphQlStateTest.php | 191 +++++++- .../GraphQl/_files/state-skip-list.php | 444 ++++++++++++++++++ 2 files changed, 629 insertions(+), 6 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/GraphQl/App/GraphQlStateTest.php b/dev/tests/integration/testsuite/Magento/GraphQl/App/GraphQlStateTest.php index 90efe6641b791..b57bf4bf22a08 100644 --- a/dev/tests/integration/testsuite/Magento/GraphQl/App/GraphQlStateTest.php +++ b/dev/tests/integration/testsuite/Magento/GraphQl/App/GraphQlStateTest.php @@ -12,6 +12,7 @@ use Magento\Framework\App\Response\Http as HttpResponse; use Magento\Framework\ObjectManagerInterface; use Magento\GraphQl\App\State\Comparator; +use Magento\Integration\Api\CustomerTokenServiceInterface; use Magento\TestFramework\Helper\Bootstrap; /** @@ -38,6 +39,11 @@ class GraphQlStateTest extends \PHPUnit\Framework\TestCase /** @var RequestFactory */ private RequestFactory $requestFactory; + /** + * @var CustomerTokenServiceInterface + */ + private CustomerTokenServiceInterface $customerTokenService; + /** * @return void */ @@ -46,6 +52,7 @@ protected function setUp(): void $this->objectManager = Bootstrap::getObjectManager(); $this->comparator = $this->objectManager->create(Comparator::class); $this->requestFactory = $this->objectManager->get(RequestFactory::class); + $this->customerTokenService = $this->objectManager->get(CustomerTokenServiceInterface::class); parent::setUp(); } @@ -54,23 +61,26 @@ protected function setUp(): void * @magentoConfigFixture base_website btob/website_configuration/company_active 1 * @magentoConfigFixture default_store btob/website_configuration/company_active 1 * @magentoConfigFixture default_store company/general/allow_company_registration 1 + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDataFixture Magento/Customer/_files/customer_address.php * @dataProvider queryDataProvider * @param string $query * @param array $variables * @param array $variables2 This is the second set of variables to be used in the second request + * @param array $authInfo * @param string $operationName * @param string $expected * @return void * @throws \Exception */ - public function testState(string $query, array $variables, array $variables2, string $operationName, string $expected): void + public function testState(string $query, array $variables, array $variables2, array $authInfo, string $operationName, string $expected): void { $jsonEncodedRequest = json_encode([ 'query' => $query, 'variables' => $variables, 'operationName' => $operationName ]); - $output1 = $this->request($jsonEncodedRequest, $operationName, true); + $output1 = $this->request($jsonEncodedRequest, $operationName, $authInfo, true); $this->assertStringContainsString($expected, $output1); if ($variables2) { $jsonEncodedRequest = json_encode([ @@ -79,21 +89,22 @@ public function testState(string $query, array $variables, array $variables2, st 'operationName' => $operationName ]); } - $output2 = $this->request($jsonEncodedRequest, $operationName); + $output2 = $this->request($jsonEncodedRequest, $operationName, $authInfo); $this->assertStringContainsString($expected, $output2); } /** * @param string $query * @param string $operationName + * @param array $authInfo * @param bool $firstRequest * @return string * @throws \Exception */ - private function request(string $query, string $operationName, bool $firstRequest = false): string + private function request(string $query, string $operationName, array $authInfo, bool $firstRequest = false): string { $this->comparator->rememberObjectsStateBefore($firstRequest); - $response = $this->doRequest($query); + $response = $this->doRequest($query, $authInfo); $this->comparator->rememberObjectsStateAfter($firstRequest); $result = $this->comparator->compare($operationName); $this->assertEmpty( @@ -113,13 +124,19 @@ private function request(string $query, string $operationName, bool $firstReques * @param string $query * @return string */ - private function doRequest(string $query) + private function doRequest(string $query, array $authInfo) { $request = $this->requestFactory->create(); $request->setContent($query); $request->setMethod('POST'); $request->setPathInfo('/graphql'); $request->getHeaders()->addHeaders(['content_type' => self::CONTENT_TYPE]); + if ($authInfo) { + $email = $authInfo['email']; + $password = $authInfo['password']; + $customerToken = $this->customerTokenService->createCustomerAccessToken($email, $password); + $request->getHeaders()->addHeaders(['Authorization' => 'Bearer ' . $customerToken]); + } $unusedResponse = $this->objectManager->create(HttpResponse::class); $httpApp = $this->objectManager->create( HttpApp::class, @@ -170,6 +187,7 @@ public function queryDataProvider(): array QUERY, ['id' => 4], [], + [], 'navigationMenu', '"id":4,"name":"Category 1.1","product_count":2,' ], @@ -220,6 +238,7 @@ public function queryDataProvider(): array QUERY, ['name' => 'Configurable%20Product', 'onServer' => false], [], + [], 'productDetailByName', '"sku":"configurable","name":"Configurable Product"' ], @@ -269,6 +288,7 @@ public function queryDataProvider(): array QUERY, ['id' => 4, 'currentPage' => 1, 'pageSize' => 12], [], + [], 'category', '"url_key":"category-1-1","name":"Category 1.1"' ], @@ -333,6 +353,7 @@ public function queryDataProvider(): array QUERY, ['name' => 'Simple Product1', 'onServer' => false], [], + [], 'productDetail', '"sku":"simple1","name":"Simple Product1"' ], @@ -347,9 +368,167 @@ public function queryDataProvider(): array QUERY, ['urlKey' => 'no-route'], [], + [], 'resolveUrl', '"type":"CMS_PAGE","id":1' + ], + # Customer Scenarios + 'Create Customer' => [ + <<<'QUERY' + mutation($firstname: String!, $lastname: String!, $email: String!, $password: String!) { + createCustomerV2( + input: { + firstname: $firstname, + lastname: $lastname, + email: $email, + password: $password + } + ) { + customer { + created_at + prefix + firstname + middlename + lastname + suffix + email + default_billing + default_shipping + date_of_birth + taxvat + is_subscribed + gender + allow_remote_shopping_assistance + } + } + } + QUERY, + [ + 'firstname' => 'John', + 'lastname' => 'Doe', + 'email' => 'email@adobe.com', + 'password' => 'Password-1', + ], + [ + 'firstname' => 'John', + 'lastname' => 'Doe', + 'email' => 'email2@adobe.com', + 'password' => 'Password-2', + ], + [], + 'createCustomer', + '"email":"', + ], + 'Update Customer' => [ + <<<'QUERY' + mutation($allow: Boolean!) { + updateCustomerV2( + input: { + allow_remote_shopping_assistance: $allow + } + ) { + customer { + allow_remote_shopping_assistance + } + } + } + QUERY, + ['allow' => true], + ['allow' => false], + ['email' => 'customer@example.com', 'password' => 'password'], + 'updateCustomer', + 'allow_remote_shopping_assistance' + ], + 'Update Customer Address' => [ + <<<'QUERY' + mutation($addressId: Int!, $city: String!) { + updateCustomerAddress(id: $addressId, input: { + region: { + region: "Alberta" + region_id: 66 + region_code: "AB" + } + country_code: CA + street: ["Line 1 Street","Line 2"] + company: "Company Name" + telephone: "123456789" + fax: "123123123" + postcode: "7777" + city: $city + firstname: "Adam" + lastname: "Phillis" + middlename: "A" + prefix: "Mr." + suffix: "Jr." + vat_id: "1" + default_shipping: true + default_billing: true + }) { + id + customer_id + region { + region + region_id + region_code + } + country_code + street + company + telephone + fax + postcode + city + firstname + lastname + middlename + prefix + suffix + vat_id + default_shipping + default_billing + } + } + QUERY, + ['addressId' => 1, 'city' => 'New York'], + ['addressId' => 1, 'city' => 'Austin'], + ['email' => 'customer@example.com', 'password' => 'password'], + 'updateCustomerAddress', + 'city' + ], + 'Update Customer Email' => [ + <<<'QUERY' + mutation($email: String!, $password: String!) { + updateCustomerEmail( + email: $email + password: $password + ) { + customer { + email + } + } + } + QUERY, + ['email' => 'customer2@example.com', 'password' => 'password'], + ['email' => 'customer@example.com', 'password' => 'password'], + ['email' => 'customer@example.com', 'password' => 'password'], + 'updateCustomerEmail', + 'email' + ], + 'Generate Customer Token' => [ + <<<'QUERY' + mutation($email: String!, $password: String!) { + generateCustomerToken(email: $email, password: $password) { + token + } + } + QUERY, + ['email' => 'customer@example.com', 'password' => 'password'], + ['email' => 'customer@example.com', 'password' => 'password'], + [], + 'generateCustomerToken', + 'token' ] + ]; } } diff --git a/dev/tests/integration/testsuite/Magento/GraphQl/_files/state-skip-list.php b/dev/tests/integration/testsuite/Magento/GraphQl/_files/state-skip-list.php index 7033ed2436c6c..958674b024206 100644 --- a/dev/tests/integration/testsuite/Magento/GraphQl/_files/state-skip-list.php +++ b/dev/tests/integration/testsuite/Magento/GraphQl/_files/state-skip-list.php @@ -29,6 +29,450 @@ 'resolveUrl' => [ Magento\Framework\GraphQl\Query\Fields::class => null, ], + 'createCustomer' => [ + Magento\Framework\Logger\LoggerProxy::class => null, + Magento\Framework\View\Asset\PreProcessor\Helper\Sort::class => null, + Magento\Framework\Filter\FilterManager::class => null, + Magento\Store\Model\Address\Renderer::class => null, + Magento\Customer\Model\CustomerRegistry::class => null, + Magento\Eav\Model\ResourceModel\Entity\Attribute\Set::class => null, + Magento\Eav\Model\Entity\Attribute\Set::class => null, + Magento\Eav\Model\Entity\VersionControl\Metadata::class => null, + Magento\Customer\Model\ResourceModel\Address\Relation::class => null, + Magento\Framework\Validator\Factory::class => null, + Magento\Customer\Model\ResourceModel\Address::class => null, + Magento\Framework\Translate\Inline\ConfigInterface\Proxy::class => null, + Magento\Framework\Translate\Inline::class => null, + Magento\Framework\Json\Helper\Data::class => null, + Magento\Directory\Helper\Data::class => null, + Magento\TestFramework\Api\Config\Reader\FileResolver::class => null, + Magento\Framework\Api\ExtensionAttribute\JoinProcessor::class => null, + Magento\Customer\Model\ResourceModel\AddressRepository::class => null, + Magento\Framework\Reflection\MethodsMap::class => null, + Magento\Framework\Reflection\ExtensionAttributesProcessor\Proxy::class => null, + Magento\Framework\Reflection\DataObjectProcessor::class => null, + Magento\Framework\Api\DataObjectHelper::class => null, + Magento\Customer\Model\AttributeMetadataConverter::class => null, + Magento\Customer\Model\Metadata\CustomerMetadata::class => null, + Magento\Customer\Model\Metadata\AttributeMetadataCache::class => null, + Magento\Customer\Model\Metadata\CustomerCachedMetadata::class => null, + Magento\Customer\Model\Config\Share::class => null, + Magento\Customer\Model\ResourceModel\Customer::class => null, + Magento\Framework\Api\ImageProcessor::class => null, + Magento\Customer\Model\Session\Proxy::class => null, + Magento\Customer\Model\Delegation\Storage::class => null, + Magento\Customer\Model\GroupRegistry::class => null, + Magento\Framework\Model\ResourceModel\Db\VersionControl\Metadata::class => null, + Magento\Framework\Model\ResourceModel\Db\VersionControl\Snapshot::class => null, + Magento\Tax\Model\TaxClass\Repository::class => null, + Magento\Customer\Model\ResourceModel\GroupRepository::class => null, + Magento\Customer\Model\ResourceModel\CustomerRepository::class => null, + Magento\TestFramework\Mail\Template\TransportBuilderMock::class => null, + Magento\Customer\Helper\View::class => null, + Magento\Framework\Indexer\IndexerRegistry::class => null, + Magento\Customer\Model\Customer::class => null, + Magento\Framework\Session\SessionMaxSizeConfig::class => null, + Magento\Framework\Session\SaveHandler::class => null, + Magento\Paypal\Plugin\TransparentSessionChecker::class => null, + Laminas\Uri\Uri::class => null, + Magento\Backend\App\Area\FrontNameResolver::class => null, + Magento\Backend\Helper\Data::class => null, + Magento\GraphQl\Plugin\DisableSession::class => null, + Magento\Framework\Session\Generic::class => null, + Magento\Customer\Model\Session\SessionCleaner::class => null, + Magento\Customer\Model\Authorization\CustomerSessionUserContext::class => null, + Magento\JwtUserToken\Model\ResourceModel\FastStorageRevokedWrapper::class => null, + Magento\Webapi\Model\Authorization\TokenUserContext::class => null, + Magento\Authorization\Model\CompositeUserContext::class => null, + Magento\Webapi\Model\WebapiRoleLocator::class => null, + Magento\Customer\Model\Authentication::class => null, + Magento\Company\Model\Company::class => null, + 'CustomerAddressSnapshot' => null, + 'EavVersionControlSnapshot' => null, + Magento\Catalog\Helper\Product\Flat\Indexer::class => null, + Magento\Catalog\Helper\Product::class => null, + Magento\Framework\Url\Helper\Data::class => null, + Magento\Customer\Model\Session::class => null, + Magento\Framework\Validator\EmailAddress::class => null, + Magento\CustomerGraphQl\Model\Customer\ValidateCustomerData\ValidateEmail::class => null, + Magento\CustomerGraphQl\Model\Customer\ValidateCustomerData::class => null, + Magento\Newsletter\Model\CustomerSubscriberCache::class => null, + Magento\Newsletter\Model\SubscriptionManager::class => null, + Magento\LoginAsCustomerAssistance\Model\IsAssistanceEnabled::class => null, + Magento\Framework\MessageQueue\Code\Generator\Config\RemoteServiceReader\Communication::class => null, + Magento\Framework\Webapi\ServiceInputProcessor::class => null, + Magento\Framework\MessageQueue\Publisher\Config\RemoteService\Reader::class => null, + Magento\Company\Model\Email\Transporter::class => null, + Magento\Company\Model\Customer\CompanyAttributes::class => null, + Magento\Company\Plugin\Customer\Api\CustomerRepository\Save::class => null, + Magento\Framework\Pricing\Helper\Data::class => null, + Magento\Catalog\Helper\Category::class => null, + Magento\Catalog\Helper\Data::class => null, + Magento\Tax\Helper\Data::class => null, + Magento\CustomerBalance\Helper\Data::class => null, + Magento\GiftCardAccount\Helper\Data::class => null, + Magento\Weee\Helper\Data::class => null, + Magento\GiftWrapping\Helper\Data::class => null, + Magento\Reward\Helper\Data::class => null, + Magento\Quote\Model\Quote\Address\Total\Collector::class => null, + Magento\NegotiableQuote\Helper\Quote::class => null, + Magento\Catalog\Helper\Product\Configuration::class => null, + Magento\Bundle\Helper\Catalog\Product\Configuration::class => null, + Magento\NegotiableQuote\Model\Email\LinkBuilder::class => null, + Magento\NegotiableQuote\Model\Email\Sender::class => null, + Magento\Eav\Model\AttributeDataFactory::class => null, + Magento\PageCache\Model\Cache\Server::class => null, + Magento\Company\Plugin\Customer\Api\CustomerRepository\Query::class => null, + Magento\Logging\Helper\Data::class => null, + Magento\Catalog\Helper\Product\Edit\Action\Attribute::class => null, + Magento\Logging\Model\Handler\Controllers::class => null, + Magento\Newsletter\Model\Plugin\CustomerPlugin::class => null, + Magento\Newsletter\Helper\Data::class => null, + Magento\CustomerSegment\Model\Customer::class => null, + Magento\CustomerSegment\Observer\ProcessCustomerEventObserver::class => null, + Magento\Developer\Helper\Data::class => null, + Magento\Wishlist\Plugin\SaveWishlistDataAndAddReferenceKeyToBackUrl::class => null, + Magento\Framework\View\Page\Config\Generator\Head::class => null, + Magento\Store\Model\Argument\Interpreter\ServiceUrl::class => null, + Magento\Framework\View\Layout\Argument\Interpreter\Url::class => null, + Magento\Framework\Css\PreProcessor\Adapter\CssInliner::class => null, + Magento\Framework\Module\ModuleList::class => null, + Magento\Framework\Module\Manager::class => null, + ], + 'updateCustomer' => [ + Magento\Framework\Url\QueryParamsResolver::class => null, + Magento\Framework\Registry::class => null, + Magento\Customer\Model\AddressRegistry::class => null, + Magento\Customer\Model\CustomerRegistry::class => null, + Magento\Eav\Model\ResourceModel\Entity\Attribute\Set::class => null, + Magento\Eav\Model\Entity\Attribute\Set::class => null, + Magento\Eav\Model\Entity\VersionControl\Metadata::class => null, + 'CustomerAddressSnapshot' => null, + Magento\Customer\Model\ResourceModel\Address\Relation::class => null, + Magento\Framework\Validator\Factory::class => null, + Magento\Customer\Api\CustomerRepositoryInterface\Proxy::class => null, + Magento\Customer\Model\ResourceModel\Address::class => null, + Magento\Framework\Translate\Inline\ConfigInterface\Proxy::class => null, + Magento\Framework\Translate\Inline::class => null, + Magento\Framework\Json\Helper\Data::class => null, + Magento\Directory\Helper\Data::class => null, + Magento\TestFramework\Api\Config\Reader\FileResolver::class => null, + Magento\Framework\Api\ExtensionAttribute\JoinProcessor::class => null, + Magento\Customer\Model\ResourceModel\AddressRepository::class => null, + Magento\Framework\Reflection\MethodsMap::class => null, + Magento\Framework\Reflection\ExtensionAttributesProcessor\Proxy::class => null, + Magento\Framework\Reflection\DataObjectProcessor::class => null, + Magento\Framework\Api\DataObjectHelper::class => null, + Magento\Customer\Model\AttributeMetadataConverter::class => null, + Magento\Customer\Model\AttributeMetadataDataProvider::class => null, + Magento\Customer\Model\Metadata\CustomerMetadata::class => null, + Magento\Customer\Model\Metadata\AttributeMetadataCache::class => null, + Magento\Customer\Model\Metadata\CustomerCachedMetadata::class => null, + Magento\Customer\Model\Config\Share::class => null, + 'EavVersionControlSnapshot' => null, + Magento\Customer\Model\AccountConfirmation::class => null, + Magento\Customer\Model\ResourceModel\Customer::class => null, + Magento\Framework\Api\ImageProcessor::class => null, + Magento\Customer\Model\Session\Proxy::class => null, + Magento\Customer\Model\Delegation\Storage::class => null, + Magento\Customer\Model\GroupRegistry::class => null, + Magento\Framework\Model\ResourceModel\Db\VersionControl\Metadata::class => null, + Magento\Framework\Model\ResourceModel\Db\VersionControl\Snapshot::class => null, + Magento\Tax\Model\TaxClass\Repository::class => null, + Magento\Customer\Model\ResourceModel\GroupRepository::class => null, + Magento\Customer\Model\ResourceModel\CustomerRepository::class => null, + Magento\Customer\Helper\View::class => null, + Magento\Framework\Indexer\IndexerRegistry::class => null, + Magento\Customer\Model\Customer::class => null, + Magento\Framework\Session\SessionMaxSizeConfig::class => null, + Magento\Framework\Session\SaveHandler::class => null, + Magento\Framework\Session\Storage::class => null, + Magento\Paypal\Plugin\TransparentSessionChecker::class => null, + Laminas\Uri\Uri::class => null, + Magento\Backend\App\Area\FrontNameResolver::class => null, + Magento\Backend\Helper\Data::class => null, + Magento\GraphQl\Plugin\DisableSession::class => null, + Magento\Framework\Session\Generic::class => null, + Magento\Customer\Model\Session\SessionCleaner::class => null, + Magento\Customer\Model\Authorization\CustomerSessionUserContext::class => null, + Magento\JwtUserToken\Model\ConfigurableJwtSettingsProvider::class => null, + Magento\JwtUserToken\Model\Reader::class => null, + Magento\JwtUserToken\Model\ResourceModel\FastStorageRevokedWrapper::class => null, + Magento\Webapi\Model\Authorization\TokenUserContext::class => null, + Magento\Authorization\Model\CompositeUserContext::class => null, + Magento\Webapi\Model\WebapiRoleLocator::class => null, + Magento\Customer\Model\Authentication::class => null, + Magento\Customer\Model\AccountManagement::class => null, + Magento\Company\Model\Company::class => null, + Magento\Framework\MessageQueue\Code\Generator\Config\RemoteServiceReader\Communication::class => null, + Magento\Framework\Webapi\ServiceInputProcessor::class => null, + Magento\Framework\MessageQueue\Publisher\Config\RemoteService\Reader::class => null, + Magento\Company\Model\Customer\CompanyAttributes::class => null, + Magento\Company\Plugin\Customer\Api\CustomerRepository\Query::class => null, + Magento\Customer\Model\Session::class => null, + Magento\Customer\Model\Plugin\CustomerFlushFormKey::class => null, + Magento\CustomerSegment\Model\Customer::class => null, + Magento\CustomerSegment\Observer\ProcessEventGenericObserver::class => null, + Magento\CustomerGraphQl\Model\Context\AddUserInfoToContext::class => null, + Magento\Tax\Model\Calculation::class => null, + Magento\Company\Plugin\Customer\Api\CustomerRepository\Save::class => null, + Magento\Catalog\Helper\Data::class => null, + Magento\Checkout\Model\Session::class => null, + Magento\Bundle\Pricing\Price\TaxPrice::class => null, + Magento\Eav\Model\AttributeDataFactory::class => null, + Magento\Customer\Observer\AfterAddressSaveObserver::class => null, + Magento\LoginAsCustomer\Model\GetLoggedAsCustomerAdminId::class => null, + Magento\LoginAsCustomerLogging\Observer\LogSaveCustomerAddressObserver::class => null, + Magento\GiftRegistry\Helper\Data::class => null, + Magento\GiftRegistry\Observer\AddressDataAfterLoad::class => null, + Magento\LoginAsCustomerLogging\Observer\LogSaveCustomerObserver::class => null, + Magento\LoginAsCustomerAssistance\Model\SetAssistance::class => null, + Magento\LoginAsCustomerAssistance\Plugin\CustomerPlugin::class => null, + Magento\CustomerGraphQl\Plugin\ClearCustomerSessionAfterRequest::class => null, + Magento\Framework\Module\ModuleList::class => null, + Magento\Framework\Module\Manager::class => null, + ], + 'updateCustomerAddress' => [ + Magento\Framework\Url\QueryParamsResolver::class => null, + Magento\Framework\Registry::class => null, + Magento\Customer\Model\AddressRegistry::class => null, + Magento\Customer\Model\CustomerRegistry::class => null, + Magento\Eav\Model\ResourceModel\Entity\Attribute\Set::class => null, + Magento\Eav\Model\Entity\Attribute\Set::class => null, + Magento\Eav\Model\Entity\VersionControl\Metadata::class => null, + 'CustomerAddressSnapshot' => null, + Magento\Customer\Model\ResourceModel\Address\Relation::class => null, + Magento\Framework\Validator\Factory::class => null, + Magento\Customer\Api\CustomerRepositoryInterface\Proxy::class => null, + Magento\Customer\Model\ResourceModel\Address::class => null, + Magento\Framework\Translate\Inline\ConfigInterface\Proxy::class => null, + Magento\Framework\Translate\Inline::class => null, + Magento\Framework\Json\Helper\Data::class => null, + Magento\Directory\Helper\Data::class => null, + Magento\TestFramework\Api\Config\Reader\FileResolver::class => null, + Magento\Framework\Api\ExtensionAttribute\JoinProcessor::class => null, + Magento\Customer\Model\ResourceModel\AddressRepository::class => null, + Magento\Framework\Reflection\MethodsMap::class => null, + Magento\Framework\Reflection\ExtensionAttributesProcessor\Proxy::class => null, + Magento\Framework\Reflection\DataObjectProcessor::class => null, + Magento\Framework\Api\DataObjectHelper::class => null, + Magento\Customer\Model\AttributeMetadataConverter::class => null, + Magento\Customer\Model\AttributeMetadataDataProvider::class => null, + Magento\Customer\Model\Metadata\CustomerMetadata::class => null, + Magento\Customer\Model\Metadata\AttributeMetadataCache::class => null, + Magento\Customer\Model\Metadata\CustomerCachedMetadata::class => null, + Magento\Customer\Model\Config\Share::class => null, + 'EavVersionControlSnapshot' => null, + Magento\Customer\Model\AccountConfirmation::class => null, + Magento\Customer\Model\ResourceModel\Customer::class => null, + Magento\Framework\Api\ImageProcessor::class => null, + Magento\Customer\Model\Session\Proxy::class => null, + Magento\Customer\Model\Delegation\Storage::class => null, + Magento\Tax\Model\TaxClass\Repository::class => null, + Magento\Customer\Model\ResourceModel\CustomerRepository::class => null, + Magento\Customer\Helper\View::class => null, + Magento\Framework\Indexer\IndexerRegistry::class => null, + Magento\Customer\Model\Customer::class => null, + Magento\Framework\Session\SessionMaxSizeConfig::class => null, + Magento\Framework\Session\SaveHandler::class => null, + Magento\Framework\Session\Storage::class => null, + Magento\Paypal\Plugin\TransparentSessionChecker::class => null, + Laminas\Uri\Uri::class => null, + Magento\Backend\App\Area\FrontNameResolver::class => null, + Magento\Backend\Helper\Data::class => null, + Magento\GraphQl\Plugin\DisableSession::class => null, + Magento\Framework\Session\Generic::class => null, + Magento\Customer\Model\Session\SessionCleaner::class => null, + Magento\Customer\Model\Authorization\CustomerSessionUserContext::class => null, + Magento\JwtUserToken\Model\ConfigurableJwtSettingsProvider::class => null, + Magento\JwtUserToken\Model\Reader::class => null, + Magento\JwtUserToken\Model\ResourceModel\FastStorageRevokedWrapper::class => null, + Magento\Webapi\Model\Authorization\TokenUserContext::class => null, + Magento\Authorization\Model\CompositeUserContext::class => null, + Magento\Customer\Model\Authentication::class => null, + Magento\Customer\Model\AccountManagement::class => null, + Magento\Company\Model\Company::class => null, + Magento\Framework\MessageQueue\Code\Generator\Config\RemoteServiceReader\Communication::class => null, + Magento\Framework\Webapi\ServiceInputProcessor::class => null, + Magento\Framework\MessageQueue\Publisher\Config\RemoteService\Reader::class => null, + Magento\Customer\Model\Session::class => null, + Magento\Customer\Model\Plugin\CustomerFlushFormKey::class => null, + Magento\CustomerSegment\Model\Customer::class => null, + Magento\CustomerSegment\Observer\ProcessEventGenericObserver::class => null, + Magento\CustomerGraphQl\Model\Context\AddUserInfoToContext::class => null, + Magento\Tax\Model\Calculation::class => null, + Magento\GiftRegistry\Helper\Data::class => null, + Magento\GiftRegistry\Observer\AddressDataAfterLoad::class => null, + Magento\Eav\Model\AttributeDataFactory::class => null, + Magento\Customer\Observer\AfterAddressSaveObserver::class => null, + Magento\Logging\Model\Handler\Controllers::class => null, + Magento\LoginAsCustomer\Model\GetLoggedAsCustomerAdminId::class => null, + Magento\LoginAsCustomerLogging\Observer\LogSaveCustomerAddressObserver::class => null, + Magento\Framework\App\View::class => null, + Magento\Framework\App\Action\Context::class => null, + Magento\Catalog\Helper\Data::class => null, + Magento\Checkout\Model\Session::class => null, + Magento\Bundle\Pricing\Price\TaxPrice::class => null, + Magento\CustomerGraphQl\Plugin\ClearCustomerSessionAfterRequest::class => null, + Magento\Framework\Module\ModuleList::class => null, + Magento\Framework\Module\Manager::class => null, + ], + 'updateCustomerEmail' => [ + Magento\Framework\Url\QueryParamsResolver::class => null, + Magento\Framework\Registry::class => null, + Magento\Customer\Model\AddressRegistry::class => null, + Magento\Customer\Model\CustomerRegistry::class => null, + Magento\Eav\Model\ResourceModel\Entity\Attribute\Set::class => null, + Magento\Eav\Model\Entity\Attribute\Set::class => null, + Magento\Eav\Model\Entity\VersionControl\Metadata::class => null, + 'CustomerAddressSnapshot' => null, + Magento\Customer\Model\ResourceModel\Address\Relation::class => null, + Magento\Framework\Validator\Factory::class => null, + Magento\Customer\Api\CustomerRepositoryInterface\Proxy::class => null, + Magento\Customer\Model\ResourceModel\Address::class => null, + Magento\Framework\Translate\Inline\ConfigInterface\Proxy::class => null, + Magento\Framework\Translate\Inline::class => null, + Magento\Framework\Json\Helper\Data::class => null, + Magento\Directory\Helper\Data::class => null, + Magento\TestFramework\Api\Config\Reader\FileResolver::class => null, + Magento\Framework\Api\ExtensionAttribute\JoinProcessor::class => null, + Magento\Customer\Model\ResourceModel\AddressRepository::class => null, + Magento\Framework\Reflection\MethodsMap::class => null, + Magento\Framework\Reflection\ExtensionAttributesProcessor\Proxy::class => null, + Magento\Framework\Reflection\DataObjectProcessor::class => null, + Magento\Framework\Api\DataObjectHelper::class => null, + Magento\Customer\Model\AttributeMetadataConverter::class => null, + Magento\Customer\Model\AttributeMetadataDataProvider::class => null, + Magento\Customer\Model\Metadata\CustomerMetadata::class => null, + Magento\Customer\Model\Metadata\AttributeMetadataCache::class => null, + Magento\Customer\Model\Metadata\CustomerCachedMetadata::class => null, + Magento\Customer\Model\Config\Share::class => null, + 'EavVersionControlSnapshot' => null, + Magento\Customer\Model\AccountConfirmation::class => null, + Magento\Customer\Model\ResourceModel\Customer::class => null, + Magento\Framework\Api\ImageProcessor::class => null, + Magento\Customer\Model\Session\Proxy::class => null, + Magento\Customer\Model\Delegation\Storage::class => null, + Magento\Customer\Model\GroupRegistry::class => null, + Magento\Framework\Model\ResourceModel\Db\VersionControl\Metadata::class => null, + Magento\Framework\Model\ResourceModel\Db\VersionControl\Snapshot::class => null, + Magento\Tax\Model\TaxClass\Repository::class => null, + Magento\Customer\Model\ResourceModel\GroupRepository::class => null, + Magento\Customer\Model\ResourceModel\CustomerRepository::class => null, + Magento\Customer\Helper\View::class => null, + Magento\Framework\Indexer\IndexerRegistry::class => null, + Magento\Customer\Model\Customer::class => null, + Magento\Framework\Session\SessionMaxSizeConfig::class => null, + Magento\Framework\Session\SaveHandler::class => null, + Magento\Framework\Session\Storage::class => null, + Magento\Paypal\Plugin\TransparentSessionChecker::class => null, + Laminas\Uri\Uri::class => null, + Magento\Backend\App\Area\FrontNameResolver::class => null, + Magento\Backend\Helper\Data::class => null, + Magento\GraphQl\Plugin\DisableSession::class => null, + Magento\Framework\Session\Generic::class => null, + Magento\Customer\Model\Session\SessionCleaner::class => null, + Magento\Customer\Model\Authorization\CustomerSessionUserContext::class => null, + Magento\JwtUserToken\Model\ConfigurableJwtSettingsProvider::class => null, + Magento\JwtUserToken\Model\Reader::class => null, + Magento\JwtUserToken\Model\ResourceModel\FastStorageRevokedWrapper::class => null, + Magento\Webapi\Model\Authorization\TokenUserContext::class => null, + Magento\Authorization\Model\CompositeUserContext::class => null, + Magento\Webapi\Model\WebapiRoleLocator::class => null, + Magento\Customer\Model\Authentication::class => null, + Magento\Customer\Model\AccountManagement::class => null, + Magento\Company\Model\Company::class => null, + Magento\Framework\MessageQueue\Code\Generator\Config\RemoteServiceReader\Communication::class => null, + Magento\Framework\Webapi\ServiceInputProcessor::class => null, + Magento\Framework\MessageQueue\Publisher\Config\RemoteService\Reader::class => null, + Magento\Company\Model\Customer\CompanyAttributes::class => null, + Magento\Company\Plugin\Customer\Api\CustomerRepository\Query::class => null, + Magento\Customer\Model\Session::class => null, + Magento\Customer\Model\Plugin\CustomerFlushFormKey::class => null, + Magento\CustomerSegment\Model\Customer::class => null, + Magento\CustomerSegment\Observer\ProcessEventGenericObserver::class => null, + Magento\CustomerGraphQl\Model\Context\AddUserInfoToContext::class => null, + Magento\Tax\Model\Calculation::class => null, + Magento\Company\Plugin\Customer\Api\CustomerRepository\Save::class => null, + Magento\Catalog\Helper\Data::class => null, + Magento\Checkout\Model\Session::class => null, + Magento\Bundle\Pricing\Price\TaxPrice::class => null, + Magento\Eav\Model\AttributeDataFactory::class => null, + Magento\Customer\Observer\AfterAddressSaveObserver::class => null, + Magento\LoginAsCustomer\Model\GetLoggedAsCustomerAdminId::class => null, + Magento\LoginAsCustomerLogging\Observer\LogSaveCustomerAddressObserver::class => null, + Magento\GiftRegistry\Helper\Data::class => null, + Magento\GiftRegistry\Observer\AddressDataAfterLoad::class => null, + Magento\LoginAsCustomerLogging\Observer\LogSaveCustomerObserver::class => null, + Magento\CustomerGraphQl\Plugin\ClearCustomerSessionAfterRequest::class => null, + Magento\Framework\Module\ModuleList::class => null, + Magento\Framework\Module\Manager::class => null, + Magento\GraphQlCache\Model\Plugin\Auth\TokenIssuer::class => null, + Magento\Framework\Validator\EmailAddress::class => null, + Magento\CustomerGraphQl\Model\Customer\ValidateCustomerData\ValidateEmail::class => null, + Magento\CustomerGraphQl\Model\Customer\ValidateCustomerData::class => null, + Magento\Logging\Model\Handler\Controllers::class => null, + Magento\Framework\App\View::class => null, + Magento\Framework\App\Action\Context::class => null, + ], + 'generateCustomerToken' => [ + Magento\Customer\Model\CustomerRegistry::class => null, + Magento\Eav\Model\ResourceModel\Entity\Attribute\Set::class => null, + Magento\Eav\Model\Entity\Attribute\Set::class => null, + Magento\Eav\Model\Entity\VersionControl\Metadata::class => null, + 'CustomerAddressSnapshot' => null, + Magento\Customer\Model\ResourceModel\Address\Relation::class => null, + Magento\Customer\Api\CustomerRepositoryInterface\Proxy::class => null, + Magento\Customer\Model\ResourceModel\Address::class => null, + Magento\Framework\Translate\Inline\ConfigInterface\Proxy::class => null, + Magento\Framework\Translate\Inline::class => null, + Magento\Framework\Json\Helper\Data::class => null, + Magento\Directory\Helper\Data::class => null, + Magento\TestFramework\Api\Config\Reader\FileResolver::class => null, + Magento\Framework\Api\ExtensionAttribute\JoinProcessor::class => null, + Magento\Customer\Model\ResourceModel\AddressRepository::class => null, + Magento\Framework\Reflection\MethodsMap::class => null, + Magento\Framework\Reflection\ExtensionAttributesProcessor\Proxy::class => null, + Magento\Framework\Reflection\DataObjectProcessor::class => null, + Magento\Framework\Api\DataObjectHelper::class => null, + Magento\Customer\Model\AttributeMetadataConverter::class => null, + Magento\Customer\Model\AttributeMetadataDataProvider::class => null, + Magento\Customer\Model\Metadata\CustomerMetadata::class => null, + Magento\Customer\Model\Metadata\AttributeMetadataCache::class => null, + Magento\Customer\Model\Metadata\CustomerCachedMetadata::class => null, + Magento\Customer\Model\Config\Share::class => null, + 'EavVersionControlSnapshot' => null, + Magento\Customer\Model\ResourceModel\Customer::class => null, + Magento\Framework\Api\ImageProcessor::class => null, + Magento\Customer\Model\Session\Proxy::class => null, + Magento\Customer\Model\Delegation\Storage::class => null, + Magento\Tax\Model\TaxClass\Repository::class => null, + Magento\Customer\Model\ResourceModel\CustomerRepository::class => null, + Magento\Customer\Helper\View::class => null, + Magento\Customer\Model\Customer::class => null, + Magento\Framework\Session\SessionMaxSizeConfig::class => null, + Magento\Framework\Session\SaveHandler::class => null, + Magento\Framework\Session\Storage::class => null, + Magento\Paypal\Plugin\TransparentSessionChecker::class => null, + Laminas\Uri\Uri::class => null, + Magento\Backend\App\Area\FrontNameResolver::class => null, + Magento\Backend\Helper\Data::class => null, + Magento\GraphQl\Plugin\DisableSession::class => null, + Magento\Framework\Session\Generic::class => null, + Magento\Customer\Model\Session\SessionCleaner::class => null, + Magento\Customer\Model\Authorization\CustomerSessionUserContext::class => null, + Magento\JwtUserToken\Model\ConfigurableJwtSettingsProvider::class => null, + Magento\JwtUserToken\Model\Reader::class => null, + Magento\JwtUserToken\Model\ResourceModel\FastStorageRevokedWrapper::class => null, + Magento\Webapi\Model\Authorization\TokenUserContext::class => null, + Magento\Authorization\Model\CompositeUserContext::class => null, + Magento\Customer\Model\Authentication::class => null, + Magento\Company\Model\Company::class => null, + Magento\Customer\Model\Session::class => null, + Magento\Framework\MessageQueue\Code\Generator\Config\RemoteServiceReader\Communication::class => null, + Magento\Framework\Webapi\ServiceInputProcessor::class => null, + Magento\Framework\MessageQueue\Publisher\Config\RemoteService\Reader::class => null, + ], '*' => [ Magento\TestFramework\Interception\PluginList::class => null, // memory leak, wrong sql, potential issues From e21b08afd408f1bc82967c546b6cc4d748cfc1fd Mon Sep 17 00:00:00 2001 From: Aakash Kumar Date: Fri, 4 Aug 2023 11:40:49 -0500 Subject: [PATCH 2/5] ACPT-1502: Add Customer GraphQl mutations to GraphQlStateTest.php --- .../Magento/GraphQl/App/GraphQlStateTest.php | 50 ++++++++++++------- .../GraphQl/_files/state-skip-list.php | 2 + 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/GraphQl/App/GraphQlStateTest.php b/dev/tests/integration/testsuite/Magento/GraphQl/App/GraphQlStateTest.php index b57bf4bf22a08..d9db16af43b54 100644 --- a/dev/tests/integration/testsuite/Magento/GraphQl/App/GraphQlStateTest.php +++ b/dev/tests/integration/testsuite/Magento/GraphQl/App/GraphQlStateTest.php @@ -39,11 +39,6 @@ class GraphQlStateTest extends \PHPUnit\Framework\TestCase /** @var RequestFactory */ private RequestFactory $requestFactory; - /** - * @var CustomerTokenServiceInterface - */ - private CustomerTokenServiceInterface $customerTokenService; - /** * @return void */ @@ -52,17 +47,26 @@ protected function setUp(): void $this->objectManager = Bootstrap::getObjectManager(); $this->comparator = $this->objectManager->create(Comparator::class); $this->requestFactory = $this->objectManager->get(RequestFactory::class); - $this->customerTokenService = $this->objectManager->get(CustomerTokenServiceInterface::class); parent::setUp(); } + /** + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDataFixture Magento/Customer/_files/customer_address.php + * @dataProvider customerDataProvider + * @return void + * @throws \Exception + */ + public function testCustomerState(string $query, array $variables, array $variables2, array $authInfo, string $operationName, string $expected) + { + $this->testState($query, $variables, $variables2, $authInfo, $operationName, $expected); + } + /** * Runs various GraphQL queries and checks if state of shared objects in Object Manager have changed * @magentoConfigFixture base_website btob/website_configuration/company_active 1 * @magentoConfigFixture default_store btob/website_configuration/company_active 1 * @magentoConfigFixture default_store company/general/allow_company_registration 1 - * @magentoDataFixture Magento/Customer/_files/customer.php - * @magentoDataFixture Magento/Customer/_files/customer_address.php * @dataProvider queryDataProvider * @param string $query * @param array $variables @@ -134,7 +138,8 @@ private function doRequest(string $query, array $authInfo) if ($authInfo) { $email = $authInfo['email']; $password = $authInfo['password']; - $customerToken = $this->customerTokenService->createCustomerAccessToken($email, $password); + $customerToken = $this->objectManager->get(CustomerTokenServiceInterface::class) + ->createCustomerAccessToken($email, $password); $request->getHeaders()->addHeaders(['Authorization' => 'Bearer ' . $customerToken]); } $unusedResponse = $this->objectManager->create(HttpResponse::class); @@ -372,7 +377,17 @@ public function queryDataProvider(): array 'resolveUrl', '"type":"CMS_PAGE","id":1' ], - # Customer Scenarios + ]; + } + /** + * Queries, variables, operation names, and expected responses for test + * + * @return array[] + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function customerDataProvider(): array + { + return [ 'Create Customer' => [ <<<'QUERY' mutation($firstname: String!, $lastname: String!, $email: String!, $password: String!) { @@ -433,11 +448,11 @@ public function queryDataProvider(): array } } QUERY, - ['allow' => true], - ['allow' => false], - ['email' => 'customer@example.com', 'password' => 'password'], - 'updateCustomer', - 'allow_remote_shopping_assistance' + ['allow' => true], + ['allow' => false], + ['email' => 'customer@example.com', 'password' => 'password'], + 'updateCustomer', + 'allow_remote_shopping_assistance' ], 'Update Customer Address' => [ <<<'QUERY' @@ -492,8 +507,8 @@ public function queryDataProvider(): array ['addressId' => 1, 'city' => 'New York'], ['addressId' => 1, 'city' => 'Austin'], ['email' => 'customer@example.com', 'password' => 'password'], - 'updateCustomerAddress', - 'city' + 'updateCustomerAddress', + 'city' ], 'Update Customer Email' => [ <<<'QUERY' @@ -528,7 +543,6 @@ public function queryDataProvider(): array 'generateCustomerToken', 'token' ] - ]; } } diff --git a/dev/tests/integration/testsuite/Magento/GraphQl/_files/state-skip-list.php b/dev/tests/integration/testsuite/Magento/GraphQl/_files/state-skip-list.php index 958674b024206..52a4107cf17f9 100644 --- a/dev/tests/integration/testsuite/Magento/GraphQl/_files/state-skip-list.php +++ b/dev/tests/integration/testsuite/Magento/GraphQl/_files/state-skip-list.php @@ -12,6 +12,8 @@ Magento\Customer\Model\Session::class => null, Magento\Framework\GraphQl\Query\Fields::class => null, Magento\Framework\Session\Generic::class => null, + Magento\Framework\Module\ModuleList::class => null, + Magento\Framework\Module\Manager::class => null, ], 'productDetailByName' => [ Magento\Customer\Model\Session::class => null, From 9a90d515d58f6f2ee5d1db23b09fa29374a09996 Mon Sep 17 00:00:00 2001 From: Aakash Kumar Date: Fri, 4 Aug 2023 18:44:49 -0500 Subject: [PATCH 3/5] ACPT-1502: Add Customer GraphQl mutations to GraphQlStateTest.php --- .../testsuite/Magento/GraphQl/_files/state-skip-list.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dev/tests/integration/testsuite/Magento/GraphQl/_files/state-skip-list.php b/dev/tests/integration/testsuite/Magento/GraphQl/_files/state-skip-list.php index 52a4107cf17f9..cf8e2b7236bdc 100644 --- a/dev/tests/integration/testsuite/Magento/GraphQl/_files/state-skip-list.php +++ b/dev/tests/integration/testsuite/Magento/GraphQl/_files/state-skip-list.php @@ -233,6 +233,7 @@ Magento\CustomerGraphQl\Plugin\ClearCustomerSessionAfterRequest::class => null, Magento\Framework\Module\ModuleList::class => null, Magento\Framework\Module\Manager::class => null, + Magento\Framework\Translate\Inline\Proxy::class => null, ], 'updateCustomerAddress' => [ Magento\Framework\Url\QueryParamsResolver::class => null, @@ -318,6 +319,7 @@ Magento\CustomerGraphQl\Plugin\ClearCustomerSessionAfterRequest::class => null, Magento\Framework\Module\ModuleList::class => null, Magento\Framework\Module\Manager::class => null, + Magento\Framework\Translate\Inline\Proxy::class => null, ], 'updateCustomerEmail' => [ Magento\Framework\Url\QueryParamsResolver::class => null, @@ -416,6 +418,7 @@ Magento\Logging\Model\Handler\Controllers::class => null, Magento\Framework\App\View::class => null, Magento\Framework\App\Action\Context::class => null, + Magento\Quote\Model\Quote\Address\Total\Collector::class => null, ], 'generateCustomerToken' => [ Magento\Customer\Model\CustomerRegistry::class => null, From f9a11cf53fffcd70c32339d949e31dab18dd072b Mon Sep 17 00:00:00 2001 From: Aakash Kumar Date: Sat, 5 Aug 2023 11:28:40 -0500 Subject: [PATCH 4/5] ACPT-1502: Add Customer GraphQl mutations to GraphQlStateTest.php --- .../testsuite/Magento/GraphQl/App/GraphQlStateTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/GraphQl/App/GraphQlStateTest.php b/dev/tests/integration/testsuite/Magento/GraphQl/App/GraphQlStateTest.php index d9db16af43b54..9acf5b3dacd33 100644 --- a/dev/tests/integration/testsuite/Magento/GraphQl/App/GraphQlStateTest.php +++ b/dev/tests/integration/testsuite/Magento/GraphQl/App/GraphQlStateTest.php @@ -421,7 +421,7 @@ public function customerDataProvider(): array [ 'firstname' => 'John', 'lastname' => 'Doe', - 'email' => 'email@adobe.com', + 'email' => 'email1@adobe.com', 'password' => 'Password-1', ], [ From 70984ab7ce2f4b25450b45f6ee0b19ba65440de9 Mon Sep 17 00:00:00 2001 From: Aakash Kumar Date: Sat, 5 Aug 2023 19:35:07 -0500 Subject: [PATCH 5/5] ACPT-1502: Add Customer GraphQl mutations to GraphQlStateTest.php --- .../Magento/GraphQl/App/GraphQlStateTest.php | 25 ++++++++++++- .../GraphQl/_files/state-skip-list.php | 36 +++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/GraphQl/App/GraphQlStateTest.php b/dev/tests/integration/testsuite/Magento/GraphQl/App/GraphQlStateTest.php index 9acf5b3dacd33..36510760f7403 100644 --- a/dev/tests/integration/testsuite/Magento/GraphQl/App/GraphQlStateTest.php +++ b/dev/tests/integration/testsuite/Magento/GraphQl/App/GraphQlStateTest.php @@ -7,10 +7,12 @@ namespace Magento\GraphQl\App; +use Magento\Customer\Api\CustomerRepositoryInterface; use Magento\Framework\App\Http as HttpApp; use Magento\Framework\App\Request\HttpFactory as RequestFactory; use Magento\Framework\App\Response\Http as HttpResponse; use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Registry; use Magento\GraphQl\App\State\Comparator; use Magento\Integration\Api\CustomerTokenServiceInterface; use Magento\TestFramework\Helper\Bootstrap; @@ -39,6 +41,12 @@ class GraphQlStateTest extends \PHPUnit\Framework\TestCase /** @var RequestFactory */ private RequestFactory $requestFactory; + /** @var CustomerRepositoryInterface */ + private CustomerRepositoryInterface $customerRepository; + + /** @var Registry */ + private $registry; + /** * @return void */ @@ -59,6 +67,21 @@ protected function setUp(): void */ public function testCustomerState(string $query, array $variables, array $variables2, array $authInfo, string $operationName, string $expected) { + if ($operationName === 'createCustomer') { + $this->customerRepository = $this->objectManager->get(CustomerRepositoryInterface::class); + $this->registry = $this->objectManager->get(Registry::class); + $this->registry->register('isSecureArea', true); + try { + $customer = $this->customerRepository->get($variables['email']); + $this->customerRepository->delete($customer); + $customer2 = $this->customerRepository->get($variables2['email']); + $this->customerRepository->delete($customer2); + } catch (\Exception $e) { + // Customer does not exist + } finally { + $this->registry->unregister('isSecureArea', false); + } + } $this->testState($query, $variables, $variables2, $authInfo, $operationName, $expected); } @@ -421,7 +444,7 @@ public function customerDataProvider(): array [ 'firstname' => 'John', 'lastname' => 'Doe', - 'email' => 'email1@adobe.com', + 'email' => 'email1@example.com', 'password' => 'Password-1', ], [ diff --git a/dev/tests/integration/testsuite/Magento/GraphQl/_files/state-skip-list.php b/dev/tests/integration/testsuite/Magento/GraphQl/_files/state-skip-list.php index cf8e2b7236bdc..c81076340a066 100644 --- a/dev/tests/integration/testsuite/Magento/GraphQl/_files/state-skip-list.php +++ b/dev/tests/integration/testsuite/Magento/GraphQl/_files/state-skip-list.php @@ -140,6 +140,42 @@ Magento\Framework\Css\PreProcessor\Adapter\CssInliner::class => null, Magento\Framework\Module\ModuleList::class => null, Magento\Framework\Module\Manager::class => null, + + Magento\Authorization\Model\UserContextInterface\Proxy::class => null, + Magento\Company\Model\CompanyAdminPermission::class => null, + Magento\Company\Plugin\Customer\Api\CustomerRepository\Delete::class => null, + Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper::class => null, + Magento\Catalog\Model\Product\Attribute\Repository::class => null, + Magento\Catalog\Model\ProductRepository::class => null, + Magento\Framework\DataObject\Copy::class => null, + Magento\Quote\Model\Quote\Item\Processor::class => null, + Magento\Sales\Model\Config::class => null, + Magento\Customer\Model\Session\Validators\CutoffValidator::class => null, + Magento\Customer\Model\Session\Storage::class => null, + Magento\Tax\Model\Calculation::class => null, + Magento\OfflineShipping\Model\SalesRule\Calculator::class => null, + Magento\SalesRule\Model\Validator::class => null, + Magento\Sales\Model\ResourceModel\Order\Payment::class => null, + Magento\Sales\Model\ResourceModel\Order\Status\History::class => null, + Magento\Sales\Model\ResourceModel\Order::class => null, + Magento\Quote\Model\ResourceModel\Quote::class => null, + Magento\Quote\Model\Quote::class => null, + Magento\NegotiableQuote\Model\NegotiableQuoteItemManagement::class => null, + Magento\NegotiableQuote\Model\Quote\ViewAccess::class => null, + Magento\CompanyCredit\Model\Email\Sender::class => null, + Magento\NegotiableQuote\Model\NegotiableQuoteConverter::class => null, + Magento\NegotiableQuote\Model\Discount\StateChanges\Applier::class => null, + Magento\NegotiableQuote\Model\Discount\StateChanges\Provider::class => null, + Magento\Backend\Model\Session::class => null, + Magento\Checkout\Model\Session::class => null, + Magento\Quote\Model\ResourceModel\Quote\Item::class => null, + Magento\Backend\Model\Menu\Config::class => null, + Magento\Backend\Model\Url::class => null, + Magento\NegotiableQuote\Model\ResourceModel\QuoteGrid::class => null, + Magento\Customer\Model\Indexer\AttributeProvider::class => null, + Magento\Framework\App\Cache\FlushCacheByTags::class => null, + Magento\CustomerGraphQl\Model\Context\AddUserInfoToContext::class => null, + Magento\Eav\Helper\Data::class => null, ], 'updateCustomer' => [ Magento\Framework\Url\QueryParamsResolver::class => null,