コード例 #1
0
 /**
  * @param DataAdapterInterface $data
  * @param int                  $length
  *
  * @return string
  */
 public function getRandomSample(DataAdapterInterface $data, $length)
 {
     $sample = '';
     $maxByte = $data->getSize() - 1;
     for ($i = 0; $i < $length; $i++) {
         $randomIndex = mt_rand(0, $maxByte);
         $sample .= $data->getByte($randomIndex);
     }
     return $sample;
 }
コード例 #2
0
 /**
  * @throws Exception
  */
 public function testGetSize()
 {
     $this->assertEquals(self::$adapter->getSize(), self::$length);
 }
コード例 #3
0
 /**
  * @throws Exception
  */
 public function testGetSize()
 {
     $this->assertEquals(self::$adapter->getSize(), strlen(self::$testString));
 }