Skip to content

Commit 2b97312

Browse files
committed
ACPT-1388: Add queries to GraphQlStateTest.php
1 parent 92fa2db commit 2b97312

File tree

2 files changed

+88
-2
lines changed

2 files changed

+88
-2
lines changed

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

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ protected function setUp(): void
5151

5252
/**
5353
* Runs various GraphQL queries and checks if state of shared objects in Object Manager have changed
54-
*
54+
* @magentoConfigFixture base_website btob/website_configuration/company_active 1
55+
* @magentoConfigFixture default_store btob/website_configuration/company_active 1
56+
* @magentoConfigFixture default_store company/general/allow_company_registration 1
5557
* @dataProvider queryDataProvider
5658
* @param string $query
5759
* @param array $variables
@@ -336,6 +338,85 @@ public function queryDataProvider(): array
336338
'resolveUrl',
337339
'"type":"CMS_PAGE","id":1'
338340
],
341+
'Is Company Admin Available' => [
342+
<<<'QUERY'
343+
query {
344+
isCompanyAdminEmailAvailable(email: "admin@magento.com") {
345+
is_email_available
346+
}
347+
}
348+
QUERY,
349+
[],
350+
'isCompanyAdminEmailAvailable',
351+
'isCompanyAdminEmailAvailable'
352+
],
353+
'Create Company' => [
354+
<<<'QUERY'
355+
mutation {
356+
createCompany(
357+
input: {
358+
company_name: "Company"
359+
company_email: "email@magento.com"
360+
legal_name: "Legalname"
361+
vat_tax_id: "12345"
362+
reseller_id: "123"
363+
company_admin: {
364+
email: "admin@magento.com"
365+
firstname: "Company"
366+
lastname: "Admin"
367+
gender: 1
368+
job_title: "Manager"
369+
}
370+
legal_address: {
371+
city: "City"
372+
country_id: US
373+
postcode: "12345"
374+
region: {
375+
region_id: 35
376+
}
377+
street: ["Street 123"]
378+
telephone: "0123456789"
379+
}
380+
}
381+
) {
382+
company {
383+
id
384+
email
385+
}
386+
}
387+
}
388+
QUERY,
389+
[],
390+
'createCompany',
391+
'"email":"'
392+
],
393+
'Company User email name' => [
394+
<<<'QUERY'
395+
query {
396+
isCompanyUserEmailAvailable(email: "email@adobe.com") {
397+
is_email_available
398+
}
399+
}
400+
QUERY,
401+
[],
402+
'isCompanyUserEmailAvailable',
403+
'is_email_available'
404+
405+
],
406+
'Company email available' => [
407+
<<<'QUERY'
408+
query {
409+
isCompanyEmailAvailable(email: "email@adobe.com") {
410+
is_email_available
411+
}
412+
}
413+
QUERY,
414+
[],
415+
'isCompanyEmailAvailable',
416+
'is_email_available'
417+
418+
],
419+
339420
];
340421
}
341422
}

dev/tests/integration/testsuite/Magento/GraphQl/App/State/Collector.php

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

88
namespace Magento\GraphQl\App\State;
99

10+
use Magento\Framework\Exception\InputException;
1011
use Magento\Framework\ObjectManagerInterface;
1112

1213
/**
@@ -95,7 +96,11 @@ public function getPropertiesFromObject(object $object, $doClone = false, &$didC
9596
}
9697
if (is_object($value)) {
9798
$didClone = true;
98-
$properties[$propName] = clone $value;
99+
try {
100+
$properties[$propName] = clone $value;
101+
} catch (\Error $e) {
102+
continue;
103+
}
99104
} elseif (is_array($value)) {
100105
$didClone = true;
101106
$properties[$propName] = $this->cloneArray($value);

0 commit comments

Comments
 (0)