本文整理汇总了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);
}