customerRegistry = Bootstrap::getObjectManager()->get(CustomerRegistry::class); $this->customerRepository = Bootstrap::getObjectManager()->get(CustomerRepositoryInterface::class); } /** * @throws \Exception */ public function testCreateCustomerAccountWithPassword() { $newFirstname = 'Richard'; $newLastname = 'Rowe'; $currentPassword = 'test123#'; $newEmail = 'customer_created' . rand(1, 2000000) . '@example.com'; $query = <<graphQlQuery($query); $this->assertEquals($newFirstname, $response['createCustomer']['customer']['firstname']); $this->assertEquals($newLastname, $response['createCustomer']['customer']['lastname']); $this->assertEquals($newEmail, $response['createCustomer']['customer']['email']); $this->assertEquals(true, $response['createCustomer']['customer']['is_subscribed']); } /** * @throws \Exception */ public function testCreateCustomerAccountWithoutPassword() { $newFirstname = 'Richard'; $newLastname = 'Rowe'; $newEmail = 'customer_created' . rand(1, 2000000) . '@example.com'; $query = <<graphQlQuery($query); $this->assertEquals($newFirstname, $response['createCustomer']['customer']['firstname']); $this->assertEquals($newLastname, $response['createCustomer']['customer']['lastname']); $this->assertEquals($newEmail, $response['createCustomer']['customer']['email']); $this->assertEquals(true, $response['createCustomer']['customer']['is_subscribed']); } /** * @expectedException \Exception * @expectedExceptionMessage "input" value should be specified */ public function testCreateCustomerIfInputDataIsEmpty() { $query = <<graphQlQuery($query); } /** * @expectedException \Exception * @expectedExceptionMessage The customer email is missing. Enter and try again. */ public function testCreateCustomerIfEmailMissed() { $newFirstname = 'Richard'; $newLastname = 'Rowe'; $currentPassword = 'test123#'; $query = <<graphQlQuery($query); } /** * @expectedException \Exception * @expectedExceptionMessage "Email" is not a valid email address. */ public function testCreateCustomerIfEmailIsNotValid() { $newFirstname = 'Richard'; $newLastname = 'Rowe'; $currentPassword = 'test123#'; $newEmail = 'email'; $query = <<graphQlQuery($query); } /** * @expectedException \Exception * @expectedExceptionMessage Field "test123" is not defined by type CustomerInput. */ public function testCreateCustomerIfPassedAttributeDosNotExistsInCustomerInput() { $newFirstname = 'Richard'; $newLastname = 'Rowe'; $currentPassword = 'test123#'; $newEmail = 'customer_created' . rand(1, 2000000) . '@example.com'; $query = <<graphQlQuery($query); } }