예제 #1
0
 public function testRandomNumberGeneration()
 {
     $randUtils = new RandomUtils();
     $randomVals = array();
     for ($i = 0; $i < 10; $i++) {
         $randomVals[] = $randUtils->getBytes(10, true);
     }
     //assertNotNull);
     $randomVals = array_unique($randomVals);
     $this->assertCount(10, $randomVals);
 }
 /**
  * Generate CSRF Token of given length. 
  * 
  * @param mixed $length 
  * @access private
  * @return void
  */
 private function _generateCSRFToken($length = 32)
 {
     $randUtils = new RandomUtils();
     $randToken = $randUtils->getBytes($length, true);
     return base64_encode($randToken);
 }