ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilMd5PasswordEncoderTest.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2014 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once 'Services/Password/classes/encoders/class.ilMd5PasswordEncoder.php';
5 require_once 'Services/Password/test/ilPasswordBaseTest.php';
6 
13 {
17  public function testInstanceCanBeCreated()
18  {
19  $encoder = new ilMd5PasswordEncoder();
20  $this->assertInstanceOf('ilMd5PasswordEncoder', $encoder);
21  return $encoder;
22  }
23 
28  {
29  $this->assertSame(md5('password'), $encoder->encodePassword('password', ''));
30  }
31 
36  {
37  $this->assertTrue($encoder->isPasswordValid(md5('password'), 'password', ''));
38  }
39 
44  {
45  $this->assertFalse($encoder->requiresSalt());
46  }
47 
52  {
53  $this->assertFalse($encoder->requiresReencoding('hello'));
54  }
55 
61  {
62  $this->assertException(ilPasswordException::class);
63  $encoder->encodePassword(str_repeat('a', 5000), '');
64  }
65 
70  {
71  $this->assertFalse($encoder->isPasswordValid('encoded', str_repeat('a', 5000), ''));
72  }
73 
77  public function testNameShouldBeMd5(ilMd5PasswordEncoder $encoder)
78  {
79  $this->assertEquals('md5', $encoder->getName());
80  }
81 }
testNameShouldBeMd5(ilMd5PasswordEncoder $encoder)
testInstanceCanBeCreated
requiresSalt()
{Returns whether or not the encoder requires a salt.boolean}
testEncoderDoesNotRelyOnSalts(ilMd5PasswordEncoder $encoder)
testInstanceCanBeCreated
isPasswordValid($encoded, $raw, $salt)
{Checks a raw password against an encoded password.The raw password has to be injected into the encod...
testEncoderDoesNotSupportReencoding(ilMd5PasswordEncoder $encoder)
testInstanceCanBeCreated
encodePassword($raw, $salt)
{Encodes the raw password.The password to encode The salt string The encoded password} ...
getName()
{Returns a unique name/id of the concrete password encoder.string}
testPasswordVerificationShouldFailIfTheRawPasswordExceedsTheSupportedLength(ilMd5PasswordEncoder $encoder)
testInstanceCanBeCreated
requiresReencoding($encoded)
{Returns whether or not the a encoded password needs to be re-encoded.string boolean} ...
testPasswordCanBeVerified(ilMd5PasswordEncoder $encoder)
testInstanceCanBeCreated
testPasswordShouldBeCorrectlyEncoded(ilMd5PasswordEncoder $encoder)
testInstanceCanBeCreated
testExceptionIsRaisedIfThePasswordExceedsTheSupportedLengthOnEncoding(ilMd5PasswordEncoder $encoder)
testInstanceCanBeCreated ilPasswordException
assertException($exception_class)