Skip to content

Commit 70984ab

Browse files
committed
ACPT-1502: Add Customer GraphQl mutations to GraphQlStateTest.php
1 parent f9a11cf commit 70984ab

File tree

2 files changed

+60
-1
lines changed

2 files changed

+60
-1
lines changed

dev/tests/integration/testsuite/Magento/GraphQl/App/GraphQlStateTest.php

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77

88
namespace Magento\GraphQl\App;
99

10+
use Magento\Customer\Api\CustomerRepositoryInterface;
1011
use Magento\Framework\App\Http as HttpApp;
1112
use Magento\Framework\App\Request\HttpFactory as RequestFactory;
1213
use Magento\Framework\App\Response\Http as HttpResponse;
1314
use Magento\Framework\ObjectManagerInterface;
15+
use Magento\Framework\Registry;
1416
use Magento\GraphQl\App\State\Comparator;
1517
use Magento\Integration\Api\CustomerTokenServiceInterface;
1618
use Magento\TestFramework\Helper\Bootstrap;
@@ -39,6 +41,12 @@ class GraphQlStateTest extends \PHPUnit\Framework\TestCase
3941
/** @var RequestFactory */
4042
private RequestFactory $requestFactory;
4143

44+
/** @var CustomerRepositoryInterface */
45+
private CustomerRepositoryInterface $customerRepository;
46+
47+
/** @var Registry */
48+
private $registry;
49+
4250
/**
4351
* @return void
4452
*/
@@ -59,6 +67,21 @@ protected function setUp(): void
5967
*/
6068
public function testCustomerState(string $query, array $variables, array $variables2, array $authInfo, string $operationName, string $expected)
6169
{
70+
if ($operationName === 'createCustomer') {
71+
$this->customerRepository = $this->objectManager->get(CustomerRepositoryInterface::class);
72+
$this->registry = $this->objectManager->get(Registry::class);
73+
$this->registry->register('isSecureArea', true);
74+
try {
75+
$customer = $this->customerRepository->get($variables['email']);
76+
$this->customerRepository->delete($customer);
77+
$customer2 = $this->customerRepository->get($variables2['email']);
78+
$this->customerRepository->delete($customer2);
79+
} catch (\Exception $e) {
80+
// Customer does not exist
81+
} finally {
82+
$this->registry->unregister('isSecureArea', false);
83+
}
84+
}
6285
$this->testState($query, $variables, $variables2, $authInfo, $operationName, $expected);
6386
}
6487

@@ -421,7 +444,7 @@ public function customerDataProvider(): array
421444
[
422445
'firstname' => 'John',
423446
'lastname' => 'Doe',
424-
'email' => 'email1@adobe.com',
447+
'email' => 'email1@example.com',
425448
'password' => 'Password-1',
426449
],
427450
[

dev/tests/integration/testsuite/Magento/GraphQl/_files/state-skip-list.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,42 @@
140140
Magento\Framework\Css\PreProcessor\Adapter\CssInliner::class => null,
141141
Magento\Framework\Module\ModuleList::class => null,
142142
Magento\Framework\Module\Manager::class => null,
143+
144+
Magento\Authorization\Model\UserContextInterface\Proxy::class => null,
145+
Magento\Company\Model\CompanyAdminPermission::class => null,
146+
Magento\Company\Plugin\Customer\Api\CustomerRepository\Delete::class => null,
147+
Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper::class => null,
148+
Magento\Catalog\Model\Product\Attribute\Repository::class => null,
149+
Magento\Catalog\Model\ProductRepository::class => null,
150+
Magento\Framework\DataObject\Copy::class => null,
151+
Magento\Quote\Model\Quote\Item\Processor::class => null,
152+
Magento\Sales\Model\Config::class => null,
153+
Magento\Customer\Model\Session\Validators\CutoffValidator::class => null,
154+
Magento\Customer\Model\Session\Storage::class => null,
155+
Magento\Tax\Model\Calculation::class => null,
156+
Magento\OfflineShipping\Model\SalesRule\Calculator::class => null,
157+
Magento\SalesRule\Model\Validator::class => null,
158+
Magento\Sales\Model\ResourceModel\Order\Payment::class => null,
159+
Magento\Sales\Model\ResourceModel\Order\Status\History::class => null,
160+
Magento\Sales\Model\ResourceModel\Order::class => null,
161+
Magento\Quote\Model\ResourceModel\Quote::class => null,
162+
Magento\Quote\Model\Quote::class => null,
163+
Magento\NegotiableQuote\Model\NegotiableQuoteItemManagement::class => null,
164+
Magento\NegotiableQuote\Model\Quote\ViewAccess::class => null,
165+
Magento\CompanyCredit\Model\Email\Sender::class => null,
166+
Magento\NegotiableQuote\Model\NegotiableQuoteConverter::class => null,
167+
Magento\NegotiableQuote\Model\Discount\StateChanges\Applier::class => null,
168+
Magento\NegotiableQuote\Model\Discount\StateChanges\Provider::class => null,
169+
Magento\Backend\Model\Session::class => null,
170+
Magento\Checkout\Model\Session::class => null,
171+
Magento\Quote\Model\ResourceModel\Quote\Item::class => null,
172+
Magento\Backend\Model\Menu\Config::class => null,
173+
Magento\Backend\Model\Url::class => null,
174+
Magento\NegotiableQuote\Model\ResourceModel\QuoteGrid::class => null,
175+
Magento\Customer\Model\Indexer\AttributeProvider::class => null,
176+
Magento\Framework\App\Cache\FlushCacheByTags::class => null,
177+
Magento\CustomerGraphQl\Model\Context\AddUserInfoToContext::class => null,
178+
Magento\Eav\Helper\Data::class => null,
143179
],
144180
'updateCustomer' => [
145181
Magento\Framework\Url\QueryParamsResolver::class => null,

0 commit comments

Comments
 (0)