From 35293ae4fbded3533dfaa6c057a6e166cee5892e Mon Sep 17 00:00:00 2001 From: Lena Orobei Date: Fri, 7 Jun 2019 17:23:25 -0500 Subject: [PATCH] magento/magento2#675: [Test coverage] Generate customer token - test refactoring --- .../Customer/GenerateCustomerTokenTest.php | 56 ++++++++----------- 1 file changed, 22 insertions(+), 34 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/GenerateCustomerTokenTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/GenerateCustomerTokenTest.php index c17fe2a7b611..ad72a894be44 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/GenerateCustomerTokenTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/GenerateCustomerTokenTest.php @@ -24,17 +24,7 @@ public function testGenerateCustomerValidToken() $email = 'customer@example.com'; $password = 'password'; - $mutation - = <<getQuery($email, $password); $response = $this->graphQlMutation($mutation); $this->assertArrayHasKey('generateCustomerToken', $response); @@ -52,19 +42,9 @@ public function testGenerateCustomerValidToken() * @param string $password * @param string $message */ - public function testGenerateCustomerTokenNegativeCases(string $email, string $password, string $message) + public function testGenerateCustomerTokenInvalidData(string $email, string $password, string $message) { - $mutation - = <<getQuery($email, $password); $this->expectExceptionMessage($message); $this->graphQlMutation($mutation); } @@ -79,17 +59,7 @@ public function testRegenerateCustomerToken() $email = 'customer@example.com'; $password = 'password'; - $mutation - = <<getQuery($email, $password); $response1 = $this->graphQlMutation($mutation); $token1 = $response1['generateCustomerToken']['token']; @@ -131,4 +101,22 @@ public function dataProviderInvalidCustomerInfo(): array ] ]; } + + /** + * @param string $email + * @param string $password + * @return string + */ + private function getQuery(string $email, string $password) : string { + return <<