From 92d9cf7204ac4cfe8b9718371cd05f46e5f78ced Mon Sep 17 00:00:00 2001 From: Devansh Date: Thu, 10 Feb 2022 14:49:02 +0530 Subject: [PATCH] Test Case Updated --- tests/_support/FunctionalTester.php | 3 ++- tests/functional/Admin/Customer/AddressCest.php | 5 +---- tests/functional/Customer/CustomerCest.php | 16 +++++++--------- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/tests/_support/FunctionalTester.php b/tests/_support/FunctionalTester.php index 84effa6e1..d46cea087 100644 --- a/tests/_support/FunctionalTester.php +++ b/tests/_support/FunctionalTester.php @@ -1,5 +1,6 @@ cleanAllFields([ + return $I->cleanAllFields([ 'first_name' => $I->fake()->firstName, 'last_name' => $I->fake()->lastName, 'address1' => $I->fake()->streetAddress, diff --git a/tests/functional/Customer/CustomerCest.php b/tests/functional/Customer/CustomerCest.php index dec9389fd..d2c1e58c6 100644 --- a/tests/functional/Customer/CustomerCest.php +++ b/tests/functional/Customer/CustomerCest.php @@ -2,7 +2,6 @@ namespace Tests\Functional\Customer; -use Actions\CleanAction; use Faker\Factory; use FunctionalTester; use Webkul\Customer\Models\Customer; @@ -10,8 +9,6 @@ use Webkul\Customer\Models\CustomerAddress; class CustomerCest { - use CleanAction; - /** * Faker factory. * @@ -59,8 +56,8 @@ class CustomerCest public function updateCustomerProfile(FunctionalTester $I): void { $customer = $I->loginAsCustomer(); - $customer->first_name = $this->cleanField($customer->first_name); - $customer->last_name = $this->cleanField($customer->last_name); + $customer->first_name = $I->cleanField($customer->first_name); + $customer->last_name = $I->cleanField($customer->last_name); $customer->save(); $I->amOnPage('/'); @@ -95,7 +92,7 @@ class CustomerCest $I->click('Address'); $I->click('Add Address'); - $this->setFields(); + $this->setFields($I); foreach ($this->fields as $key => $value) { /** @@ -134,7 +131,7 @@ class CustomerCest $I->click('Edit'); $oldcompany = $this->fields['company_name']; - $this->fields['company_name'] = $this->cleanField($this->faker->company); + $this->fields['company_name'] = $I->cleanField($this->faker->company); $I->submitForm($formCssSelector, $this->fields); @@ -172,11 +169,12 @@ class CustomerCest /** * Set fields. * + * @param FunctionalTester $I * @return void */ - private function setFields() + private function setFields(FunctionalTester $I) { - $this->fields = $this->cleanAllFields([ + $this->fields = $I->cleanAllFields([ 'company_name' => $this->faker->company, 'first_name' => $this->faker->firstName, 'last_name' => $this->faker->lastName,