ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
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 }