コード例 #1
0
ファイル: Hash.php プロジェクト: jhonbendar/framework
 /**
  * @return static BCrypt Instance
  */
 public static function instance()
 {
     if (isset(static::$cache['hash']) && is_object(static::$cache['hash'])) {
         return static::$cache['hash'];
     }
     return static::$cache['hash'] = BCrypt::make();
 }
コード例 #2
0
ファイル: HashTest.php プロジェクト: jhonbendar/framework
 public function testCreateHashByCryptMockInstance()
 {
     $hash = m::mock('Cygnite\\Hash\\BCrypt');
     $this->assertInstanceOf('Cygnite\\Hash\\BCrypt', $hash);
     $crypt = Hash::instance();
     $this->assertEquals(BCrypt::make(), $crypt);
     $this->assertInstanceOf('Cygnite\\Hash\\BCrypt', BCrypt::make());
 }