public function testLinkUpload()
 {
     $title = "api-php-link-upload-" . generateRandomStr(5);
     $videoId = Vzaar::uploadLink(self::$fileUrl, $title);
     $vid = Vzaar::getVideoDetails($videoId, true);
     $this->assertEquals($vid->videoStatusDescription, "Preparing");
     // clean up
     Vzaar::deleteVideo($videoId);
 }
 public function testUploadVideo()
 {
     $title = "api-php-" . generateRandomStr(5);
     $guid = Vzaar::uploadVideo(self::$filePath);
     $videoId = Vzaar::processVideo($guid, $title, "php test", "");
     $vid = Vzaar::getVideoDetails($videoId, true);
     $this->assertEquals($vid->videoStatusDescription, "Preparing");
     // clean up
     Vzaar::deleteVideo($videoId);
 }
 public function testEditVideo()
 {
     $videoId = API_ENVS::get()["user1"]["test_video_id"];
     $newTitle = "api-php-" . generateRandomStr(7);
     $vid = Vzaar::getVideoDetails($videoId, true);
     $originalTitle = $vid->title;
     Vzaar::editVideo($videoId, $newTitle, "woof", false);
     $vid = Vzaar::getVideoDetails($videoId, true);
     $this->assertNotEquals($vid->title, $originalTitle);
 }
示例#4
0
        $pos = mt_rand(0, $max);
        $result .= $source[$pos];
    }
    return $result;
}
function generate_password($length = 8)
{
    $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKL" . "MNOPQRSTUVWXYZ0123456789!@#\$%^&*()-_ []{}<>~`+=,.;:/?|";
    $password = "";
    $max = strlen($chars) - 1;
    for ($i = 0; $i < $length; $i++) {
        $password .= $chars[mt_rand(0, $max)];
    }
    return $password;
}
//=============================
$time = microtime(true);
for ($i = 0; $i < 100000; $i++) {
    generateRandomStr(8, 'mix', '!@#$%^&*()-_ []{}<>~`+=,.;:/?|');
}
$time2 = microtime(true);
for ($i = 0; $i < 100000; $i++) {
    generate_password(8);
}
$time3 = microtime(true);
echo $time2 - $time . "<br />";
echo $time3 - $time2 . "<br />";
/*==========================
 * 2.5009999275208
 * 2.3229999542236
 *=========================*/