TYPO3 CMS  TYPO3_6-2
EvaluatorTest.php
Go to the documentation of this file.
1 <?php
3 
19 
26 
30  protected $subject;
31 
35  public function setUp() {
36  $this->subject = $this->getMock('TYPO3\\CMS\\Saltedpasswords\\Evaluation\\Evaluator', array('dummy'));
37 
38  // Make sure SaltedPasswordsUtility::isUsageEnabled() returns TRUE
39  unset($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['saltedpasswords']);
40  $GLOBALS['TYPO3_CONF_VARS']['BE']['loginSecurityLevel'] = 'rsa';
41  }
42 
47  $isSet = NULL;
48  $originalPassword = 'password';
49  $saltedPassword = $this->subject->evaluateFieldValue($originalPassword, '', $isSet);
50  $this->assertTrue($isSet);
51  $this->assertNotEquals($originalPassword, $saltedPassword);
52  $this->assertTrue(GeneralUtility::inList('$1$,$2$,$2a,$P$', substr($saltedPassword, 0, 3)));
53  }
54 
59  $isSet = NULL;
60  $originalPassword = '5f4dcc3b5aa765d61d8327deb882cf99';
61  $saltedPassword = $this->subject->evaluateFieldValue($originalPassword, '', $isSet);
62  $this->assertTrue($isSet);
63  $this->assertNotEquals($originalPassword, $saltedPassword);
64  $this->assertTrue(GeneralUtility::isFirstPartOfStr($saltedPassword, 'M$'));
65  }
66 
71  $isSet = NULL;
72  $originalPassword = 'M$P$CibIRipvLfaPlaaeH8ifu9g21BrPjp.';
73  $saltedPassword = $this->subject->evaluateFieldValue($originalPassword, '', $isSet);
74  $this->assertSame(NULL, $isSet);
75  $this->assertSame($originalPassword, $saltedPassword);
76  }
77 }
static isFirstPartOfStr($str, $partStr)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]