Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
LockCustomerOnEditPageTest.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\TestCase\Injectable;
10 use Magento\Cms\Test\Page\CmsIndex;
12 use Magento\Customer\Test\Page\CustomerAccountEdit;
13 use Magento\Customer\Test\Page\CustomerAccountIndex;
14 use Magento\Customer\Test\Page\CustomerAccountLogin;
15 
35 class LockCustomerOnEditPageTest extends Injectable
36 {
37  /* tags */
38  const MVP = 'yes';
39  const SEVERITY = 'S1';
40  /* end tags */
41 
47  protected $cmsIndex;
48 
55 
62 
69 
75  protected $configData;
76 
86  public function __inject(
87  CmsIndex $cmsIndex,
88  CustomerAccountLogin $customerAccountLogin,
89  CustomerAccountIndex $customerAccountIndex,
90  CustomerAccountEdit $customerAccountEdit
91  ) {
92  $this->cmsIndex = $cmsIndex;
93  $this->customerAccountLogin = $customerAccountLogin;
94  $this->customerAccountIndex = $customerAccountIndex;
95  $this->customerAccountEdit = $customerAccountEdit;
96  }
97 
107  public function test(
108  Customer $initialCustomer,
109  Customer $customer,
110  $attempts,
111  $configData = null
112  ) {
113  $this->configData = $configData;
114  // Preconditions
115  $this->objectManager->create(
116  \Magento\Config\Test\TestStep\SetupConfigurationStep::class,
117  ['configData' => $this->configData]
118  )->run();
119  $initialCustomer->persist();
120 
121  // Steps
122  $this->objectManager->create(
123  \Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep::class,
124  ['customer' => $initialCustomer]
125  )->run();
126 
127  $this->cmsIndex->getLinksBlock()->openLink('My Account');
128  $this->customerAccountIndex->getInfoBlock()->openChangePassword();
129  for ($i = 0; $i < $attempts; $i++) {
130  if ($i > 0) {
131  $this->customerAccountIndex->getInfoBlock()->checkChangePassword();
132  }
133  $this->customerAccountEdit->getAccountInfoForm()->fill($customer);
134  $this->customerAccountEdit->getAccountInfoForm()->submit();
135  }
136  }
137 
143  public function tearDown()
144  {
145  $this->objectManager->create(
146  \Magento\Config\Test\TestStep\SetupConfigurationStep::class,
147  ['configData' => $this->configData, 'rollback' => true]
148  )->run();
149  }
150 }
test(Customer $initialCustomer, Customer $customer, $attempts, $configData=null)
__inject(CmsIndex $cmsIndex, CustomerAccountLogin $customerAccountLogin, CustomerAccountIndex $customerAccountIndex, CustomerAccountEdit $customerAccountEdit)
$customer
Definition: customers.php:11
$i
Definition: gallery.phtml:31