Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ExpireSessionTest.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Mtf\TestCase\Injectable;
11 use Magento\Mtf\TestStep\TestStepFactory;
12 
25 class ExpireSessionTest extends Injectable
26 {
27  /* tags */
28  const MVP = 'no';
29  /* end tags */
30 
36  private $configData;
37 
43  private $stepFactory;
44 
51  public function __inject(TestStepFactory $stepFactory)
52  {
53  $this->stepFactory = $stepFactory;
54  }
55 
64  public function test(
65  $sessionLifetimeInSeconds,
66  $configData,
67  Customer $customer = null
68  ) {
69  $this->configData = $configData;
70  $this->stepFactory->create(
71  \Magento\Config\Test\TestStep\SetupConfigurationStep::class,
72  ['configData' => $this->configData]
73  )->run();
74 
75  if ($customer != null) {
76  $customer->persist();
77  $this->stepFactory->create(
78  \Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep::class,
79  ['customer' => $customer]
80  )->run();
81  }
82 
86  sleep($sessionLifetimeInSeconds);
87  }
88 
94  public function tearDown()
95  {
96  $this->stepFactory->create(
97  \Magento\Config\Test\TestStep\SetupConfigurationStep::class,
98  ['configData' => $this->configData, 'rollback' => true]
99  )->run();
100  }
101 }
$customer
Definition: customers.php:11
test( $sessionLifetimeInSeconds, $configData, Customer $customer=null)