ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilMd5PasswordEncoderTest Class Reference
+ Inheritance diagram for ilMd5PasswordEncoderTest:
+ Collaboration diagram for ilMd5PasswordEncoderTest:

Public Member Functions

 testInstanceCanBeCreated ()
 
 testPasswordShouldBeCorrectlyEncoded (ilMd5PasswordEncoder $encoder)
 
 testPasswordCanBeVerified (ilMd5PasswordEncoder $encoder)
 
 testEncoderDoesNotRelyOnSalts (ilMd5PasswordEncoder $encoder)
 
 testEncoderDoesNotSupportReencoding (ilMd5PasswordEncoder $encoder)
 
 testExceptionIsRaisedIfThePasswordExceedsTheSupportedLengthOnEncoding (ilMd5PasswordEncoder $encoder)
 
 testPasswordVerificationShouldFailIfTheRawPasswordExceedsTheSupportedLength (ilMd5PasswordEncoder $encoder)
 
 testNameShouldBeMd5 (ilMd5PasswordEncoder $encoder)
 

Detailed Description

Definition at line 23 of file ilMd5PasswordEncoderTest.php.

Member Function Documentation

◆ testEncoderDoesNotRelyOnSalts()

ilMd5PasswordEncoderTest::testEncoderDoesNotRelyOnSalts ( ilMd5PasswordEncoder  $encoder)

Definition at line 45 of file ilMd5PasswordEncoderTest.php.

45 : void
46 {
47 $this->assertFalse($encoder->requiresSalt());
48 }
requiresSalt()
Returns whether the encoder requires a salt.

References ilBasePasswordEncoder\requiresSalt().

+ Here is the call graph for this function:

◆ testEncoderDoesNotSupportReencoding()

ilMd5PasswordEncoderTest::testEncoderDoesNotSupportReencoding ( ilMd5PasswordEncoder  $encoder)

Definition at line 51 of file ilMd5PasswordEncoderTest.php.

51 : void
52 {
53 $this->assertFalse($encoder->requiresReencoding('hello'));
54 }
requiresReencoding(string $encoded)
Returns whether the encoded password needs to be re-encoded.

References ilBasePasswordEncoder\requiresReencoding().

+ Here is the call graph for this function:

◆ testExceptionIsRaisedIfThePasswordExceedsTheSupportedLengthOnEncoding()

ilMd5PasswordEncoderTest::testExceptionIsRaisedIfThePasswordExceedsTheSupportedLengthOnEncoding ( ilMd5PasswordEncoder  $encoder)

Definition at line 57 of file ilMd5PasswordEncoderTest.php.

59 : void {
60 $this->expectException(ilPasswordException::class);
61 $encoder->encodePassword(str_repeat('a', 5000), '');
62 }
encodePassword(string $raw, string $salt)
Encodes the raw password.

◆ testInstanceCanBeCreated()

ilMd5PasswordEncoderTest::testInstanceCanBeCreated ( )

Definition at line 25 of file ilMd5PasswordEncoderTest.php.

26 {
27 $encoder = new ilMd5PasswordEncoder();
28 $this->assertInstanceOf(ilMd5PasswordEncoder::class, $encoder);
29 return $encoder;
30 }

◆ testNameShouldBeMd5()

ilMd5PasswordEncoderTest::testNameShouldBeMd5 ( ilMd5PasswordEncoder  $encoder)

Definition at line 72 of file ilMd5PasswordEncoderTest.php.

72 : void
73 {
74 $this->assertSame('md5', $encoder->getName());
75 }
getName()
Returns a unique name/id of the concrete password encoder.

References ilMd5PasswordEncoder\getName().

+ Here is the call graph for this function:

◆ testPasswordCanBeVerified()

ilMd5PasswordEncoderTest::testPasswordCanBeVerified ( ilMd5PasswordEncoder  $encoder)

Definition at line 39 of file ilMd5PasswordEncoderTest.php.

39 : void
40 {
41 $this->assertTrue($encoder->isPasswordValid(md5('password'), 'password', ''));
42 }
isPasswordValid(string $encoded, string $raw, string $salt)
Checks a raw password against an encoded password.

References ilMd5PasswordEncoder\isPasswordValid().

+ Here is the call graph for this function:

◆ testPasswordShouldBeCorrectlyEncoded()

ilMd5PasswordEncoderTest::testPasswordShouldBeCorrectlyEncoded ( ilMd5PasswordEncoder  $encoder)

Definition at line 33 of file ilMd5PasswordEncoderTest.php.

33 : void
34 {
35 $this->assertSame(md5('password'), $encoder->encodePassword('password', ''));
36 }

References ilMd5PasswordEncoder\encodePassword().

+ Here is the call graph for this function:

◆ testPasswordVerificationShouldFailIfTheRawPasswordExceedsTheSupportedLength()

ilMd5PasswordEncoderTest::testPasswordVerificationShouldFailIfTheRawPasswordExceedsTheSupportedLength ( ilMd5PasswordEncoder  $encoder)

Definition at line 65 of file ilMd5PasswordEncoderTest.php.

67 : void {
68 $this->assertFalse($encoder->isPasswordValid('encoded', str_repeat('a', 5000), ''));
69 }

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