Skip to content
This repository was archived by the owner on Dec 19, 2019. It is now read-only.

Commit fe89ce4

Browse files
committed
magento/devdocs#: createCustomer. Test coverage. Case: create new customer with the email of already existent user
1 parent 3efbe15 commit fe89ce4

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerTest.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,39 @@ public function testCreateCustomerSubscribed()
308308
$this->assertEquals(false, $response['createCustomer']['customer']['is_subscribed']);
309309
}
310310

311+
/**
312+
* @magentoApiDataFixture Magento/Customer/_files/customer.php
313+
* @expectedException \Exception
314+
* @expectedExceptionMessage A customer with the same email address already exists in an associated website.
315+
*/
316+
public function testCreateCustomerIfCustomerWithProvidedEmailAlreadyExists()
317+
{
318+
$existedEmail = '[email protected]';
319+
$password = 'test123#';
320+
$firstname = 'John';
321+
$lastname = 'Smith';
322+
323+
$query = <<<QUERY
324+
mutation {
325+
createCustomer(
326+
input: {
327+
email: "{$existedEmail}"
328+
password: "{$password}"
329+
firstname: "{$firstname}"
330+
lastname: "{$lastname}"
331+
}
332+
) {
333+
customer {
334+
firstname
335+
lastname
336+
email
337+
}
338+
}
339+
}
340+
QUERY;
341+
$this->graphQlMutation($query);
342+
}
343+
311344
public function tearDown()
312345
{
313346
$newEmail = '[email protected]';

0 commit comments

Comments
 (0)