[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/password_compat/tests/ -> PasswordVerifyTest.php (source)

   1  <?php
   2  
   3  global $CFG;
   4  require_once($CFG->dirroot . '/lib/password_compat/lib/password.php');
   5  
   6  class PasswordVerifyTest extends PHPUnit_Framework_TestCase {
   7      
   8      public function testFuncExists() {
   9          $this->assertTrue(function_exists('password_verify'));
  10      }
  11  
  12      public function testFailedType() {
  13          $this->assertFalse(password_verify(123, 123));
  14      }
  15  
  16      public function testSaltOnly() {
  17          $this->assertFalse(password_verify('foo', '$2a$07$usesomesillystringforsalt$'));
  18      }
  19  
  20      public function testInvalidPassword() {
  21          $this->assertFalse(password_verify('rasmusler', '$2a$07$usesomesillystringfore2uDLvp1Ii2e./U9C8sBjqp8I90dH6hi'));
  22      }
  23  
  24      public function testValidPassword() {
  25          $this->assertTrue(password_verify('rasmuslerdorf', '$2a$07$usesomesillystringfore2uDLvp1Ii2e./U9C8sBjqp8I90dH6hi'));
  26      }
  27  
  28      public function testInValidHash() {
  29          $this->assertFalse(password_verify('rasmuslerdorf', '$2a$07$usesomesillystringfore2uDLvp1Ii2e./U9C8sBjqp8I90dH6hj'));
  30      }
  31  
  32  }


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1