Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
LockCustomerOnLoginPageTest.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\TestCase\Injectable;
11 use Magento\Customer\Test\Page\CustomerAccountLogin;
13 use Magento\Mtf\Fixture\FixtureFactory;
14 
28 class LockCustomerOnLoginPageTest extends Injectable
29 {
30  /* tags */
31  const MVP = 'yes';
32  const SEVERITY = 'S1';
33  /* end tags */
34 
41 
47  protected $configData;
48 
55  public function __inject(
56  CustomerAccountLogin $customerAccountLogin
57  ) {
58  $this->customerAccountLogin = $customerAccountLogin;
59  }
60 
71  public function test(
72  Customer $initialCustomer,
73  $attempts,
74  FixtureFactory $fixtureFactory,
75  $incorrectPassword,
76  $configData = null
77  ) {
78  $this->configData = $configData;
79 
80  // Preconditions
81  $this->objectManager->create(
82  \Magento\Config\Test\TestStep\SetupConfigurationStep::class,
83  ['configData' => $this->configData]
84  )->run();
85  $initialCustomer->persist();
86  $incorrectCustomer = $fixtureFactory->createByCode(
87  'customer',
88  ['data' => ['email' => $initialCustomer->getEmail(), 'password' => $incorrectPassword]]
89  );
90 
91  // Steps
92  for ($i = 0; $i < $attempts; $i++) {
93  $this->customerAccountLogin->open();
94  $this->customerAccountLogin->getLoginBlock()->fill($incorrectCustomer);
95  $this->customerAccountLogin->getLoginBlock()->submit();
96  }
97  }
98 
104  public function tearDown()
105  {
106  $this->objectManager->create(
107  \Magento\Config\Test\TestStep\SetupConfigurationStep::class,
108  ['configData' => $this->configData, 'rollback' => true]
109  )->run();
110  }
111 }
test(Customer $initialCustomer, $attempts, FixtureFactory $fixtureFactory, $incorrectPassword, $configData=null)
$i
Definition: gallery.phtml:31