本文整理匯總了PHP中test::random_string方法的典型用法代碼示例。如果您正苦於以下問題:PHP test::random_string方法的具體用法?PHP test::random_string怎麽用?PHP test::random_string使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類test
的用法示例。
在下文中一共展示了test::random_string方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: random_name
static function random_name($item = null)
{
$rand = "name_" . test::random_string(6);
if ($item && $item->is_photo()) {
$rand .= ".jpg";
}
return $rand;
}
示例2: change_album_test
public function change_album_test()
{
$controller = new Albums_Controller();
$album = test::random_album();
// Randomize to avoid conflicts.
$new_name = "new_name_" . test::random_string(6);
$_POST["name"] = $new_name;
$_POST["title"] = "new title";
$_POST["description"] = "new description";
$_POST["column"] = "weight";
$_POST["direction"] = "ASC";
$_POST["csrf"] = access::csrf_token();
$_POST["slug"] = "new-name";
access::allow(identity::everybody(), "edit", item::root());
ob_start();
$controller->update($album->id);
$album->reload();
$results = ob_get_contents();
ob_end_clean();
$this->assert_equal(json_encode(array("result" => "success")), $results);
$this->assert_equal($new_name, $album->name);
$this->assert_equal("new title", $album->title);
$this->assert_equal("new description", $album->description);
}