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

Public Member Functions

 testEncryptDecrypt ()
 
 testEncryptDecrypt2 ()
 
 testValidateKey ()
 
 testValidateKeyInvalid ()
 
 testGetValidateHash ()
 

Protected Member Functions

 setUp ()
 

Protected Attributes

 $_model
 

Detailed Description

Definition at line 10 of file ModelTest.php.

Member Function Documentation

◆ setUp()

setUp ( )
protected

Definition at line 17 of file ModelTest.php.

18  {
20  \Magento\Framework\Encryption\Encryptor::class
21  );
22  }

◆ testEncryptDecrypt()

testEncryptDecrypt ( )

Definition at line 24 of file ModelTest.php.

25  {
27 
28  $this->assertEquals('', $encryptor->decrypt($encryptor->encrypt('')));
29  $this->assertEquals('test', $encryptor->decrypt($encryptor->encrypt('test')));
30  }

◆ testEncryptDecrypt2()

testEncryptDecrypt2 ( )

Definition at line 32 of file ModelTest.php.

33  {
35 
36  $initial = md5(uniqid());
37  $encrypted = $encryptor->encrypt($initial);
38  $this->assertNotEquals($initial, $encrypted);
39  $this->assertEquals($initial, $encryptor->decrypt($encrypted));
40  }

◆ testGetValidateHash()

testGetValidateHash ( )

Definition at line 57 of file ModelTest.php.

58  {
59  $password = uniqid();
60  $hash = $this->_model->getHash($password, true);
61 
62  $this->assertTrue(is_string($hash));
63  $this->assertTrue($this->_model->validateHash($password, $hash));
64  }

◆ testValidateKey()

testValidateKey ( )

Definition at line 42 of file ModelTest.php.

43  {
44  $validKey = md5(uniqid());
45  $this->_model->validateKey($validKey);
46  }

◆ testValidateKeyInvalid()

testValidateKeyInvalid ( )

@expectedException \Exception

Definition at line 51 of file ModelTest.php.

52  {
53  $invalidKey = '---- ';
54  $this->_model->validateKey($invalidKey);
55  }

Field Documentation

◆ $_model

$_model
protected

Definition at line 15 of file ModelTest.php.


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