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

Commit

Permalink
magento/devdocs#: createCustomer. Test coverage. Case: create new cus…
Browse files Browse the repository at this point in the history
…tomer with the email of already existent user
  • Loading branch information
atwixfirster committed Nov 10, 2019
1 parent 3efbe15 commit fe89ce4
Showing 1 changed file with 33 additions and 0 deletions.
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

0 comments on commit fe89ce4

Please sign in to comment.