Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ChangeCustomerPasswordTest.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 
32 class ChangeCustomerPasswordTest extends Injectable
33 {
34  /* tags */
35  const MVP = 'yes';
36  /* end tags */
37 
43  protected $cmsIndex;
44 
51 
58 
65 
75  public function __inject(
76  CmsIndex $cmsIndex,
77  CustomerAccountLogin $customerAccountLogin,
78  CustomerAccountIndex $customerAccountIndex,
79  CustomerAccountEdit $customerAccountEdit
80  ) {
81  $this->cmsIndex = $cmsIndex;
82  $this->customerAccountLogin = $customerAccountLogin;
83  $this->customerAccountIndex = $customerAccountIndex;
84  $this->customerAccountEdit = $customerAccountEdit;
85  }
86 
94  public function test(Customer $initialCustomer, Customer $customer)
95  {
96  // Preconditions
97  $initialCustomer->persist();
98 
99  // Steps
100  $this->objectManager->create(
101  \Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep::class,
102  ['customer' => $initialCustomer]
103  )->run();
104 
105  $this->cmsIndex->getLinksBlock()->openLink('My Account');
106  $this->customerAccountIndex->getInfoBlock()->openChangePassword();
107  $this->customerAccountEdit->getAccountInfoForm()->fill($customer);
108  $this->customerAccountEdit->getAccountInfoForm()->submit();
109  }
110 }
$customer
Definition: customers.php:11
__inject(CmsIndex $cmsIndex, CustomerAccountLogin $customerAccountLogin, CustomerAccountIndex $customerAccountIndex, CustomerAccountEdit $customerAccountEdit)