Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Attributes
SessionTest Class Reference
Inheritance diagram for SessionTest:

Public Member Functions

 testLoginById ()
 
 testLoginActionFlushesFormKey ()
 
 testLogoutActionFlushesFormKey ()
 

Protected Attributes

 $_customerSession
 
 $formKey
 
 $cookieMetadata
 

Detailed Description

@magentoDataFixture Magento/Customer/_files/customer.php @magentoAppIsolation enabled

Definition at line 17 of file SessionTest.php.

Member Function Documentation

◆ testLoginActionFlushesFormKey()

testLoginActionFlushesFormKey ( )

Verifies that logging in flushes form_key

Definition at line 76 of file SessionTest.php.

77  {
78  $beforeKey = $this->formKey->get();
79  $this->_customerSession->loginById(1);
80  $afterKey = $this->formKey->get();
81 
82  $this->assertNotEquals($beforeKey, $afterKey);
83  }

◆ testLoginById()

testLoginById ( )

Definition at line 53 of file SessionTest.php.

54  {
55  $this->assertTrue($this->_customerSession->loginById(1));
56  // fixture
57  $this->assertTrue($this->_customerSession->isLoggedIn());
58  }

◆ testLogoutActionFlushesFormKey()

testLogoutActionFlushesFormKey ( )

Verifies that logging out flushes form_key

Definition at line 88 of file SessionTest.php.

89  {
90  $this->_customerSession->loginById(1);
91 
92  $this->formKey->set(
93  'form_key',
94  $this->cookieMetadata
95  );
96 
97  $beforeKey = $this->formKey->get();
98  $this->_customerSession->logout();
99  $afterKey = $this->formKey->get();
100 
101  $this->assertNotEquals($beforeKey, $afterKey);
102  }

Field Documentation

◆ $_customerSession

$_customerSession
protected

Definition at line 22 of file SessionTest.php.

◆ $cookieMetadata

$cookieMetadata
protected

Definition at line 30 of file SessionTest.php.

◆ $formKey

$formKey
protected

Definition at line 27 of file SessionTest.php.


The documentation for this class was generated from the following file: