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

magento/devdocs#: createCustomer. Test coverage. Case: create new customer with the email of already existent user #1053

Merged
merged 1 commit into from
Nov 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,39 @@ public function testCreateCustomerSubscribed()
$this->assertEquals(false, $response['createCustomer']['customer']['is_subscribed']);
}

/**
* @magentoApiDataFixture Magento/Customer/_files/customer.php
* @expectedException \Exception
* @expectedExceptionMessage A customer with the same email address already exists in an associated website.
*/
public function testCreateCustomerIfCustomerWithProvidedEmailAlreadyExists()
{
$existedEmail = 'customer@example.com';
$password = 'test123#';
$firstname = 'John';
$lastname = 'Smith';

$query = <<<QUERY
mutation {
createCustomer(
input: {
email: "{$existedEmail}"
password: "{$password}"
firstname: "{$firstname}"
lastname: "{$lastname}"
}
) {
customer {
firstname
lastname
email
}
}
}
QUERY;
$this->graphQlMutation($query);
}

public function tearDown()
{
$newEmail = 'new_customer@example.com';
Expand Down