Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CreateCustomerStep.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Mtf\TestStep\TestStepInterface;
11 
16 class CreateCustomerStep implements TestStepInterface
17 {
23  protected $customer;
24 
30  protected $persistCustomer = true;
31 
38 
45  public function __construct(LogoutCustomerOnFrontendStep $logout, Customer $customer, $checkoutMethod = '')
46  {
47  $this->logoutCustomerOnFrontend = $logout;
48  $this->customer = $customer;
49  if ($checkoutMethod === 'register'
50  || $checkoutMethod === 'guest'
51  || $checkoutMethod === 'register_before_checkout') {
52  $this->persistCustomer = false;
53  }
54  }
55 
61  public function run()
62  {
63  if ($this->persistCustomer) {
64  $this->customer->persist();
65  }
66 
67  return ['customer' => $this->customer];
68  }
69 
75  public function cleanup()
76  {
77  $this->logoutCustomerOnFrontend->run();
78  }
79 }
__construct(LogoutCustomerOnFrontendStep $logout, Customer $customer, $checkoutMethod='')