Exemplo n.º 1
0
 /**
  * @test
  */
 public function validatePasswordWillUseStrategyIdentifierFromHashedPassword()
 {
     $settings = array('security' => array('cryptography' => array('hashingStrategies' => array('TestStrategy' => 'TYPO3\\FLOW3\\Test\\TestStrategy'))));
     $this->hashService->injectSettings($settings);
     $mockStrategy = $this->getMock('TYPO3\\FLOW3\\Security\\Cryptography\\PasswordHashingStrategyInterface');
     $mockObjectManager = $this->getMock('TYPO3\\FLOW3\\Object\\ObjectManagerInterface');
     $mockObjectManager->expects($this->any())->method('get')->will($this->returnValue($mockStrategy));
     \TYPO3\FLOW3\Reflection\ObjectAccess::setProperty($this->hashService, 'objectManager', $mockObjectManager, TRUE);
     $mockStrategy->expects($this->atLeastOnce())->method('validatePassword')->with('myTestPassword', '---hashed-password---')->will($this->returnValue(TRUE));
     $result = $this->hashService->validatePassword('myTestPassword', 'TestStrategy=>---hashed-password---');
     $this->assertEquals(TRUE, $result);
 }