public function testHashingIsAlwaysCorrect()
 {
     $hasher = new Hasher();
     $password = '******';
     $hashedPassword = $hasher->hash($password);
     $this->assertTrue($hasher->checkhash($password, $hashedPassword));
     $this->assertFalse($hasher->checkhash($password . '$', $hashedPassword));
 }
Пример #2
0
 /**
  * Regresstion test for https://github.com/cartalyst/sentry/issues/98
  *
  * @runInSeparateProcess
  * @expectedException RuntimeException
  */
 public function testExceptionIsThrownIfHasherFails()
 {
     // Override the password hash function
     function password_hash()
     {
         return false;
     }
     $hasher = new Hasher();
     $hasher->hash('foo');
 }
Пример #3
0
 /**
  * Regression test for https://github.com/cartalyst/sentry/issues/98
  *
  * @runInSeparateProcess
  */
 public function testExceptionIsThrownIfHasherFails()
 {
     // Override the password hash function if it doesn't exist
     if (version_compare(PHP_VERSION, '5.5.0') < 0) {
         $this->setExpectedException('RuntimeException');
         function password_hash()
         {
             return false;
         }
         $hasher = new Hasher();
         $hasher->hash('foo');
     }
 }