public function testGetUsrIdWithCorrectOldCredentials()
 {
     $password = '******';
     $encoded = 'qsdfsqdfqsd';
     $nonce = 'dfqsdgqsd';
     $userId = 42;
     $encoder = $this->getEncoderMock();
     $oldEncoder = $this->getOldEncoderMock();
     $request = $this->getRequestMock();
     $user = $this->createUserMock();
     $user->expects($this->any())->method('getId')->will($this->returnValue($userId));
     $user->expects($this->any())->method('isSpecial')->will($this->returnValue(false));
     $user->expects($this->any())->method('isMailLocked')->will($this->returnValue(false));
     $user->expects($this->any())->method('isSaltedPassword')->will($this->returnValue(false));
     $user->expects($this->any())->method('getPassword')->will($this->returnValue($encoded));
     $user->expects($this->any())->method('getNonce')->will($this->returnValue($nonce));
     $manipulator = $this->getUserManipulatorMock();
     $entityRepo = $this->getEntityRepositoryMock($user);
     $manipulator->expects($this->once())->method('setPassword')->with($this->equalTo($user), $this->equalTo($password));
     $oldEncoder->expects($this->once())->method('isPasswordValid')->with($this->equalTo($encoded), $this->equalTo($password), $this->equalTo($nonce))->will($this->returnValue(true));
     $encoder->expects($this->once())->method('isPasswordValid')->will($this->returnCallback(function ($encoded, $pass, $nonce) use(&$catchTestPassword) {
         $catchTestPassword = ['encoded' => $encoded, 'pass' => $pass, 'nonce' => $nonce];
         return true;
     }));
     $auth = new NativeAuthentication($encoder, $oldEncoder, $manipulator, $entityRepo);
     $this->assertEquals($userId, $auth->getUsrId('a_login', $password, $request));
 }
 /**
  * {@inheritdoc}
  *
  * @return FailureHandledNativeAuthentication
  */
 public static function create(Application $app)
 {
     return new static(NativeAuthentication::create($app));
 }