ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
4require_once 'Services/Password/classes/encoders/class.ilMd5PasswordEncoder.php';
5
12{
16 public function testInstanceCanBeCreated()
17 {
18 $this->assertInstanceOf('ilMd5PasswordEncoder', new ilMd5PasswordEncoder());
19 }
20
25 {
26 $encoder = new ilMd5PasswordEncoder();
27 $this->assertSame(md5('password'), $encoder->encodePassword('password', ''));
28 }
29
33 public function testPasswordCanBeVerified()
34 {
35 $encoder = new ilMd5PasswordEncoder();
36 $this->assertTrue($encoder->isPasswordValid(md5('password'), 'password', ''));
37 }
38
43 {
44 $encoder = new ilMd5PasswordEncoder();
45 $encoder->encodePassword(str_repeat('a', 5000), '');
46 }
47
52 {
53 $encoder = new ilMd5PasswordEncoder();
54 $this->assertFalse($encoder->isPasswordValid('encoded', str_repeat('a', 5000), ''));
55 }
56
60 public function testNameShouldBeMd5()
61 {
62 $encoder = new ilMd5PasswordEncoder();
63 $this->assertEquals('md5', $encoder->getName());
64 }
65}
testExceptionIsRaisedIfThePasswordExceedsTheSupportedLengthOnEncoding()
@expectedException ilPasswordException
testPasswordVerificationShouldFailIfTheRawPasswordExceedsTheSupportedLength()